Hi need a sort card to perform the below function.
I am reading records from a input file and checking for a field.
If the field has value as 'NEW' then I have to give number 1 for that record.
Similarly if the filed has value as 'ADD' then I have to give number 2 for that record.
Similarly if the value is 'UPD' then the numbering will be 3.
I will use a filler for this numbering.
I just need a sort card to perform this function.
Can someone help me to do this?
You could meddle with the above sample code and change it according to your requirement by changing things like C' 1' TO C'001' etc... A SORT FIELDS statement below would sort the fields that are numeric or characters.
Actually I need the numbering to be in number not character because I need to sort the file again based on that number.
The hexadecimal values for "character" 1, 2, 3 are x'F1', x'F2', x'F3'.
The hexadecimal values for "zoned decimal" 1, 2, 3 are x'F1', x'F2', x'F3'.
Identical. Even if they were not identical, they would appear in the same sequence in the sort, as 1 is always before 2 is always before 3 no matter how the field is defined (since you are generating them, we know they are all "positive" numbers - you could generate negative numbers and see the difference it makes to a sort).
If you want a specific type of field for documentary purposes (you mention FILLER, so I'll assume it is going into a Cobol program) you can always change the sort cards yourself. If you don't know what to change them two, there are lots of links to the sort manuals including at the top of this page, plus the "stickies", the postings at the top of this list.
Unless you want to do calculation with them, though, why do you insist that they should be numeric? PIC X is a fine definition for them, saves the compiler generating little bits a code you don't know about (generate the pseudo-assembler listing with PIC 9, and you will know) but won't need.