I have a file in which i have two record types viz 1 and 2. Record types 1 are the header records and record type 2 are the detail records. There can be n number of detail records for one header record. In the copybook for this file rec type 2 is a redefines of rec type 1. I have to convert all the fields into display format. However the layout of rec type 1 and rec type 2 is different. so actually i need to check if rec type =1 , then outrec fields in some format and if rec type =2 , outrec fields in the format specified for rec type 2.
Can i accomplish this using sort/ice tool? ( I can not split the files according to record types and download seperately . It does not serve the pupose as i have to merge them manually later which is quite tedious. ) To put it in a nutshell can i use outrec conditionally?
Joined: 25 Dec 2006 Posts: 63 Location: Perambalur
You can use make use of the IFTHEN clause of the OUTREC.
I assumed the first byte serves as a flag for finding out whether the record type is 1 or 2.
You can change it accordingly to your need.
Below is an example..,
Joined: 08 Jun 2006 Posts: 45 Location: Trumbull, CT
Hi,
In the above example, can we use the Conditon like
for record type 1
SORT FIELDS=(1,3,CH,A,5,9,CH,A) AND remove duplicates
for record type 2
SORT FIELDS=(1,3,CH,A,23,10,CH,A) AND remove duplicates
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You can only sort the records one way per pass. You would need two different passes over the input records to use those two different SORT statements. For example, you could use two DFSORT steps or a DFSORT/ICETOOL step with two SORT operators (or two SELECT operators).