View previous topic :: View next topic
|
Author |
Message |
maki_psg
New User
Joined: 28 Jan 2010 Posts: 47 Location: India
|
|
|
|
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 |
|
|
maki_psg
New User
Joined: 28 Jan 2010 Posts: 47 Location: India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
maki_psg
New User
Joined: 28 Jan 2010 Posts: 47 Location: India
|
|
|
|
Thank you, Bill and Skolusu. Your suggestions were working fine.. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
With Kolusu's neat solution, symbols/SYMNAMES would work really well. No chance of a typo giving different values... |
|
Back to top |
|
|
|