Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Start copy after the first matching word is found

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
bhavin.mehta

New User


Joined: 25 Jun 2012
Posts: 32
Location: India

PostPosted: Wed Nov 13, 2013 2:23 pm    Post subject: Start copy after the first matching word is found
Reply with quote

I have a file which has some "Keyword" placed at some random line, but the position of the keywords are fixed.

I want to start the copy from that line where is "Keyword" is found. All the above lines should be skipped.
Simillary there is another "Keyword" at the end which indicates to stop.

Both the start and the stop keywords are at unpredicted line but at a definite position.

Is there a way where I can put such logic?
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1537
Location: Andromeda Galaxy

PostPosted: Wed Nov 13, 2013 2:35 pm    Post subject:
Reply with quote

Group the records when you encounter the keyword and PUSH SEQ or keyword
then OUTFIL INCLUDE + BUILD
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Nov 13, 2013 3:07 pm    Post subject: Reply to: Start copy after the first matching word is found
Reply with quote

With END= for the data which finishes the GROUP.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1504
Location: Chennai

PostPosted: Wed Nov 13, 2013 3:13 pm    Post subject:
Reply with quote

Hello,
Try out something like this, It starts reading from START keyword and stops at END keyword.

Code:
//STEP0010 EXEC  PGM=SORT
//SORTIN   DD  *
USELESS RECORD
USELESS RECORD
START FROM HERE
PRETTY RECORD
PRETTY RECORD
END IT HERE
USELESS RECORD
USELESS RECORD
/*
//SORTOUT  DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN    DD  *
 OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'START'),PUSH=(81:1,5),
  END=(1,3,CH,EQ,C'END'))
  OUTFIL INCLUDE=(81,5,CH,EQ,C'START'),BUILD=(1,80)
/*


Output:
Code:
START FROM HERE
PRETTY RECORD
PRETTY RECORD
END IT HERE
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1504
Location: Chennai

PostPosted: Wed Nov 13, 2013 3:50 pm    Post subject:
Reply with quote

@Bill & Pandora
my DFSORT is rusty so used this as a practice.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1537
Location: Andromeda Galaxy

PostPosted: Wed Nov 13, 2013 4:19 pm    Post subject:
Reply with quote

Vasanthz,
It is just the same for me .Experiencing in seocond hand icon_smile.gif
Back to top
View user's profile Send private message
bhavin.mehta

New User


Joined: 25 Jun 2012
Posts: 32
Location: India

PostPosted: Wed Nov 13, 2013 5:20 pm    Post subject:
Reply with quote

@Pandora-Box:
Thanks for your help, it worked.

@vasanthz:
Sorry, I didn't check you comment until I was done with my Logic. But our code is almost the same. Without the 'END'

@Bill Woodger:
Thanks for reducing my load. I'll use END, as explained by vasanthz.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Nov 13, 2013 5:21 pm    Post subject: Reply to: Start copy after the first matching word is found
Reply with quote

Vasanthz,

You could PUSH a one-byte ID. Or a single character. Just save a bit of space on the intermediate records. Won't make a difference for the task in hand, I suspect. So mark that as a bit of rust shined off.

bhavin.mehta,

We assume that your values in those positions are unique. If not, you may not get the results you want. If you have multiple groups and only want the first, or a specific one, do PUSH the ID and test for that (equal to 1, for the first group, 3 for the third etc).
Back to top
View user's profile Send private message
bhavin.mehta

New User


Joined: 25 Jun 2012
Posts: 32
Location: India

PostPosted: Wed Nov 13, 2013 5:28 pm    Post subject:
Reply with quote

@Bill Woodger

Yes, I have used ID and it is working perfecting fine icon_biggrin.gif
Thanks again.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1504
Location: Chennai

PostPosted: Wed Nov 13, 2013 6:49 pm    Post subject:
Reply with quote

Quote:
You could PUSH a one-byte ID. Or a single character. Just save a bit of space on the intermediate records.

Bill, thanks, using one byte would certainly be more effecient. I have to give more work to bwains.

Regards,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to Clear all TSQs during CICS sta... Hooman24 CICS 10 Mon Jun 26, 2017 9:46 pm
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 7 Thu Apr 27, 2017 1:15 am
No new posts Copy load modules and alias vasanthz IBM Tools 5 Thu Apr 20, 2017 6:31 am
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am
No new posts Row not found Sql error GaganGarg DB2 7 Tue Mar 07, 2017 6:29 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us