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

How to Sum an editable field using sort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Abi

New User


Joined: 27 Jul 2005
Posts: 35
Location: Chennai

PostPosted: Tue Mar 30, 2010 4:50 pm
Reply with quote

Hi,
I have a file in which i have policy number and premium amount .
Layout is
Policy numebr x(08)
Sign byte x(01)
Premium 9(6)V99

I/p file
P1234568+00036039
P1234568-00024733
P1234569+00036039
P1234569+00036039
P1234578+00036039
P1234578-00054733

i should get the o/p file in this format
P1234568+00011306
P1234569+00072078
P1234578-00018694

While adding the sum,i need to take the sign into consideration.
Back to top
View user's profile Send private message
anshul_gugnani

New User


Joined: 02 Nov 2009
Posts: 73
Location: Mumbai

PostPosted: Tue Mar 30, 2010 6:13 pm
Reply with quote

Hi,

The below sort card might will help you -
Code:

//STEP110  EXEC PGM=SORT                               
//SORTIN   DD  DSN=[b]Input File[/b],               
//             DISP=SHR                                 
//SORTOUT  DD  DSN=[b][i]Output File[/i][/b],           
//             DISP=(NEW,CATLG,DELETE),                 
//             DCB=AMX.MODLDSCB,                       
//             RECFM=FB,                               
//             LRECL=17,                               
//             UNIT=SYSDA,                             
//             DATACLAS=HUGE                           
//*                                                     
//SYSIN    DD  *   
 INREC FIELDS=(01,17,09,09,FS,PD,LENGTH=6)                           
 SORT FIELDS=(01,08,CH,A)                                           
 SUM FIELDS=(18,06,PD)                                               
 OUTREC FIELDS=(01,08,18,06,PD,EDIT=(STTTTTTTT),SIGNS=(+,-)),CONVERT
//*                     
//SYSOUT   DD  SYSOUT=*
//SYSPRINT DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*


Hope this helps.

Thanks. icon_biggrin.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Mar 30, 2010 9:02 pm
Reply with quote

Hi Abi,

You could also use:
Code:
//SYSIN DD *                                             
  OPTION EQUALS                                         
  SORT FIELDS=(1,8,CH,A)                                 
  OUTFIL REMOVECC,NODETAIL,                             
    SECTIONS=(1,8,                                       
      TRAILER3=(1,8,                                     
        TOT=(9,10,SFF,EDIT=(STTTTTTTT),SIGNS=(+,-))))   
/*                                                       
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Mar 30, 2010 9:11 pm
Reply with quote

Anshul - for a sort job, you dont really need the folloing parameters for the SORTOUT:
Code:
//             DCB=AMX.MODLDSCB,                       
//             LRECL=17,                               
//             DATACLAS=HUGE
And "DCB=AMX.MODLDSCB" is local to your shop and has no meaning on other shops. Additionally, it looks like a Model DSCB, which is really not required for a QSAM-file for sure.

Also, you don't need
Code:
//SYSPRINT DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
for sort products (at least for DFSort and SyncSort).
Back to top
View user's profile Send private message
anshul_gugnani

New User


Joined: 02 Nov 2009
Posts: 73
Location: Mumbai

PostPosted: Tue Mar 30, 2010 11:18 pm
Reply with quote

Hi Anuj,

Thanks for info.
Nevertheless, The sort card I posted will work fine. icon_smile.gif

Thanks.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Mar 31, 2010 4:28 pm
Reply with quote

You're welcome 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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top