View previous topic :: View next topic
|
Author |
Message |
Vigneshkumar D
New User
Joined: 04 Jul 2011 Posts: 2 Location: india
|
|
|
|
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? |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello,
Welcome to the forum. Search for IFTHEN=(WHEN=( on the forum for the requirement.
Hope it helps. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Something like,
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=(22,3,CH,EQ,C'NEW'),
OVERLAY=(22:C' 1')),
INREC IFTHEN=(WHEN=(22,3,CH,EQ,C'ADD'),
OVERLAY=(22:C' 2')),
.
.
. |
|
|
Back to top |
|
|
Vigneshkumar D
New User
Joined: 04 Jul 2011 Posts: 2 Location: india
|
|
|
|
Thank you Vasanth for your response.
Actually I need the numbering to be in number not character because I need to sort the file again based on that number.
So could you please help me to do that? |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello,
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. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
sorting on 1,2,3 as zoned numbers, will result in the same sequence as sorting on '1','2','3' as chars or 'bb1','bb2','bb3' as same
but if You had told the requirement from the beginning You might have got the whole tee shirt
and if You had searched the forum You would have found this
www.ibmmainframes.com/viewtopic.php?t=55069&highlight=
and it should not have been a big effort to modify it according to Your needs |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Vigneshkumar D wrote: |
[...]
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). |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Follow on:
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. |
|
Back to top |
|
|
|