My output from File3 shows records omitted correctly from the OMIT statement but the below SORT statement doesn't seem to get a hit.
SORT FIELDS=(168,2,PD,A,42,2,PD,A,15,9,PD,A)
Is it because the file has already been sorted for File1 & the OUTFIL for File3 is taking that as input? Can we use multiple SORTs while involving OUTFIL control statement?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Arunav,
You can only have one SORT statement per DFSORT run. Your first SORT statement is used and your second SORT statement is ignored.
SORT is processed before OUTFIL, so your records are sorted by 11,2,PD0,A and then those sorted records are processed by your three OUTFIL statements.
Quote:
It's required that this file gives me the o/p after omitting records from & then sorting the i/p file.
If you want to omit records before sorting, then you have to use an OMIT statement, not an OMIT operand on OUTFIL. The OMIT statement is processed before the SORT statement. OUTFIL (and OUTFIL OMIT) is processed after the SORT statement. Note that an OMIT statement would affect all of the OUTFIL output files.
See this Figure which shows the order of processing of the DFSORT control statements and options:
If you explain more clearly exactly what you're trying to do, I can show you how to do it. Showing examples of your input records and expected output records for the three files would help.
Since I need the same i/p file to be sorted in two different ways, I guess going for two different steps is my only option.
Actually I initially had two separate steps but since my input file has got huge data, it was throwing up performance issues. That's why I wanted to work around it using an existing sort step which has the same file as input.
Anyway I'll get back in case I have any further queries. Thank you!!