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

Sum fields with sing


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


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

PostPosted: Tue Apr 10, 2007 6:01 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts Converting unpacked fields to pack us... SYNCSORT 4
No new posts Data for newly added fields not displ... IMS DB/DC 6
This topic is locked: you cannot edit posts or make replies. SUM FIELDS=NONE in reverse - Get dupl... DFSORT/ICETOOL 9
Search our Forums:

Back to Top