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

can I do this 2-step sort with ICETOOL in a single step ?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ronald masters

New User


Joined: 09 Dec 2015
Posts: 12
Location: uk

PostPosted: Thu Dec 10, 2015 3:50 pm
Reply with quote

I have a job with two sort steps which is used to load a VSAM dataset.

Code:
//SORT1     EXEC PGM=SORT                                             
//SORTMSG   DD SYSOUT=*                                               
//SORTIN    DD DISP=(SHR,PASS),DSN=&&UNLOAD                           
//SORTOUT   DD DISP=(NEW,PASS),SPACE=(CYL,(100,100),RLSE),DSN=&&SORTED
//SYSIN     DD *                                                       
 SORT FIELDS=(121,24,CH,A,    SORT ON KEY                             
              53,10,CH,D)     THEN AUT_DATE (LATEST FIRST)             
//*                                                                   
//SORT2     EXEC PGM=SORT                                             
//VIOSTAT1  DD DUMMY                                                   
//SORTMSG   DD SYSOUT=*                                               
//SORTIN    DD DISP=(SHR,PASS),DSN=&&SORTED                           
//SORTOUT   DD DISP=OLD,DSN=IUKX964.USTBL.TBL102BL                     
//SYSIN     DD *                                                       
 SORT FIELDS=(121,24,CH,A)    SORT ON KEY                             
 SUM  FIELDS=NONE             ELIMINATE DUPLICATES                     
 OPTION EQUALS                KEEP FIRST OF SUMMED RECORDS             


I have not used ICETOOL before. At first I thought it might be able to do this in one step. But now having read the ICETOOL section of the manual, I have my doubts. Can anyone confirm please ?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Dec 10, 2015 4:10 pm
Reply with quote

Your second step looks as though the SORT is just to allow the use of SUM. That is always inefficient.

You don't need two steps, it can be done in one.

Have a look at OUTFIL reporting functions, with NODETAIL, REMOVECC and SECTIONS with TRAILER3, and you don't even need to sort on the date descending (if the dates are in ascending order, just remove that key, if in no order, sort ascending and the TRAILER3 will get the last one of the key).

If you want to use ICETOOL to do this, you'd look at the SELECT operator. Also look at the Smart DFSORT Tricks publication for how to do XSUM and more as well.
Back to top
View user's profile Send private message
ronald masters

New User


Joined: 09 Dec 2015
Posts: 12
Location: uk

PostPosted: Thu Dec 10, 2015 9:06 pm
Reply with quote

Thanks for those pointers Bill. I gave it a try with a single job step and these control statements:




Code:
SORT FIELDS=(121,18,CH,A,    SORT ON BOOKING_OFFICE + ACCOUNT 
             53,14,CH,A)     THEN AUT_DATE + AUT_TIME         
                                                               
OUTFIL    SECTIONS=(121,18,TRAILER3=(1,256)),                 
          NODETAIL,                                           
          REMOVECC                                             

I could see how the output would be a report, but I could use this report like an output dataset without a CC char, each record would be a summary for each section (one per unique key in my case) and the NODETAIL effectively suppresses outrecs being written.

But the maximum of 256 on the TRAILER3 length. I don't get that. My output has what I want but only the first 256 bytes. I'd like to say (1,710), for example.

Why the limitation? Or did I misunderstand ?
Back to top
View user's profile Send private message
ronald masters

New User


Joined: 09 Dec 2015
Posts: 12
Location: uk

PostPosted: Thu Dec 10, 2015 9:07 pm
Reply with quote

By the way, it works with
Code:
SORT FIELDS=(121,18,CH,A,    SORT ON BOOKING_OFFICE + ACCOUNT 
             53,14,CH,A)     THEN AUT_DATE + AUT_TIME         
                                                               
OUTFIL    SECTIONS=(121,18,TRAILER3=(001,200,                 
                                     201,200,                 
                                     401,200,                 
                                     601,110)),               
          NODETAIL,                                           
          REMOVECC                                             
Back to top
View user's profile Send private message
ronald masters

New User


Joined: 09 Dec 2015
Posts: 12
Location: uk

PostPosted: Thu Dec 10, 2015 9:08 pm
Reply with quote

And CPU usage is about 40% of the two-step job
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Dec 10, 2015 9:57 pm
Reply with quote

Well, can you paste the ICE201I message from the sysout of the step, please? The documented limit for a HEADER1 field (therefore TRAILER1, therefore TRAILER3) is 32752 bytes.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Thu Dec 10, 2015 10:00 pm
Reply with quote

Quote:
But the maximum of 256 on the TRAILER3 length. I don't get that. My output has what I want but only the first 256 bytes. I'd like to say (1,710), for example.


Code:
p,m
specifies that an unedited input field, from the first OUTFIL input record
for which a data record appears in the report, is to appear in the report
record.
p specifies the first byte of the input field relative to the beginning of the
OUTFIL input record. The first data byte of a fixed-length record has
relative position 1. The first data byte of a variable-length record has
relative position 5, because the first four bytes are occupied by the
RDW. All fields must start on a byte boundary, and no field can extend
beyond byte 32752. See “OUTFIL statements notes” on page 372 for
special rules concerning variable-length records.
m specifies the length in bytes of the input field. The value for m must be
between 1 and 32752.

Please have a look here on page-338
Back to top
View user's profile Send private message
ronald masters

New User


Joined: 09 Dec 2015
Posts: 12
Location: uk

PostPosted: Thu Dec 10, 2015 10:08 pm
Reply with quote

My mistake.

I am working with V2R1 but looking at the doc for V1R8.

All clear now. Thanks for your help everybody.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
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 Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
Search our Forums:

Back to Top