Posted: Tue Dec 31, 2002 12:31 am Post subject: executing a condition while using sort
I have a scenario in which, one of the two values need to be moved to the output field after executing a condition on the two input fields, when using Syncsort.
The condition is between the two input fields(one for holding the cusip number and other for storing the description) which are of the same picture class x(9). Assume the two input fields are located at 35 and 120 respectively.
Condition:
If the two input fields are equal
a value of 9 spaces need to be moved.
else
one of the two input fields needs to be moved.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Dec 31, 2002 12:50 am Post subject:
Annamalai,
Let me know the Lrecl,RECFM and position to be updated in the output file. where should the 9 spaces be placed in the output file?? If the 2 fields are not equal, what is the value to be populated in the output file??
In the above code, we are writing into two NSRPLUG files (NSRPLUG1 and NSRPLUG2) and in the next step, we'll merge these two files into one.
The position of the output field is 401 and is highlighted in red.
If the two fields are not equal, the input field located at position 722 and of length 9 is to be moved to the output position 401.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Dec 31, 2002 6:55 am Post subject:
Annamalai,
I actually needed the INPUT file LRECL. As I see from your sysin cards , the input file length is different. Your sysin cards needs slight modification at these place.
Code:
248:731,6,F,
You don't need to code the format of the field in here , you can just code it as
Code:
248:731,6,
Since you are splitting the job into 2 files and mering , the following JCl will give you the desired results.A brief explanation of the job.We add a seqnum at the end of every record to retain the original order of the file.
The first copy operator splits the input file into 2 temp files.File T1 will have all the records where the field1 at position 35 is equal to field2 at position 120. For this file using outrec we add the 9 spaces
File T2 will have rest of the records where in the 2 fields are not equal.For this file using we outrec we move the orginal value.
The second SORT step takes in these 2 files and sorts on the seqnum and while writting the output we strip off the seqnum.
since I don't know the input LRECL. I just put it as N in the sysin statement. you need to change to your input file length on the INREC fields statement and on the OUTREC fields also.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum