Using IFTHEN statements will do what you want:
INREC IFTHEN(WHEN=INIT,
PARSE=(%00=(STARTAFT=C'F00:',
ENDBEFR=C'*',
FIXLEN=15))),
IFTHEN(WHEN=INIT,
PARSE=(%01=(STARTAFT=C'F01:',
ENDBEFR=C'*',
FIXLEN=15))),
IFTHEN(WHEN=INIT,
PARSE=(%02=(STARTAFT=C'F02:',
ENDBEFR=C'*',
FIXLEN=15)),
BUILD=(C'F00=',%00,C'-F01=',%01,C'-F02=',%02,C'-'))
SORT FIELDS=COPY
Result:
F00=FIELD00 -F01=FIELD01 -F02=FIELD02 -
F00=FIELD00 -F01=FIELD01 -F02=FIELD02 -
F00=FIELD00 -F01=FIELD01 -F02=FIELD02 -
F00=FIELD00 -F01= -F02=FIELD02 -
F00=FIELD00 -F01=FIELD01 -F02=FIELD02 -
F00= -F01=FIELD01 -F02=FIELD02 -
As you surmise, the difficulty is with the effect when a STARTAFT string
is not found: "If string is not found, the current parsed
field and any subsequent parsed fields contain all blanks.", which
overrides the ABSPOS option because "If the Start Pointer advances past
the end of the record, PARSE processing
stops." This is documented in the OUTFIL statement specification. The
IFTHEN statements enable three separate PARSEs of the record.
--
Peter Hannigan
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN