I have a RECFM=FA,LRECL=133 input file that I need to perform two operations on.
1. If position 1 is a hyphen and position 1 in the preceding record was a 1, then position 1 in the current record should be overlaid with 0 (zero).
2. Data beginning at position 30 to the end of record is shifted to position 2.
Achieving point 2 is straightforward enough, but I can't get my head around how to deal with point 1.
Grateful for help to solve.
regards, Kevin
Thought I was on the right lines with the following, but this is only fine when position 1=1 occurs on an odd number line with hyphen in position 1 on the next line. When the sequence is the other way round it does not work.
//DFS1CNTL DD *
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,
PUSH=(134:ID=3,138:SEQ=1,140:1,1)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'-',
AND,140,1,CH,EQ,C'1'),
OVERLAY=(140,1,2,139))
//DFS1CNTL DD *
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,
PUSH=(134:ID=3,138:SEQ=1,140:1,1)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'-',
AND,140,1,CH,EQ,C'1'),
OVERLAY=(140,1,2,139))
Example of Input ...
1 AAA
- BBB
0 CCC
0 DDD
- EEE
0 FFF
0 GGG
1 HHH
- III
0 JJJ
KKK
4 LLL
0 MMM
Example of output (record length will be 80) ...
1 AAA
0 BBB position 1 overlaid
0 CCC
0 DDD
- EEE
0 FFF
0 GGG
1 HHH
0 III position 1 overlaid
0 JJJ
KKK
4 LLL
0 MMM
1 AAA
- BBB
0 CCC
0 DDD
- EEE
0 FFF
0 GGG
1 HHH
- III
0 JJJ
KKK
4 LLL
0 MMM
Example of output (record length will be 80) ...
1 AAA
0 BBB position 1 overlaid
0 CCC
0 DDD
- EEE
0 FFF
0 GGG
1 HHH
0 III position 1 overlaid
0 JJJ
KKK
4 LLL
0 MMM