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: 1529
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: 7225

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: 1445
Location: Azeroth

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: 1445
Location: Azeroth

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: 1529
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: 7225

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: 1445
Location: Azeroth

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 syncsort: copy lines after the keyword shreya19 SYNCSORT 3 Fri Dec 02, 2016 9:47 am
No new posts Matching with Key at different postions. rajatbagga DFSORT/ICETOOL 12 Wed Nov 09, 2016 10:58 am
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm
No new posts TSO Logon Failing - Acount Not matching SLNewton TSO/ISPF 1 Thu Aug 25, 2016 9:37 pm
No new posts dataset copy question - REPRO or some... atulxp TSO/ISPF 2 Wed Aug 03, 2016 10:56 pm


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