I want to capture records which are starting with RECDA and RECDD.
For RECDA I want to capture from BYTE 20 for 10 chars
For RECDB I want to capture from BYTE 30 for 10 chars
In final File I want both RECDA and RECDB on single line
Quick question, will the records always occur in the order of '4', by that I mean, start with RECDA, then immediate next record RECDB, followed by RECDC and ending with RECDD; if the answer to this is yes, then a quick dirty solution would be:
a. Use RESIZE operator of DFSORT to bring RECDA - RECDD records in one single line; you would want to keep the RESIZE length as the maximum length of a given record (with padded spaces; but then I'd already said, this is a dirty solution ).
b. Once you have these four records grouped as one single record, PARSE the data to re-arrange it in your requisite format.
This should give you the desired output.
<EDIT: Whups kranthikumarb and I posted almost at same time, my bad>
Joined: 09 Mar 2011 Posts: 7311 Location: Inside the Matrix
I think kranthikumarb has misread the question.
Abid Hasan's is more reasonable, except the records are variable-length and they need to be fixed-length for RESIZE. Should also incorporate part of this:
Use INCLUDE/OMIT COND= to get the records you want.
Use IFTHEN=(WHEN=GROUP for your first record of a pair, and PUSH the data that you want onto the second record along with a SEQ=1, with RECORDS=2. Since you have a large amount of data on a record that you do not need on your output, there should be plenty of opportunity to PUSH without needing to actually extend the records.
On OUTFIL, using INCLUDE/OMIT= to just pick up the SEQ equal to "2"s. Use BUILD to create your final output.
Note, if you needed to SORT the records (for some other reason) you'd drop off the unwanted data per record using BUILD in INREC, to save data poked into the SORT.