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

Adding using sort


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

New User


Joined: 02 May 2008
Posts: 77
Location: chennai

PostPosted: Fri Dec 12, 2008 1:08 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 12, 2008 4:53 pm
Reply with quote

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
View user's profile Send private message
vidyaa

New User


Joined: 02 May 2008
Posts: 77
Location: chennai

PostPosted: Fri Dec 12, 2008 7:52 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 12, 2008 8:08 pm
Reply with quote

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
View user's profile Send private message
vidyaa

New User


Joined: 02 May 2008
Posts: 77
Location: chennai

PostPosted: Fri Dec 12, 2008 8:13 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 12, 2008 8:51 pm
Reply with quote

Can you post the SYSOUT here.
Back to top
View user's profile Send private message
vidyaa

New User


Joined: 02 May 2008
Posts: 77
Location: chennai

PostPosted: Fri Dec 12, 2008 10:00 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 12, 2008 10:34 pm
Reply with quote

Hello,

To repeat:
Quote:
Can you post the SYSOUT here.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Dec 13, 2008 12:12 am
Reply with quote

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
View user's profile Send private message
vidyaa

New User


Joined: 02 May 2008
Posts: 77
Location: chennai

PostPosted: Sat Dec 13, 2008 12:50 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Dec 13, 2008 12:55 am
Reply with quote

You're welcome.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top