I have a requierment where I have to insert a filler in cobol copybook using JCL. the filler should be inserted after each field with the same level number.
for example the input copybook is like this:
21 W541-DTRMNT-ALPH-VAL REDEFINES W541-DTRMNT-VAL
PIC X(20).
21 W541-DTRMNT-NUM-VAL REDEFINES W541-DTRMNT-VAL
PIC 9(10)V9(8).
21 W541-DTRMNT-DT-VAL REDEFINES W541-DTRMNT-VAL
PIC X(10).
21 W541-DTRMNT-TM-VAL REDEFINES W541-DTRMNT-VAL
PIC X(8).
12 W541-SLS-TAX-EXMPTN-NBR PIC X(10) .
12 W541-SLS-TAX-AMT PIC Z(8)V9(4).
12 W541-SLS-TAX-RBT-APPL PIC X .
PIC X(20).
21 W541-DTRMNT-NUM-VAL REDEFINES W541-DTRMNT-VAL
PIC 9(10)V9(8).
21 W541-DTRMNT-DT-VAL REDEFINES W541-DTRMNT-VAL
PIC X(10).
21 W541-DTRMNT-TM-VAL REDEFINES W541-DTRMNT-VAL
PIC X(8).
12 W541-SLS-TAX-EXMPTN-NBR PIC X(10) .
12 W541-SLS-TAX-AMT PIC Z(8)V9(4).
12 W541-SLS-TAX-RBT-APPL PIC X .
and after inserting the filler, the ouput should be:
21 W541-DTRMNT-ALPH-VAL REDEFINES W541-DTRMNT-VAL
PIC X(20).
21 W541-DTRMNT-NUM-VAL REDEFINES W541-DTRMNT-VAL
PIC 9(10)V9(8).
21 W541-DTRMNT-DT-VAL REDEFINES W541-DTRMNT-VAL
PIC X(10).
21 W541-DTRMNT-TM-VAL REDEFINES W541-DTRMNT-VAL
PIC X(8).
12 W541-SLS-TAX-EXMPTN-NBR PIC X(10) .
12 FILLER PIC Z(01).
12 W541-SLS-TAX-AMT PIC Z(8)V9(4).
12 FILLER PIC Z(01).
12 W541-SLS-TAX-RBT-APPL PIC X .
PIC X(20).
21 W541-DTRMNT-NUM-VAL REDEFINES W541-DTRMNT-VAL
PIC 9(10)V9(8).
21 W541-DTRMNT-DT-VAL REDEFINES W541-DTRMNT-VAL
PIC X(10).
21 W541-DTRMNT-TM-VAL REDEFINES W541-DTRMNT-VAL
PIC X(8).
12 W541-SLS-TAX-EXMPTN-NBR PIC X(10) .
12 FILLER PIC Z(01).
12 W541-SLS-TAX-AMT PIC Z(8)V9(4).
12 FILLER PIC Z(01).
12 W541-SLS-TAX-RBT-APPL PIC X .
but my problem is how i will identify the filed where i have to insert filler.. since i can identify the fileds with level number, pic clause and '.', however the incase of declearation like this:
21 W541-DTRMNT-ALPH-VAL REDEFINES W541-DTRMNT-VAL
PIC X(20).
PIC X(20).
Where PIC is coming in the second line, I am not able to aply the above logic
..identify the fileds with level number, pic clause and '.'
For this type of scenario i need to store the value read in first line to get the level number, then check the next line for PIC and '.', and then insert the filler with same level number.
In copybooks, all the fields will come either in single line or in double line with PIC and '.' in 2nd line.
For Single line, i don't have any issue, but for the double line I am facing the problem.
Can anyone please suggest me, if i can store the previous value in some temp veriable and then retain it.. or please suggest me some better idea..