View previous topic :: View next topic
Author
Message
Abi New User Joined: 27 Jul 2005Posts: 35 Location: Chennai
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
anshul_gugnani New User Joined: 02 Nov 2009Posts: 73 Location: Mumbai
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.
Back to top
Anuj Dhawan Superior Member Joined: 22 Apr 2006Posts: 6250 Location: Mumbai, India
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
Anuj Dhawan Superior Member Joined: 22 Apr 2006Posts: 6250 Location: Mumbai, India
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
anshul_gugnani New User Joined: 02 Nov 2009Posts: 73 Location: Mumbai
Hi Anuj,
Thanks for info.
Nevertheless, The sort card I posted will work fine.
Thanks.
Back to top
Anuj Dhawan Superior Member Joined: 22 Apr 2006Posts: 6250 Location: Mumbai, India
You're welcome .
Back to top
Please enable JavaScript!