SOURCE File Length = 80 bytes.
Generate a report by Copying all the records that have the following strings at the position 28.
Note 1: String length is always fixed - 6 bytes
Note 2: Strings and/or String count may vary every fort-night.
Following SORT card achieves this.
Now, I would like to automate the process of generating the report as follows
1. To accept the strings in a flat file called INFILE from SOURCE file.
INFILE will have the strings like this
2. Write a SORT card that inputs the strings from INFILE
My question is, how to read the strings from INFILE and then copy the records from source file that matches the strings at position 28 ?
If there will always be four pieces of data, you won't have a problem identifying the last one...
The number of strings will always change. So till now, I build an ADHOC job and ran it manually. Now, We would like to automate the process by keeping all the strings in a flat-file and to run every fort-night.
@rinsio, @ Bill Wooder,
Thanks for the sample code.
JOINKEYS F1=IN1,FIELDS=(28,6,A) <== the input file
JOINKEYS F2=IN2,FIELDS=(1,6,A) <== the strings file
REFORMAT FIELDS=(F1:1,80) <== is an example
The above code worked for the criterion mentioned above. But found one exception now. I see few records from the SOURCE file contains the search strings in different position other than 28 as mentioned earlier. I'm trying to modify the SORT control card to cover the exception with search string (SS), but of no luck yet on it.