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

Select a series of records for matching condition


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ezhavendhan

New User


Joined: 27 Mar 2013
Posts: 11
Location: India

PostPosted: Thu Feb 20, 2014 12:36 pm
Reply with quote

Hi all,

My input file has record types from 1A to 9A(in column postion of 60). My requirement is if the 1A(2bytes) record type is found with 722(in column postion 70), then i have to copy/select this set of records from 1A to 9A to output file.

If this condition of 1A with 722 in columns of 60,70 are not met, then i have to skip the set of 1A-9A records until next matching is found.
Once found again i have to copy/select the set of matched records.

Record Length - 293, Fixed
If you share idea it would be appreciated !!
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 Feb 20, 2014 12:51 pm
Reply with quote

INREC IFTHEN=(WHEN=GROUP with BEGIN for 1A and END for 9A, PUSH the value you want to test after the end of the record (PUSH=(294:70,3) the use OUTFIL INCLUDED= with BUILD to return the records to their normal size.
Back to top
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Thu Feb 20, 2014 12:53 pm
Reply with quote

Quote:
then i have to copy/select this set of records from 1A to 9A to output file
.

Cannot understand this

Try IFTHEN=(WHEN= and overlay
Back to top
View user's profile Send private message
ezhavendhan

New User


Joined: 27 Mar 2013
Posts: 11
Location: India

PostPosted: Fri Feb 21, 2014 3:12 pm
Reply with quote

Thank you Bill, it worked out !!!

Here it is,
Code:


OPTION COPY                                           
    INREC IFTHEN=(WHEN=GROUP,                         
    BEGIN=(60,2,CH,EQ,C'1A',AND,70,3,CH,EQ,C'722'),   
    END=(60,2,CH,EQ,C'9A'),                           
    PUSH=(294:ID=1))                                   
OUTFIL INCLUDE=(294,1,CH,NE,C' '),BUILD=(1,293)       



Enlight more on what do ID in the push signifies ?
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: Fri Feb 21, 2014 4:56 pm
Reply with quote

I was thinking you'd come up with a pretty good solution. Then I saw your last line, so you did some good, but not complete, researching :-)

The ID= is the sequential number allocated to all the groups, ID=1 is a one-digit field for this sequence. You only have one group, so one digit is fine. If you had five groups, all the records in the first group would get an one-byte field of value "1", all the second "2", then "3" through to five for the three remaining groups.

With a small number of values defining the group, the AND on the BEGIN is a good idea.

Code:
OUTFIL INCLUDE=(294,1,CH,NE,C' '),BUILD=(1,293)


This is a bit tortuous to read. You could instead OMIT= records whose value is blank or INCLUDE= those with C'1' (now that you know what the ID does).
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top