Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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
JAYANT KUMAR SAHOO

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

Code:

----+----1----+----2----+----3----+----4----+----5--   
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
TRAILER1=(1:TOT=(29,16,ZD,M11,LENGTH=16))
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:

TRAILER1=(1:TOT=(29,8,PD,M26,LENGTH=16))
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 length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us