IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Comp-3 field Sum in SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Tue Mar 28, 2006 8:44 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top