Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in


Comp-3 field Sum in SORT

Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message

New User

Joined: 15 Mar 2006
Posts: 14

PostPosted: Tue Mar 28, 2006 11:52 am    Post subject: Comp-3 field Sum in SORT
Reply with quote

Hi All,
I have a file like


123   5000004001 C               ?      1011621000       
123   5155005001 D               ?      1011621000       
123   5000004001 C                  k? 1011621000       

basically i want the sum of the comp-3 field from pos 29-36.
How can I get the sum using sort assuming that I have both +ve and -ve value in the comp-3 field.The output suppose comes as a -ve value 1234 ,the sort should display me as -1234.

To achieve this I follow a second method.I format the input file using fileaid option so that the output file will come as a displayable numeric field and after that I can use this formatted file in the sort jcl to get the sum.The original field is
PIC S9(13)V99 COMP-3 and i am formatting it as
PIC S9(13)V99.

But in this way the last sign bit and its immediate previous bit combine together to give me a charcter bit like A,B,} etc.
I can use this in my sort jcl but the jcl output even though it shows the correct sum ,but it doesnot correctly display the sign bit.Always it is giving as +ve value.
The jcl I use is
If I am trying to use rexx to get the sum same problem happens as rexx does not identify the whole field as a numeric field if it contains a character like A,B,{ etc in the last bit.So I can not use rexx also with this formatted file to get a proper sum output with a -ve sign if the sum is actually -ve .

Please provide me the solutions to these problems.
Thanking u all in advance.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator

Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Mar 28, 2006 8:44 pm    Post subject:
Reply with quote

You're making this more complicated than it really is.

You can use PD in TOT for a COMP-3 value. You don't have to convert PD to ZD in order to use it. And the reason you're not getting a - sign is because you're using the M11 mask which produces digits without a sign. If you use M26 instead, you'll get a - sign. So your DFSORT TRAILER1 operand would be:

Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1


Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts Amount field is getting corrupted whe... thesumitk SYNCSORT 5 Tue Oct 18, 2016 8:20 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm

Back to Top
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us