View previous topic :: View next topic
|
Author |
Message |
Piyush Jadhav
New User
Joined: 06 Feb 2014 Posts: 7 Location: India
|
|
|
|
Hi,
I have following input file which contains the dsn=<dsname> and information about it, I want to trim part after "dsn=" and trim everything after <dsname> as well and want to have only <dsname> in output file.
Can anyone please suggest, if this can be achieved using SORT, or should I better go for REXX ?
Input Looks like =
[dsn=AAA.BBB.LOAD is not catalogued or does not exist on volser=******
dsn=BBB.CCC.LIB is not catalogued or does not exist on volser=******
dsn=CCC.DDD.LOADLIB is not catalogued or does not exist on volser=****
dsn=DDD.EEEE.LOAD is not catalogued or does not exist on volser=*****
dsn=EEEE.DDDD.LINK is not catalogued or does not exist on volser=*****
dsn=FFFFF.GGGGG.HHHHH.LOADLIB is not catalogued or does not exist on volser=***** ]
Output should look a like =
[AAA.BBB.LOAD
BBB.CCC.LIB
CCC.DDD.LOADLIB
DDD.EEEE.LOAD
EEEE.DDDD.LINK
FFFFF.GGGGG.HHHHH.LOADLIB]
Please suggest. Thanks in Advance, |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1305 Location: Bamberg, Germany
|
|
|
|
For the sample data provided, this works:
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
FINDREP=(IN=(C'dsn=',
C' is not catalogued or does not exist on volser=******'),
OUT=(C'')))
END |
Code: |
****** ********************
000001 [AAA.BBB.LOAD
000002 BBB.CCC.LIB
000003 CCC.DDD.LOADLIB
000004 DDD.EEEE.LOAD
000005 EEEE.DDDD.LINK]
****** ******************** |
To make it work for varying volser names and/or descriptions, use PARSE instead.
Remember to use code tags when providing code or data to the forum |
|
Back to top |
|
|
|