MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Print first and last Keys as part of INCLUDE

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Mon Nov 14, 2016 4:40 am    Post subject: Print first and last Keys as part of INCLUDE Reply with quote

I found an example somewhere similar to the following
Code:

OPTION COPY                                                       
INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(22,32),PUSH=(1001:ID=8))       
OUTFIL FNAMES=D799301,INCLUDE=(1001,8,ZD,LE,750000),BUILD=(1,1000)
OUTFIL FNAMES=D799302,INCLUDE=(1001,8,ZD,GT,750000,AND,           
                            1001,8,ZD,LE,2000000),BUILD=(1,1000)   
OUTFIL FNAMES=D799303,INCLUDE=(1001,8,ZD,GT,2000000,AND,           
                            1001,8,ZD,LE,3000000),BUILD=(1,1000)   
OUTFIL FNAMES=D799304,SAVE,BUILD=(1,1000)                         

which was brilliant for splitting a massive file (150,000,000 records) into 4 files.
What I would like to know is if there is a simple method of displaying the first/last keys for each file (based on positions 22,32 for the KEYBEGIN).

NOTE that this is something of a nice-to-have, so a scan through the files twice would make the job not worth doing.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Mon Nov 14, 2016 9:42 am    Post subject: Re: Print first and last Keys as part of INCLUDE Reply with quote

misi01 wrote:

What I would like to know is if there is a simple method of displaying the first/last keys for each file (based on positions 22,32 for the KEYBEGIN).


Misi01,

It is quite simple to get the minimum key and the maximum key. Do you want the minimum key as the first record and maximum key as the last record in the same files that you are splitting?

or do you need to write them to a separate file? with the min and max keys as report?
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Tue Nov 15, 2016 1:56 am    Post subject: Thanks Kolusu Reply with quote

Doesn't have to be anything fancy. As long as the results don't go to the output files (SYSOUT, SYSPRINT or whatever are fine).
Something along the lines of (here's my guestimate of the code, tried adding bold text within the code, but that doesn't seem to work)
Code:

OPTION COPY                                                       
INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(22,32),PUSH=(1001:ID=8))       
OUTFIL FNAMES=D799301,INCLUDE=(1001,8,ZD,LE,750000),BUILD=(1,1000)
print 'D799301, first id 'id=1', last id = 'id=750000
OUTFIL FNAMES=D799302,INCLUDE=(1001,8,ZD,GT,750000,AND,           
                            1001,8,ZD,LE,2000000),BUILD=(1,1000)   
OUTFIL FNAMES=D799303,INCLUDE=(1001,8,ZD,GT,2000000,AND,           
                            1001,8,ZD,LE,3000000),BUILD=(1,1000)   
OUTFIL FNAMES=D799304,SAVE,BUILD=(1,1000)

_________________
Michael
Back to top
View user's profile Send private message Send e-mail
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Tue Nov 15, 2016 5:03 am    Post subject: Reply with quote

A further OUTFIL. You know the ID of the first and last group in each OUTFIL, except for the SAVE. so an INCLUDE= for the known numbers. BUILD to just have the information you want. Then with reporting functions NODETAIL,REMOVECC and SECTIONS with TRAILER3 and a TRAILER1 to get the last group on the "SAVE" OUTFIL.

You also would need to change the "SAVE" OUTFIL, because you are now INCLUDEing two records from what was on that OUTFIL SAVE, so they will no longer be there... is that clear? SAVE gets you everything which doesn't appear on another OUTFIL. If you then make something which would otherwise appear on the SAVE appear on another OUTFIL, it will no longer appear on the SAVE.

Can change SAVE to GT,3000000.. Entirely safe to do so, as they are sequentially allocated numbers.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Tue Nov 15, 2016 10:47 am    Post subject: Reply with quote

misi01,

Try this

Code:

//KEYRPT   DD SYSOUT=*     
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(22,32),PUSH=(1001:ID=8)),     
        IFTHEN=(WHEN=(1001,8,ZD,LE,0750000),OVERLAY=(1010:C'1')), 
        IFTHEN=(WHEN=(1001,8,ZD,GT,0750000,AND,                   
                      1001,8,ZD,LE,2000000),OVERLAY=(1010:C'2')), 
        IFTHEN=(WHEN=(1001,8,ZD,GT,2000000,AND,                   
                      1001,8,ZD,LE,3000000),OVERLAY=(1010:C'3')), 
        IFTHEN=(WHEN=(1001,8,ZD,GT,3000000),OVERLAY=(1010:C'4'))   
                                                                   
  OUTFIL FNAMES=D799301,BUILD=(1,1000),INCLUDE=(1010,1,CH,EQ,C'1')
  OUTFIL FNAMES=D799302,BUILD=(1,1000),INCLUDE=(1010,1,CH,EQ,C'2')
  OUTFIL FNAMES=D799303,BUILD=(1,1000),INCLUDE=(1010,1,CH,EQ,C'3')
  OUTFIL FNAMES=D799304,SAVE,BUILD=(1,1000)                       
                                                                   
  OUTFIL FNAMES=KEYRPT,NODETAIL,REMOVECC,BUILD=(80X),             
  SECTIONS=(1010,1,                                               
   HEADER3=('D79930',1010,1,C', FIRST ID   = ',22,32),             
  TRAILER3=('D79930',1010,1,C', LAST  ID   = ',22,32,/))           
//*

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Tue Nov 15, 2016 12:04 pm    Post subject: Reply with quote

Thanks a bunch Kolusu. I'll give it a whirl tomorrow at work
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Wed Nov 16, 2016 1:13 am    Post subject: Reply with quote

Worked a treat. Thanks a lot
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group