I’m looking for a SORT Joinkey Jcl or ICETool JCL solution for the following scenario. Can anyone please help me.
I have 4 VB flat files:
File1 – RCfile – Parent File to FILE2,FILE3,FILE4
Key (7,5,CH,A,12,4,CH,A)
File2 – RDfile – Child of File1
Key (7,5,CH,A,32,4,CH,A)
File3 – RGfile – Child of File1
Key (7,5,CH,A,16,4,CH,A)
File4 – VRfile – Child of File1
Key (7,5,CH,A,12,4,CH,A)
I want to extract into separate out files on records from File2,File3 and File4 only if they have a matching Parent record on File1. I want to leave have all the files in the same format in/out. And I want to sort the new output files as follows:
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
a,
You need to do a better job of explaining what it is you want to do. Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If any file (e.g. file1) can have duplicates within it, show that in your example.
I have looked at the examples and can't quite locate on that does what I need with multiple files in one step. I'm experimenting with some of the samples. If I get it, I'll be sure to post the sample for everyone to enjoy. Thanks..
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
a210955,
The following DFSORT JCL will give you the desired results. It does the match and also sorts on the file 2, 3, 4 also.
Step0100 : Creates a VB delimiter file with delimiter $$$ in pos 5 (first 4 bytes of rdw).
Step0200 : We now use above created file and concatenate files 2,3,4 to perform the match. The $$$ ind will be used to distinguish file2, 3, 4. Using the WHEN=GROUP function, we pad an indicator at pos 5 and use that indicator to populate the key values from different places from the respective files. Since all the files are VB we manipulate the key right after RDW. Once we get the Matching records we then overlay the fields from different files to the sort main task based on the same ind.
Using OUTFIL we remove the indicator and temp fields and write out the actual file data from the respective files.