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 by using sortcard

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests
View previous topic :: :: View next topic  
Author Message
Asha chowdary

New User


Joined: 20 Mar 2015
Posts: 5
Location: Bangalore

PostPosted: Mon Mar 23, 2015 11:11 am    Post subject: Sum fields by using sortcard
Reply with quote

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?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Mar 23, 2015 1:49 pm    Post subject: Reply to: Sum fields by using sortcard
Reply with quote

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.
Back to top
View user's profile Send private message
Asha chowdary

New User


Joined: 20 Mar 2015
Posts: 5
Location: Bangalore

PostPosted: Mon Mar 23, 2015 3:58 pm    Post subject: Reply to: Sum fields by using sortcard
Reply with quote

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]
Back to top
View user's profile Send private message
Asha chowdary

New User


Joined: 20 Mar 2015
Posts: 5
Location: Bangalore

PostPosted: Mon Mar 23, 2015 5:50 pm    Post subject: Reply to: Sum fields by using sortcard
Reply with quote

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.
Thanks in advance.

Code'd
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Mar 23, 2015 6:54 pm    Post subject: Reply to: Sum fields by using sortcard
Reply with quote

Please use the Code tags to preserve spacing.

You have a comma missing at the end of your TRAILER3.
Back to top
View user's profile Send private message
Asha chowdary

New User


Joined: 20 Mar 2015
Posts: 5
Location: Bangalore

PostPosted: Tue Mar 24, 2015 11:22 am    Post subject:
Reply with quote

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 ********************************
                                                                               
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Mar 24, 2015 1:51 pm    Post subject: Reply to: Sum fields by using sortcard
Reply with quote

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)
Back to top
View user's profile Send private message
Asha chowdary

New User


Joined: 20 Mar 2015
Posts: 5
Location: Bangalore

PostPosted: Tue Mar 24, 2015 3:26 pm    Post subject:
Reply with quote

Thanks much Bill Woodger. icon_smile.gif
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 -> HomeWorks & Requests All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Need Help to Define 36 Input Fields (... satish.ms10 CLIST & REXX 2 Sat May 07, 2016 3:08 pm
No new posts FileAid to compare(logical operations... anand1204 Compuware & Other Tools 3 Wed Apr 06, 2016 2:55 am
No new posts Fields in File-Aid Browse menu screen boyti ko Compuware & Other Tools 5 Mon Apr 04, 2016 4:51 pm
No new posts SUM FIELDS=NONE with INCLUDE kranthikumarb DFSORT/ICETOOL 17 Mon Dec 28, 2015 12:18 pm


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