View previous topic :: View next topic
|
Author |
Message |
vidyaa
New User
Joined: 02 May 2008 Posts: 77 Location: chennai
|
|
|
|
Hi,
I have a input file like
APV-0000026.85
msx 0000031.85
xxx 0000000.51
APV-0000000.51
xxx 0000000.51
first three byte is description and next 11 bytes is my amount(can be positive or negative) to be added based on descriptions.
I want the ouput like
APV -0000027.36
msx 0000031.85
XXX 0000001.02
please let me know your valuable suggestions. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
vidyaa,
Assuming an input file of FB,LRECL=80 and upper-case keys, you can use the below Synsort card to achieve this. I am not sure if the actual keys have lower-case values as shown above. If so you may have to modify this to correct the order of output records.
Code: |
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
APV-0000026.85
MSX 0000031.85
XXX 0000000.51
APV-0000000.51
XXX 0000000.51
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,3,CH,A)
OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,3,
TRAILER3=(1,3,TOT=(4,11,SFF,EDIT=(STTTTTTT.TT),SIGNS=(,-,,))))
|
SORTOUT
Code: |
APV-0000027.36
MSX 0000031.85
XXX 0000001.02 |
|
|
Back to top |
|
|
vidyaa
New User
Joined: 02 May 2008 Posts: 77 Location: chennai
|
|
|
|
Hi,
Thanks...
But i have milllion of records then the output doesnot come properly
SORT FIELDS=(1,3,CH,A)
OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,3,
TRAILER3=(1,3,TOT=(4,11,SFF,EDIT=(STTTTTTT.TT),SIGNS=(,-,,))))
do we need to edit the bolded fields as when it sums it may get values in 8 to 9 digits so is that causing the problem.
Please help on the same. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
But i have milllion of records then the output doesnot come properly |
Can you explain what exactly is your problem.
Quote: |
do we need to edit the bolded fields as when it sums it may get values in 8 to 9 digits so is that causing the problem |
Yes. you can increase the number of 'T's to accommodate large values. |
|
Back to top |
|
|
vidyaa
New User
Joined: 02 May 2008 Posts: 77 Location: chennai
|
|
|
|
The probelm was when i executed this sort i got the output as
APV 1360297.00
CPP 5130649.00
FP 0020228.00
GL 1157525.00
but APV should be
APV 11360297.00
i added one more T as EDIT= EDIT=(STTTTTTTT.TT),
but it abends ABENDED S000 U0016 |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Can you post the SYSOUT here. |
|
Back to top |
|
|
vidyaa
New User
Joined: 02 May 2008 Posts: 77 Location: chennai
|
|
|
|
hi Arun,
My input Lrecl is 13 and output is 80 and my jcl is like
Code: |
//SORT1 EXEC PGM=SORT
//SYSUDUMP DD SYSOUT=0
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=X.EXT.PREMOUT.Y200407,DISP=SHR
//* DD DSN=DIANES.FILE,DISP=SHR
//SORTOUT DD DSN=X.EXT.PREMOUT.NEWSORC,
// DISP=(,CATLG,KEEP),
// UNIT=DISK,SPACE=(CYL,(2000,100),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//*
//SYSIN DD *
SORT FIELDS=(1,3,CH,A)
OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,3,
TRAILER3=(1,3,TOT=(4,11,SFF,EDIT=(STTTTTTTTTTT.TT),SIGNS=(,-,,)))) |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
To repeat:
Quote: |
Can you post the SYSOUT here. |
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
first three byte is description and next 11 bytes is my amount |
Does n't that make the input lrecl=14? |
|
Back to top |
|
|
vidyaa
New User
Joined: 02 May 2008 Posts: 77 Location: chennai
|
|
|
|
Thanks Arun...
It was the problem with the Lrecl and it went throught fine
with the edit field EDIT=(STTTTTTTTTTT.TT) and with the input and output LRECL to be 80. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
You're welcome. |
|
Back to top |
|
|
|