Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
Asha chowdary

New User

Joined: 20 Mar 2015
Posts: 5
Location: Bangalore

 Posted: Mon Mar 23, 2015 11:11 am    Post subject: Sum fields by using sortcard 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

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Mon Mar 23, 2015 1:49 pm    Post subject: Reply to: Sum fields by using sortcard 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    Post subject: Reply to: Sum fields by using sortcard 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    Post subject: Reply to: Sum fields by using sortcard

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

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Mon Mar 23, 2015 6:54 pm    Post subject: Reply to: Sum fields by using sortcard 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    Post subject:

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

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Tue Mar 24, 2015 1:51 pm    Post subject: Reply to: Sum fields by using sortcard 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    Post subject: Thanks much Bill Woodger.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Compare fields with decimal chandan.inst SYNCSORT 6 Thu Apr 04, 2019 5:29 pm Query on summing up the fields abdulrafi DFSORT/ICETOOL 10 Mon Jan 21, 2019 7:18 pm remove the gap b/w 2 fields shymala COBOL Programming 5 Thu Aug 02, 2018 12:05 pm Comparing Comp-3 fields with greater ... Prateeksichem1 DFSORT/ICETOOL 11 Fri Jul 13, 2018 8:45 am KSDS file fields update by passing va... Anil Kumar Prajapati TSO/ISPF 5 Wed Jul 11, 2018 5:59 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us