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

Start copy after the first matching word is found


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

New User


Joined: 25 Jun 2012
Posts: 34
Location: India

PostPosted: Wed Nov 13, 2013 2:23 pm
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

Global Moderator


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

PostPosted: Wed Nov 13, 2013 2:35 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Nov 13, 2013 3:07 pm
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: 1742
Location: Tirupur, India

PostPosted: Wed Nov 13, 2013 3:13 pm
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: 1742
Location: Tirupur, India

PostPosted: Wed Nov 13, 2013 3:50 pm
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

Global Moderator


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

PostPosted: Wed Nov 13, 2013 4:19 pm
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: 34
Location: India

PostPosted: Wed Nov 13, 2013 5:20 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Nov 13, 2013 5:21 pm
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: 34
Location: India

PostPosted: Wed Nov 13, 2013 5:28 pm
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: 1742
Location: Tirupur, India

PostPosted: Wed Nov 13, 2013 6:49 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts How I Found a Bug in a FORTRAN Compiler All Other Mainframe Topics 4
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
Search our Forums:

Back to Top