Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 7314

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

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 Linkage editor is part of COBOL, z/OS... ankit.jain COBOL Programming 4 Fri Apr 20, 2018 4:17 pm
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am
No new posts Need urgent suggestion on DFSORT subratarec DFSORT/ICETOOL 6 Wed Mar 21, 2018 8:46 pm
No new posts Copy set of records based on condition krish.deepu SYNCSORT 2 Thu Mar 08, 2018 11:39 am
No new posts Find a string in PS file opened in br... mukkas CLIST & REXX 3 Sat Feb 24, 2018 2:15 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us