Page 1 of 1

Substring anywhere in the record

PostPosted: Wed Feb 22, 2012 7:22 pm
by whowillwait4u
Hi,

I have input data as shown below.
// DD DSN=abcd
// 7456546 DD DSN=efgh
// 666 DD DSN=ijkl
// DD DSN=mnop 909
// 6545 DD DSN=qrst

output should be:

abcd
efgh
ijkl
mnop
qrst

Could you please help...?

Re: Substring anywhere in the record

PostPosted: Wed Feb 22, 2012 7:46 pm
by enrico-sorichetti
how is the substring terminated ?

Re: Substring anywhere in the record

PostPosted: Wed Feb 22, 2012 8:16 pm
by BillyBoyo
That doesn't look like valid DD names, but if that is what you have, some amendment of Kolusu's post from here: http://ibmmainframes.com/about57422.html might do you.

Re: Substring anywhere in the record

PostPosted: Wed Feb 22, 2012 11:37 pm
by Frank Yaeger
whowillwait4u,

Assuming the DSN=name field ends with a blank and that the name can be up to 44 bytes long, you can use a DFSORT job like the following:

//S1 EXEC PGM=SORT                                               
//SYSOUT DD SYSOUT=*                                             
//SORTIN DD DSN=...  input file                   
//SORTOUT DD DSN=...  output file                                 
//SYSIN DD *                                                     
  OPTION COPY                                                   
  INREC PARSE=(%1=(STARTAFT=C'DSN=',ENDBEFR=C' ',FIXLEN=44)),   
    BUILD=(%1)                               
/*