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

Search and copy a part of a string using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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

Moderator Emeritus


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

PostPosted: Fri Oct 12, 2012 7:41 pm
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
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.

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
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

Moderator Emeritus


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

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

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top