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
 

 

Adding using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
vidyaa

New User


Joined: 02 May 2008
Posts: 70
Location: chennai

PostPosted: Fri Dec 12, 2008 1:08 pm    Post subject: Adding using sort
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: 2180
Location: @my desk

PostPosted: Fri Dec 12, 2008 4:53 pm    Post subject:
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: 70
Location: chennai

PostPosted: Fri Dec 12, 2008 7:52 pm    Post subject: Reply to: Adding using sort
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: 2180
Location: @my desk

PostPosted: Fri Dec 12, 2008 8:08 pm    Post subject:
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: 70
Location: chennai

PostPosted: Fri Dec 12, 2008 8:13 pm    Post subject:
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: 2180
Location: @my desk

PostPosted: Fri Dec 12, 2008 8:51 pm    Post subject:
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: 70
Location: chennai

PostPosted: Fri Dec 12, 2008 10:00 pm    Post subject:
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

Site Director


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

PostPosted: Fri Dec 12, 2008 10:34 pm    Post subject:
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: 2180
Location: @my desk

PostPosted: Sat Dec 13, 2008 12:12 am    Post subject:
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: 70
Location: chennai

PostPosted: Sat Dec 13, 2008 12:50 am    Post subject:
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: 2180
Location: @my desk

PostPosted: Sat Dec 13, 2008 12:55 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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