# Sum fields by using sortcard

Author Message
Asha chowdary

New User

Joined: 20 Mar 2015
Posts: 5
Location: Bangalore

 Posted: Mon Mar 23, 2015 11:11 am Hi, I want to learn sort card for sum the different fields. I have two different types of amounts in my input file. Amount field format is WS-RPT-ACCUM-AMT PIC -ZZZ,ZZZ,ZZZ,ZZ9.99. Ex: Type of amount total amount A 100 B 50 A 200 B 70 I want to add 'A' type of amount and 'B' type of amount.and in output file i need to get A 300 B 120. Can any body guide me how to code for this?
Bill Woodger

Moderator Emeritus

Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

 Posted: Mon Mar 23, 2015 1:49 pm You'll need to define your source field as SFF and convert it. Assuming you are going for odd/even record numbers, you can use a sequence number and various means to find that out, and put zero in one place value in another when "even", and value in one place zero in another when "odd" then SUM on the two fields.
Asha chowdary

New User

Joined: 20 Mar 2015
Posts: 5
Location: Bangalore

 Posted: Mon Mar 23, 2015 3:58 pm Hi, I have developed the sort card like below SORT FIELDS=(23,9,CH,D,33,2,CH,D,108,3,CH,D) OUTFIL REMOVECC,NODETAIL, SECTIONS=(23,9,33,2, TRAILER3=(1,117, 118:TOT=(118,17,SFF,EDIT=(STTTTTT.TT),SIGNS=(,-)), TOTAL/CONVERT 135:34X)) TRAILER1=('TOTAL AMOUNT: ', 118:TOT=(118,17,SFF,EDIT=(STTTTTT.TT),SIGNS=(,-)), TOTAL/CONVERT 135:34X)), OUTREC=(1:2,170,171:9X) While adding total amount to trailer after every record, I am unable to code exactly.Can anyone suggest me how can i add total amount to trailer? [/img][/code]
Asha chowdary

New User

Joined: 20 Mar 2015
Posts: 5
Location: Bangalore

Posted: Mon Mar 23, 2015 5:50 pm

Hi,

I am getting User abend 0016.Can anybody help me to out?

 Code: CTL1CNTL :                                                              SORT FIELDS=(23,9,CH,D,33,2,CH,D,108,3,CH,D)                          OUTFIL REMOVECC,NODETAIL,                                              HEADER1=(1:C'RUN DATE : ',DATE,                                                 55:C'ANTHEM BLUE CROSS AND BLUE SHIELD',88:C' ',                       160:C'PAGE:',&PAGE,/,                                                 1:C'RUN TIME : ',TIME,                                                 51:C'HIX SATURDAY RUN IMPACT AT MEMBER LEVEL ',/,                     1:179C'-',/,                                                           1:C'HCID',22:C'CONTRACT',32:C'DEPEND',39:C'MEMBER',                   55:C'CLAIM ',80:C'GENDER',87:C'NTWRK',93:'PRODUCT',                   101:C'ROUTE',107:C'ACCUMS',123:C'ACCUMS',134:C'REMARKS',/,            1:C'NUMBER',22:C'ID',32:C'NUMBER',39:C'F-NAME',                       55:C'NUMBER',87:C'TYPE',93:'TYPE',                                     101:C'CODE',107:C'TYPE',117:C'TOTAL AMOUNT',/,                         1:179C'-'),                                                  SECTIONS=(23,9,33,2,108,3,                                            TRAILER3=(1,117,                                                        118:TOT=(118,17,SFF,EDIT=(STTTTTT.TT),SIGNS=(,-)), TOTAL/CONVERT      135:34X))                                                           TRAILER1=('TOTAL NUMBER OF UPDATED RECORDS: ',                        *                                                                                    COUNT=(M10,LENGTH=10),                                                *                                                                   55:C'TOTAL ACCUMS AMOUNT: ',                                           *                                                                     118:TOT=(118,17,SFF,EDIT=(STTTTTT.TT))),                               *                                                          OUTREC=(1:2,170,171:9X)                                                      *

 Code: WER428I  CALLER-PROVIDED IDENTIFIER IS "0001"                          WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                        WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                        WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                        WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                        WER268A  OUTREC STATEMENT  : SYNTAX ERROR                              WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                          WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

Facing issue at trailer only.

Code'd
Bill Woodger

Moderator Emeritus

Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

 Posted: Mon Mar 23, 2015 6:54 pm Please use the Code tags to preserve spacing. You have a comma missing at the end of your TRAILER3.
Asha chowdary

New User

Joined: 20 Mar 2015
Posts: 5
Location: Bangalore

Posted: Tue Mar 24, 2015 11:22 am

Thanks Bill Woodger..

