Page 1 of 1

FINDREPL or something else

PostPosted: Tue Apr 06, 2010 7:53 pm
by Asa
I've got an input file looking like this
120100329000000000047089755CT UDL 470 000000004500000513
120100329000000000047076766CT UDL 470 000000004500000514
120100329000000000047089755CT 415 000000004500000513
120100329000000000047076766CT 470 000000004500000514

If in a certain position a field with the length of 8 starts with 'UDL ' I want to remove the 'UDL ' and keep the rest of the
field.

In the exemple above I want the result to be
120100329000000000047089755CT 470 000000004500000513
120100329000000000047076766CT 470 000000004500000514
120100329000000000047089755CT 415 000000004500000513
120100329000000000047076766CT 470 000000004500000514

Can you please help me?

Re: FINDREPL or something else

PostPosted: Tue Apr 06, 2010 8:47 pm
by skolusu
ASA,

Use the following DFSORT JCL

//STEP0100  EXEC  PGM=SORT                               
//SYSOUT    DD SYSOUT=*                                 
//SORTIN    DD *                                         
120100329000000000047089755CT UDL 470 000000004500000513
120100329000000000047076766CT UDL 470 000000004500000514
120100329000000000047089755CT 415 000000004500000513     
120100329000000000047076766CT 470 000000004500000514     
//SORTOUT   DD SYSOUT=*                                 
//SYSIN     DD *                                         
  OPTION COPY                                             
  INREC FINDREP=(IN=C'UDL ',OUT=C'')                     
//*


will produce

120100329000000000047089755CT 470 000000004500000513
120100329000000000047076766CT 470 000000004500000514
120100329000000000047089755CT 415 000000004500000513
120100329000000000047076766CT 470 000000004500000514

Re: FINDREPL or something else

PostPosted: Wed Apr 07, 2010 1:10 pm
by Asa
The spaces in the input-file disappears
I try to attach instead.

Re: FINDREPL or something else

PostPosted: Wed Apr 07, 2010 9:33 pm
by Frank Yaeger
Please use ubb code tags instead of attaching documents.

It appears that what you really want is to replace 'UDLbbxxx' in positions 48-55 with 'xxxbbbbb' (b for blank). If so, then you can use these DFSORT control statements:

  OPTION COPY                                                   
  INREC IFTHEN=(WHEN=(48,5,CH,EQ,C'UDL  '),OVERLAY=(48:53,3,5X))


If that's not what you want to do, then you need to do a better job of explaining exactly what it is you want to do.

Re: FINDREPL or something else

PostPosted: Wed Apr 07, 2010 10:53 pm
by Asa
if the field contains this:
UDL 450
471
UDL 431
420

I want the result to be
450
471
431
420 and keeping the positions for the rest of the record

Re: FINDREPL or something else

PostPosted: Wed Apr 07, 2010 11:31 pm
by Frank Yaeger
The DFSORT job I gave you does that assuming the UDL field starts in position 48 (as shown in your attachment). Does it?

It appears that what you really want is to replace 'UDLbbxxx' in positions 48-55 with 'xxxbbbbb' (b for blank).


Is that what you want? If not, what exactly do you want? Where does the UDL field start? How long is it?
Also, what is the RECFM and LRECL of the input file?

Did you try running the job I gave you? What results did you get? I can only guess at your input and output since you seem to be unwilling to use ubb code tags to show what they really look like, and/or give the position/length of the field.

Re: FINDREPL or something else

PostPosted: Thu Apr 08, 2010 1:16 pm
by Asa
I'm sorry I don't know what ubb code tags is

I did not read your message yesterday when I was still at work.

I've now tried your suggested IFTHEN and it works perfect - thank you very much!


BR
Ã…sa

Re: FINDREPL or something else

PostPosted: Thu Apr 08, 2010 9:28 pm
by Frank Yaeger
ubb code tags are like this, but you actually use [ and ] instead of < and >:

<code>
your code
</code>

It's basically just a fixed-font so it preserves the spacing - for example:

   SORT FIELDS=(5,4,CH,A)
   INREC IFOUTLEN=20,
      IFTHEN=(WHEN=INIT,
         OVERLAY=(20:C'ABC'))