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
 

 

SORT SUM and WRITE in TWO files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
worldan

New User


Joined: 15 Sep 2009
Posts: 10
Location: chennai

PostPosted: Tue Sep 15, 2009 4:19 pm    Post subject: SORT SUM and WRITE in TWO files
Reply with quote

Hi,

Currently in my JCL i have two SORT steps. In first sort step it sorts the input in certain sorting key fileds and write in output file. In the second sort it sorts the same input file and in the same sorting keys fields and SUM fileds and write in a different file. Is there any way in sort to club both steps in a single step to write FILE1 with just sorted order and second file with SORT SUMMED order? Basically since the input file contain millions pf records i just wanted to save some MIPS in clubbing together.
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: Tue Sep 15, 2009 9:04 pm    Post subject:
Reply with quote

Hello,

Suggest you post the current 2-step jcl and control statements. . .
Back to top
View user's profile Send private message
worldan

New User


Joined: 15 Sep 2009
Posts: 10
Location: chennai

PostPosted: Wed Sep 16, 2009 6:45 am    Post subject: Reply to: SORT SUM and WRITE in TWO files
Reply with quote

Hi this is control cards. Is there any way to club these two steps?


STEP1 EXEC PGM=SORT
DXXXX DD DSN = aaa.bbb.ccc
Dyyyy DD DSN = ddd.eee.fff
sysin DD *
SORT FIELDS=(1,9,PD,A,23,3,PD,A,56,1,CH,A)
.......
.......

STEP1 EXEC PGM=SORT
DXXXX DD DSN = aaa.bbb.ccc
Dyyyy DD DSN = gggg.hhh.iii
sysin DD *
SORT FIELDS=(1,9,PD,A,23,3,PD,A,56,1,CH,A)
SUM FIELDS=(27,9)

.......

Code:
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Sep 16, 2009 9:13 pm    Post subject:
Reply with quote

SUM FIELDS=(27,9) is invalid since you don't have a format. What is the format of this field - ZD, PD, BI?

I believe you could do it in one pass by not using SUM, but instead using an OUTFIL without SECTIONS for the sorted version, and an OUTFIL with REMOVECC, NODETAIL, SECTIONS, TRAILER3 and TOT for the sorted/summed version. But I need to know the format of the field to be summed before I can show you how to do it.

Also, what is the RECFM and LRECL of the input file?

Are the SORT PD values all positive, or can they be both positive and negative?
Back to top
View user's profile Send private message
worldan

New User


Joined: 15 Sep 2009
Posts: 10
Location: chennai

PostPosted: Wed Sep 16, 2009 9:23 pm    Post subject: Reply to: SORT SUM and WRITE in TWO files
Reply with quote

Hi Frank,

The SUM FIELDS format is PD .
Also the RECFM is FB and LRECL is 80.
The SORT PD values is acct number and PID. So it is Positive.
But the summed fileds are expiration points. So it can be Positive Or Negative
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Sep 18, 2009 9:25 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for in one pass:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//OUT1 DD DSN=...  output file1 (FB/80)
//OUT2 DD DSN=...  output file2 (FB/80)
//SYSIN    DD    *
   SORT FIELDS=(1,9,PD,A,23,3,PD,A,56,1,CH,A)
   OUTREC OVERLAY=(81:1,9,PD,TO=PD,LENGTH=9,23,3,PD,TO=PD,LENGTH=3,
     56,1)
   OUTFIL FNAMES=OUT1,BUILD=(1,80)
   OUTFIL FNAMES=OUT2,REMOVECC,NODETAIL,
     BUILD=(1,80),
     SECTIONS=(81,13,
       TRAILER3=(1,26,TOT=(27,9,PD,TO=PD,LENGTH=9),36,45))
/*
Back to top
View user's profile Send private message
worldan

New User


Joined: 15 Sep 2009
Posts: 10
Location: chennai

PostPosted: Sun Sep 20, 2009 7:56 pm    Post subject: Reply to: SORT SUM and WRITE in TWO files
Reply with quote

Thanks Frank for your solution.
I will test run and let u know if i face any issues
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


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