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

SORT SUM and WRITE in TWO files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Tue Sep 15, 2009 9:04 pm
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
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 Developer


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

PostPosted: Wed Sep 16, 2009 9:13 pm
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
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 Developer


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

PostPosted: Fri Sep 18, 2009 9:25 pm
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
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 All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Simplify SORT CARD to combine INREC a... DFSORT/ICETOOL 6
No new posts JCL to merge two files side by side DFSORT/ICETOOL 3
No new posts Sort card to generate the DSN DFSORT/ICETOOL 17
No new posts Write record twice based on condition... SYNCSORT 7
No new posts Sort card to know that creation date ... DFSORT/ICETOOL 10
Search our Forums:


Back to Top