The query is, whether is there any way of writting the unmatched records of any include statement into another temporary file, without adding any OMIT condition and pointing to the output DSN?
I don't understand what you mean by this. How can you write into a temporary file without pointing to the temporary file - how would you know where to write to? And I have no idea what you mean by "without any OMIT condition".
Perhaps if you showed an example of your input records and what you want for output, it would help clarify what you're trying to do.
In unmatched records in the above condition with 3,1 = B
In unmatched records in the above two conditions with 6,1 = 9
In unmatched records in all the above conditions with 15,3 = TCS
In unmatched records in all the above conditions with 9,6 = TANDEN
Due to some reasons I cant able to give the exact details of my DSN. Sorry for that. But in my scenario there are 20 such conditions and hence I need to write 20 output files. I tried in the following way:
Then I tried using the OUT2 as the input for the next sort.
So my query is, is there anyway that we could move the unmatched records into another temporaty file, upon which I can do further manipulation.
If you are still not clear, please make a note to me, So that I could try to explain more on my requirement.
I believe a DFSORT job like the following will do what you want. I assumed that your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. Each IFTHEN clause sets a file number in position 81 if its condition is met. Once an IFTHEN clause is met for a record, IFTHEN processing stops for that record, so this has the effect of checking "unmatched" records for the conditions. The OUTFIL statements then use the file number in 81 to write the selected records to each file.
I have multiple records in a file which has got different dates starting from tomorrow to the next 21 days. I need to separate the records in such a way that each day?s records are stored in different files. I mean 21 different output files.
The date format is YYYYWWD(Year, week, day) and it is CHAR(7). The LRECL of the file is 80, and the starting position of the date field is 66.
Can you please advice me how can I acheive this in SORT?
If you need the date constants generated dynamically, DFSORT does not have any built-in functions to do that for a yyyywwd date. It can do it for yyyymmdd (DATE1+1,..., DATE1+21) dates and for yyyyddd (DATE3+1, DATE3+21) dates, but not for yyyywwd dates.