I have a requirement to reformat the input file record and write to output file if at least one condition given in IFTHEN statements is satisfied, else I can ignore the record for output file. I would like to know if it is possible to handle using IFTHEN statement so that I may not need two steps to handle this scenario.
INCLUDE COND=(1,3,CH,EQ,C'ABC',
OR,
1,3,CH,EQ,C'PQR')
or
Code:
INCLUDE COND=(1,3,SS,EQ,C'ABC.PQR')
The "." in the literal can be any character which does not appear in the data.
On large datasets, prefer the first version anyway.
Thanks, Bill.
I did a mistake when I chose the sample data. Here, the reformatting would not be same for each condition e.g. reformatting for ABC will not be same as PQR.
If I go with INCLUDE COND for different format, I think we need to copy the output to separate files (say OUTFIL01, OUTFIL02) for each condition. However, I would like to copy both the reformatted record into same output file.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
The INCLUDE COND=/OMIT COND= are just a filter on the input file. You do whatever you want in the rest of the code. There is no connection between the two things.
Don't confuse these with INCLUDE=/OMIT= on OUTFIL. Those would filter that OUTFIL data only.
The INCLUDE COND=/OMIT COND= are just a filter on the input file. You do whatever you want in the rest of the code. There is no connection between the two things.
Don't confuse these with INCLUDE=/OMIT= on OUTFIL. Those would filter that OUTFIL data only.
Thanks, Bill.
Please help me to handle the below scenario using INCLUDE COND.
Input
Code:
123455
ABC123
ABC789
PQR456
PQR012
When the 1st three bytes is ABC, I would like to reformat the input rec to output file as below.
Code:
TEST1123BBB
TEST1789BBB
When the 1st three bytes is PQR, I would like to reformat the input rec to output file as below.
Code:
TEST2BBB456
TEST2BBB012
In above output, B represents Blank Space. I would like to reformat and copy the matched recs to one output file and ignore unmatched rec (in my sample - 1st record).