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

 

Sum fields with sing

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

New User


Joined: 02 Jun 2006
Posts: 6

PostPosted: Tue Apr 10, 2007 4:28 am    Post subject: Sum fields with sing
Reply with quote

The following Jcl is working when not count sing, what should I do to get output below
Code:
//S1    EXEC  PGM=SORT                                           
//SYSOUT   DD SYSOUT=A                                           
//SORTIN   DD DSN=Input file FB-1000,                     
//            DISP=SHR                                           
//SORTOUT  DD SYSOUT=A                                           
//SYSIN    DD *                                                   
  SORT FIELDS=COPY
  OMIT COND=(1,4,CH,EQ,C'HEAD')                                   
  OUTFIL FNAMES=SORTOUT,                                         
         OUTREC=(3:160,14,                                       
                19:174,9,                                         
                 35:349,19,                                       
                 55:368,19,                                       
                 133:X),                                         
  TRAILER1=(2:'TOTAL AMOUNT :                   ',               
              TOTAL=(350,18,ZD,EDIT=(IIIIIIIIIT),SIGNS=(+,-)),
              TOTAL=(369,18,ZD,EDIT=(IIIIIIIIIT),SIGNS=(+,-)),
             3/,2:'TOTAL RECORDS: ',COUNT)                       
/*                                                   

Input

pos 349                368
-5----+----6----+----7----+----8----+----9
+000000000000000000+000000000000053860
+000000000000053860+000000000000000000
+000000000000000000-000000000000000020
-000000000000000020+000000000000000000 

expected output :

---+----1----+----2----+----3----+----4----+----5----+----6----+----7----
  YYY YYYYYYYYYY   AAAAAA         +000000000000000000 +000000000000053860
  YYY YYYYYYYYYY   AAAAAA         +000000000000053860 +000000000000000000
  YYY YYYYYYYYYY   AAAAAA         +000000000000000000 -000000000000000020
  YYY YYYYYYYYYY   AAAAAA         -000000000000000020 +000000000000000000
-------------------------------------------------------------------------
 TOTAL AMOUNT :                   DEBIT :      53840  CREDIT :      53840
 TOTAL RECORDS:        4                                                 

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 Apr 10, 2007 6:01 am    Post subject:
Reply with quote

adushkin,

These DFSORT control statements will give you what you asked for. Note the use of FS, and S in EDIT, to handle the signs.

Code:

  SORT FIELDS=COPY
  OMIT COND=(1,4,CH,EQ,C'HEAD')
  OUTFIL FNAMES=SORTOUT,
         OUTREC=(3:160,14,
                19:174,9,
                 35:349,19,
                 55:368,19,
                 133:X),
  TRAILER1=(2:'TOTAL AMOUNT :                   ',
            35:'DEBIT:',
              TOTAL=(349,19,FS,EDIT=(SIIIIIIIIIT),SIGNS=(,-)),
            55:'DEBIT:',
              TOTAL=(368,19,FS,EDIT=(SIIIIIIIIIT),SIGNS=(,-)),
             3/,2:'TOTAL RECORDS: ',COUNT)
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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am


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