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
 
Problem in Summing Fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Learncoholic

New User


Joined: 20 Sep 2007
Posts: 88
Location: India

PostPosted: Mon Feb 11, 2008 6:26 pm    Post subject: Problem in Summing Fields
Reply with quote

Hi,

I have an i/p field as :
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
123/2345 400.00        AAA2345                                         
123/4986 300.00        BBB4986                                         
123/4986 250.00        BBB1532                                         
123/4986-100.00        BBB8901                                         
999/000  800.00        OOO5532                                         
999/000 -100.00        OOO6981                                         
123/5960 200.00        XYZ5960                                         
123/5960 200.00        XYZ1135                                         


The 1st field is 8 bytes, 2nd field is 15 bytes and 3rd field is 20 bytes

I want the o/p as:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8-
123/2345 400.00       AAA                                                     
123/4986 450.00       BBB                                                     
123/5960 400.00       XYZ                                                     
999/000  800.00       OOO5532                                                 
999/000 -100.00       OOO6981                                                 


However when i use the JCL as:
Code:
//STEP1 EXEC PGM=SYNCTOOL                   
//TOOLMSG DD SYSOUT=*                       
//DFSMSG DD SYSOUT=*                       
//INDD DD *                                 
123/2345 400.00        AAA2345             
123/4986 300.00        BBB4986             
123/4986 250.00        BBB1532             
123/4986-100.00        BBB8901             
999/000  800.00        OOO5532             
999/000 -100.00        OOO6981             
123/5960 200.00        XYZ5960             
123/5960 200.00        XYZ1135             
/*                                         
//OUTDD DD SYSOUT=*                         
//TOOLIN DD *                               
  SORT FROM(INDD) TO(OUTDD) USING(CNT1)     
/*                                         
//CNT1CNTL DD *                             
  INREC IFTHEN=(WHEN=(1,8,CH,NE,C'999/000'),
  OVERLAY=(9:9,15,SFF,TO=ZD,LENGTH=15,27:17X,44:8C'0')),
  IFTHEN=(WHEN=(1,8,CH,EQ,C'999/000'),                 
  OVERLAY=(9:9,15,SFF,TO=ZD,LENGTH=15,44:SEQNUM,8,ZD)) 
  SORT FIELDS=(1,8,CH,A,44,8,ZD,A)                     
  SUM FIELDS=(9,15,ZD)                                 
  OUTREC IFTHEN=(WHEN=(1,8,CH,NE,C'999/000'),           
  OVERLAY=(9:9,15,ZD,TO=FS,LENGTH=15,44:37X)),         
  IFTHEN=(WHEN=(1,8,CH,EQ,C'999/000'),                 
  OVERLAY=(9:9,15,ZD,TO=FS,LENGTH=15,44:37X))           
/*


The o/p comes as:
Code:
123/2345         +40000AAA   
123/4986         +45000BBB   
123/5960         +40000XYZ   
999/000          +80000OOO5532
999/000          -10000OOO6981
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Feb 11, 2008 8:33 pm    Post subject:
Reply with quote

Are you guaranteeing that the sum will always be less than six digits?
Is your problem that the summed values are not left justified and the positive sign is included?
Back to top
View user's profile Send private message
Learncoholic

New User


Joined: 20 Sep 2007
Posts: 88
Location: India

PostPosted: Tue Feb 12, 2008 10:17 am    Post subject:
Reply with quote

Hi CICS Guy

The SUM as well as the value might be of 15 digits as I mentioned that the 2nd field having length of 15 bytes. The o/p should be left justified without the positive sign but a -ve sign should be present if the result is -ve. Moreover the decimal point should also be included.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Having a problem FTP'ng to the MF pahiker All Other Mainframe Topics 2 Fri Nov 10, 2017 8:20 pm
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm

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