I have the requirement to catchup the error in the following file. In the below file it has three transaction and each trasaction starts with 'P' record and ends with 'E' Record.
If there is a character '*' in any records then that is the error record and I have to write the
'P' Record and that particular error record to the output file.
In this first transaction the S record (highlighted) has error and I have to write both P and S record in the output
P,OAHKP01071118,20140728,20140701,60,MJCtest3,USD,2006709MO,,
S,*,2642097,500,10,1812~
In the second transaction the P record(Highlighte) has error and I have to write only the P record in the output
P,OAHKP01011119,20140821,20140622,60,MJCtest2,USD,171HK,,~
If you add RECORDS=2 after PUSH then you would create a blank line instead of another P record.
Code:
PUSH=(31:1,30),RECORDS=2)
That will be a little better, But I think, you may have to use ICETOOL to get the desired result i.e. to remove blank line and also remove duplicate for a P record having an * .
You would also be able to use RESIZE operator in ICETOOL instead of / in OUTFIL.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Have a SEQ also on the PUSH, large enough for the maximum records there can be in a group.
Make the BUILD conditional, when SEQ-field is one, output the P and the data. WHEN=NONE, only output the data.
The RECORDS=2 would also work, when you'd test for blank in the P-field, to only output data otherwise output both (that's what the / does, output two records).
No need for ICETOOL or multiple steps. Just IFTHEN=(WHEN=(logicicalexpression) and WHEN=NONE.
I imagine that you have an LRECL of 30 on your output dataset.
No, I don't. And I did check with a LRECL 80 output file and it gave the same result. But, I think, it's the absence of WHEN=NONE that makes us wonder how we are getting the 31=space record. Isn't it ?