I have a RECFM VBfile that consists of variable length records, with an LRECL of 28006. Each record is made up of a length indicator (nn), followed by a string of individual sub-records, each starts with a certain 8 character identifier that have the first four characters in common e.g.
nnCOPY0001XXXXXXXXXXXXXXXXXXXXCOPY0002XXXXXXXXXXXXXCOPY0003XXXXXXXXXXXXXXXXXXCOPY0005XXXXX
Each record will be guaranteed to have COPY0001 and COPY0002, but may contain any amount of other COPYxxxx records, up to 300 records total, but each is variable and will have between 20 and 700 characters. The process creating this file guarantees either of these conditions aren't exceeded, as obviously 300 x 700 would result in almost ten times the LRECL, so that's not an issue.
What I was hoping I might be able to do is do a FINDREP, but use the / to break the records apart - even if it meant losing the first four bytes that identify a new sub-record.
My aim is to end up with a VB file of LRECL 719, to include the RDW, and a 10 digit key from the COPY001 record - it's in a guaranteed fixed position.
kkkkkkkkkkCOPY0001XXXXXXXXXXXXXXXXXXXX
kkkkkkkkkkCOPY0002XXXXXXXXXXXXX
kkkkkkkkkkCOPY0003XXXXXXXXXXXXXXXXXX
kkkkkkkkkkCOPY0005XXXXX
kkkkkkkkkkCOPY0002XXXXXXXXXXXXX
kkkkkkkkkkCOPY0003XXXXXXXXXXXXXXXXXX
kkkkkkkkkkCOPY0005XXXXX
Though thanks to the great documentation, I'm comfortable with doing everything, and it's only the splitting that's still stumping me.
I tried this:
SORT FIELDS=COPY
OUTREC FINDREP=(IN=C'COPY',OUT=\)
OUTREC FINDREP=(IN=C'COPY',OUT=\)
but it didn't work, as I was kind of expecting anyway. Am I barking up the wrong tree here, and should be trying something else maybe?