I have corrected my code.but still i am getting OUT1 has incompatible LRECL.
I have given same LRECL for input file and output file.

 Code: //IN1      DD DSN=CHIPST.DVC1094.ACCUMS.RPT.COMBINED.SRT.INPUT,DISP=SHR //*        DD DSN=CHIPST.DVC1094.ACCUMS.RPT.SAT#1.SRT.D0318,DISP=SHR    //*                                                                    //OUT1     DD DSN=CHIPST.DVC1094.ACCUMS.RPT.SRT.OUTPUT,                //            DISP=(NEW,CATLG,CATLG),                                  //            UNIT=(DISK,10),SPACE=(CYL,(150,50),RLSE),                //            DCB=(RECFM=FBA,LRECL=180,BLKSIZE=0)                      //*                                                                    //TOOLIN   DD DSN=CHIPST.PKOG.UTILDATA.SRT(SORT1),DISP=SHR              //CTL1CNTL DD *                                                          SORT FIELDS=(23,9,CH,D,33,2,CH,D,108,3,CH,D)                            OUTFIL REMOVECC,NODETAIL,                                              HEADER1=(1:C'RUN DATE : ',DATE,                                                 55:C'ANTHEM BLUE CROSS AND BLUE SHIELD',88:C' ',                       160:C'PAGE:',&PAGE,/,                                                   1:C'RUN TIME : ',TIME,                                                 51:C'HIX SATURDAY RUN IMPACT AT MEMBER LEVEL ',/,                       1:179C'-',/,                                                           1:C'HCID',22:C'CONTRACT',32:C'DEPEND',39:C'MEMBER',                     55:C'CLAIM ',80:C'GENDER',87:C'NTWRK',93:'PRODUCT',                     101:C'ROUTE',107:C'ACCUMS',123:C'ACCUMS',134:C'REMARKS',/,             1:C'NUMBER',22:C'ID',32:C'NUMBER',39:C'F-NAME',                         55:C'NUMBER',87:C'TYPE',93:'TYPE',                                     101:C'CODE',107:C'TYPE',117:C'TOTAL AMOUNT',/,                         1:179C'-'),                                                    SECTIONS=(23,9,33,2,108,3,                                              TRAILER3=(1,117,                                                          118:TOT=(118,17,SFF,EDIT=(STTTTTT.TT),SIGNS=(,-)), TOTAL/CONVERT        135:34X)),                                                            TRAILER1=('TOTAL NUMBER OF UPDATED RECORDS: ',COUNT=(M10,LENGTH=10),              55:C'TOTAL ACCUMS AMOUNT: ',                                           118:TOT=(118,17,SFF,EDIT=(STTTTTT.TT))),                    OUTREC=(1:2,170,171:9X)                                              /*

Input file Properties:
 Code: Data Set Name . . . . : CHIPST.                                 General Data                     Management class . . : MCTEST  Storage class  . . . : SCTEST   Volume serial . . . : SM2019   Device type . . . . : 3390     Data class . . . . . : DCPS      Organization  . . . : PS        Record format . . . : FBA      Record length . . . : 180      Block size  . . . . : 27900    1st extent cylinders: 10        Secondary cylinders : 50        Data set name type  :          SMS Compressible. . : NO

Am getting U0016 abend:

 Code: 118:TOT=(118,17,SFF,EDIT=(STTTTTT.TT))),                             OUTREC=(1:2,170,171:9X)                                                       PARMLIST :                                                                       OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=IN1,SORTOUT=OUT1,SORTDD=CTL1,DYN  LLOC                                                                             WER428I  CALLER-PROVIDED IDENTIFIER IS "0001"                                   WER276B  SYSDIAG= 2750792, 3625838, 3625838, 2468025                             WER164B  16,964K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,             WER164B     0 BYTES RESERVE REQUESTED, 2,016K BYTES USED                         WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED                                 WER108I  IN1      : RECFM=FBA  ; LRECL=   180; BLKSIZE= 27900                   WER073I  IN1      : DSNAME=CHIPST.DVC1094.ACCUMS.RPT.COMBINED.SRT.INPUT         WER110I  OUT1     : RECFM=FBA  ; LRECL=   180; BLKSIZE= 27900                   WER074I  OUT1     : DSNAME=CHIPST.DVC1094.ACCUMS.RPT.SRT.OUTPUT                 WER247A  OUT1     HAS INCOMPATIBLE LRECL                                         WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                   WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                  ******************************** BOTTOM OF DATA ********************************
Bill Woodger

Moderator Emeritus

Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

 Posted: Tue Mar 24, 2015 1:51 pm That A at the end of your RECFM indicates that the first byte of a record is an ANSI printer carriage-control byte. Your LRECL says 180, but you can only have 179 bytes of data. You use 180 bytes of data in OUTFIL OUTREC (which you should change to BUILD anyway, see here)
Asha chowdary

New User

Joined: 20 Mar 2015
Posts: 5
Location: Bangalore

 Posted: Tue Mar 24, 2015 3:26 pm Thanks much Bill Woodger.
 View Bookmarks All times are GMT + 6 Hours

 Topic Forum Replies Similar Topics JCL sortcard to print only the records DFSORT/ICETOOL 11 Concatenate 2 fields (usage national)... COBOL Programming 2 Cobol COMP-2 fields getting scrambled... Java & MQSeries 6 Converting unpacked fields to pack us... SYNCSORT 4 Data for newly added fields not displ... IMS DB/DC 6
Search our Forums:

 IBMMainframes.com is not an official and/or affiliated with IBM® in anyway Board Rules | FAQ | Downloads | Wiki | SiteMap | Contact Us