I need to combine multiple records into one single record. Each block of records to be merged (transposed) are marked by a numeric key. The delimiter can also be the record with the string CHG. I've tried resize but it mixes different 'blocks' of records. The number of 'tables' can be between 1 and 50. The LRECL of the input file is 60 So, if my input data looks like this:
1 CHG
1 DATA
1 MOTIVE
1 table1
1 table2
1 table3
2 CHG
2 DATA
2 MOTIVO
2 table1
3 CHG
3 DATA
3 MOTIVE
3 table1
3 table2
3 table3
3 table4
3 table5
The output should at least be:
1 CHG 1 DATA 1 MOTIVE 1 table1 1 table2 1 table3
2 CHG 2 DATA 2 MOTIVE 2 table1
3 CHG 3 DATA 3 MOTIVE 3 table1 3 table2 3 table3 3 table4 3 table5
The ideal output (I can remove the first byte of the records, if it helps)
1 CHG DATA MOTIVE table1
1 CHG DATA MOTIVE table2
1 CHG DATA MOTIVE table3
2 CHG DATA MOTIVE table1
3 CHG DATA MOTIVE table1
3 CHG DATA MOTIVE table2
3 CHG DATA MOTIVE table3
3 CHG DATA MOTIVE table4
3 CHG DATA MOTIVE table5
These were my last attempts and none worked correctly:
//TOOLIN DD *
RESIZE FROM(INDD) TO(OUTDD1) TOLEN(600) USING(CTL1)
//TOOLIN DD *
RESIZE FROM(INDD) TO(OUTDD1) TOLEN(600) USING(CTL1)
//CTL1CNTL DD *
INREC BUILD=(1,50)
OUTFIL FNAMES=OUTDD1,OVERLAY=(1:1,600)
/*