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
 

 

Search and copy a part of a string using DFSORT

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

New User


Joined: 28 Jan 2010
Posts: 47
Location: India

PostPosted: Fri Oct 12, 2012 7:18 pm    Post subject: Search and copy a part of a string using DFSORT
Reply with quote

Hi,

I would like to search for a string from one file and copy a part of a string (GDG name) into another file. The string would be available anywhere in line between column 01 and 80.

Sample Input file -

SYSMSG IEF100I ETC..
IEF375I DSN=MYTEST.MNCFILE.WEEKLY.G0101V00 CREATED
SYSMSG IEF200I ETC..


Expected Output file -

MYTEST.MNCFILE.WEEKLY.G0101V00

I found a way to search and copy the record using the INCLUDE statement.

INCLUDE COND=(1,80,SS,EQ,C'MYTEST.MNCFILE.WEEKLY.G').

However, the requirement is just to copy the string alone, but NOT the complete record into output file as shown below.

IEF375I DSN=MYTEST.MNCFILE.WEEKLY.G0101V00 CREATED
Back to top
View user's profile Send private message

maki_psg

New User


Joined: 28 Jan 2010
Posts: 47
Location: India

PostPosted: Fri Oct 12, 2012 7:35 pm    Post subject:
Reply with quote

Forgot to update another important thing..

The string (GDG name) would be matched at many places in any column (01 to 80). However, I would like to copy the string only once in the output file.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Fri Oct 12, 2012 7:41 pm    Post subject: Reply to: Search and copy a part of a string using DFSORT
Reply with quote

Having filtered to just the records you want, it is then a simple PARSE to get the dataset name, with STARTAFT=C'DSN=' and ENDBEFR=BLANKS.

If you are only searching for one value, you can limit the file to one record with OUTFIL.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 12, 2012 10:07 pm    Post subject: Reply to: Search and copy a part of a string using DFSORT
Reply with quote

Maki_psg,

Use the following Control cards which will give you the desired results.

Code:

//SYSIN    DD *                                       
  INCLUDE COND=(1,80,SS,EQ,C'MYTEST.MNCFILE.WEEKLY.G')
  OPTION COPY,STOPAFT=1                               
  INREC BUILD=(C'MYTEST.MNCFILE.WEEKLY.G')           
//*


Check this link which explains DFSORT Processing.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1ca60/1.5.4?
Back to top
View user's profile Send private message
maki_psg

New User


Joined: 28 Jan 2010
Posts: 47
Location: India

PostPosted: Wed Oct 17, 2012 3:44 pm    Post subject:
Reply with quote

Thank you, Bill and Skolusu. Your suggestions were working fine..
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Wed Oct 17, 2012 9:49 pm    Post subject: Reply to: Search and copy a part of a string using DFSORT
Reply with quote

With Kolusu's neat solution, symbols/SYMNAMES would work really well. No chance of a typo giving different values...
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am


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