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 

Extract all records except rec - range

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


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Thu Feb 22, 2007 8:25 am    Post subject: Extract all records except rec - range Reply with quote

Hi,

I have a specific requirement wherein I have to extract particular records excluding some recs falling in some record ranges.

Input File:
H1
F2
G3
H4
H5
AAA
BBB
CCC
DDD
A6
B7
B8
A9
A10
EEE
FFF
GGG


Desired output:
AAA
BBB
CCC
DDD
EEE
FFF

The record range remains constant. i.e., range 1-5 and 10-14 remain constant and should be excluded from the input.

P.S : I searched in this forum but I couldnt find the solution I am looking for. If I have missed any solution, kindly redirect me to that link.

Thanks in advance.

Regards,
Vivek G
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Feb 22, 2007 9:55 am    Post subject: Reply with quote

vivek,

Assuming that your LRECL is 80 and recfm of FB try these control cards. Basically we add the seqnum and omit based on the seqnum

Code:

//SYSIN    DD *                                 
 SORT FIELDS=COPY                               
 INREC FIELDS=(01,80,SEQNUM,8,ZD)               
 OUTFIL OMIT=((81,8,ZD,LE,5),OR,                 
              (81,8,ZD,GE,10,AND,81,8,ZD,LE,15)),
 OUTREC=(01,80)                                 
/*     


Hope this helps...

Cheers

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


Joined: 23 Jan 2007
Posts: 84
Topics: 14

PostPosted: Thu Feb 22, 2007 10:32 am    Post subject: Reply with quote

Here is a fileaid option.


Code:

//STEP01    EXEC PGM=FILEAID
//SYSPRINT  DD SYSOUT=*
//SYSLIST   DD SYDOUT=*
//SYSTOTAL  DD SYSOUT=*
//DD01      DD DISP=OLD,DSN=INPUT.FILE
//DD01SC    DD DISP=OLD,DSN=USERID.FILEAID(TEST1)
//DD01O     DD DSN=OUTPUT.FILE,DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSIN     DD *
//*

USERID.FILEAID(TEST1) should contain,
Code:

DEFINE BLOCKS=SELECTION,
           INITIAL_SKIP=5,
           THEN_SELECT=4,
           THEN_SKIP=5,
           MAXIMUM_TO_SEARCH=ALL,
           MAXIMUM_TO_SELECT=ALL


Anyways, remember that USERID.FILEAID should be VB and LRECL >= 300. You can also create the selection criteria through fileaid online.
________
magic flight launch box


Last edited by blitz2 on Wed Feb 02, 2011 3:12 am; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Feb 22, 2007 11:00 am    Post subject: Reply with quote

The control cards shown by blitz can be changed to the following and you do not require the DD01SC DD. The funcntion SPACE function moves the current record pointer forward. In=5 moves the pointer to first 5 records and then we copy 4 records and then once again we use SPACE parm to move the pointer forward. And the last copy copies all records once the pointer is set

Code:

//STEP0100 EXEC PGM=FILEAID
//SYSPRINT DD  SYSOUT=*     
//SYSLIST  DD  SYSOUT=*     
//DD01     DD  *           
H1                         
F2                         
G3                         
H4                         
H5                         
AAA                         
BBB                         
CCC                         
DDD                         
A6                         
B7                         
B8                         
A9                         
A10                         
EEE                         
FFF                         
GGG                         
//DD01O    DD  SYSOUT=*     
//SYSIN    DD  *           
$$DD01 SPACE IN=5           
$$DD01 COPY OUT=4           
$$DD01 SPACE IN=5           
$$DD01 COPY OUT=0           
/*                         


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Aug 04, 2008 12:10 pm    Post subject: Reply with quote

You can do this kind of thing quite easily with the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008). Here's an example:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=...  output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) INPUT REMOVE FIRST(5) RRN(10,14)
/*


For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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