Si quieres tener en cuenta los nombre y apellidos compuestos tienes que analizar cada cada campo y montar despues como indica Roger.
Código COBOL:
WORKING STORAGE.
01 Nombres Pic x(25).
01 Paterno Pic x(15).
01 Materno Pic x(15).
01 NOMBRE PIC X(60).
01 ipaterno pic 99.
01 imaterno pic 99.
01 inombres pic 99.
PROCEDURE DIVISION.
perform varying inombres from 1 by 1 until inombres = 25 or nombres(inombres:) = ' '
continue
end-perform
perform varying ipaterno from 1 by 1 until ipaterno = 15 or paterno(ipaterno:) = ' '
continue
end-perform
perform varying imaterno from 1 by 1 until imaterno = 15 or materno(imaterno:) = ' '
continue
end-perform
****** montar dependiendo del tamaño de cada uno.
****** pero tienes que ver si el campo esta en blanco o totalmente ocupado.
****** ¡¡ un lio ¡¡
Creo que lo mejor es ir montandolo sobre la marcha y evitar un monton de condiciones.
Quedaria asi:
Código COBOL:
WORKING STORAGE.
01 Nombres Pic x(25).
01 Paterno Pic x(15).
01 Materno Pic x(15).
01 NOMBRE PIC X(60).
01 indice pic 99.
01 indicex pic 99.
PROCEDURE DIVISION.
move 1 to indice
initialize nombre
perform varying indicex from 1 by 1 until indicex > 15 or paterno(indicex:) = ' '
move paterno(indicex:1) to nombre(indice:1)
add 1 to indice
end-perform
add 1 to indice
perform varying indicex from 1 by 1 until indicex > 15 or materno(indicex:) = ' '
move materno(indicex:1) to nombre(indice:1)
add 1 to indice
end-perform
add 1 to indice
perform varying indicex from 1 by 1 until indicex > 25 or nombres(indicex:) = ' '
move nombres(indicex:1) to nombre(indice:1)
add 1 to indice
end-perform.
***** en nombre lo tienes perfectamente montado.
---------- Post añadido : 19:31 ---------- Post anterior : 19:21 ----------
Si quieres dejarlo asi (con una coma antes del nombre): Meza Moya, Juan Martin
Código COBOL:
WORKING STORAGE.
01 Nombres Pic x(25).
01 Paterno Pic x(15).
01 Materno Pic x(15).
01 NOMBRE PIC X(60).
01 indice pic 99.
01 indicex pic 99.
PROCEDURE DIVISION.
move 1 to indice
initialize nombre
perform varying indicex from 1 by 1 until indicex > 15 or paterno(indicex:) = ' '
move paterno(indicex:1) to nombre(indice:1)
add 1 to indice
end-perform
add 1 to indice
perform varying indicex from 1 by 1 until indicex > 15 or materno(indicex:) = ' '
move materno(indicex:1) to nombre(indice:1)
add 1 to indice
end-perform
move ',' to nombre(indice:1)
add 2 to indice
perform varying indicex from 1 by 1 until indicex > 25 or nombres(indicex:) = ' '
move nombres(indicex:1) to nombre(indice:1)
add 1 to indice
end-perform.
***** en nombre lo tienes perfectamente montado.