John McKown wrote:

>> Groete / Greetings

>In my usual "left handed" way, I will recommend using "awk" in a UNIX step to 
>do this. It is easiest to do if you have Co:Z installed, but it can be done 
>using the IBM supplied UNIX commands. Yes, IBM awk can read a z/OS sequential 
>dataset. I have verified this on z/OS 1.12 and 2.3. Something like:

>//PS001   EXEC PGM=BPXBATCH,REGION=0M
>//*PARM='SH printenv '
>//STDOUT   DD SYSOUT=*
>//STDERR   DD SYSOUT=*
>//STDIN    DD DUMMY
>//STDPARM  DD *
>SH awk 'NR <= 2000 {n=sub(/ONE/,"TWO");print;}
>        NR > 2000 {n=sub(/./,"+");print  $0;}'
>    "//'fully-qualified-input-dataset'" |
>    cp /dev/fd/0 "//'existing-output-dataset'"
>//STDENV DD *
>/*

>The above will change the _first_ occurance of "ONE" to "TWO" if the relative 
>record number is less than or equal to 2000 (NR <= 2000). It will leave any 
>other occurrences on the line alone. It will simply copy the current record to 
>the output for all other records (NR > 2000). 

Excellent. Another improvement - Selective change actions based on other 
criterias.

I am aware of awk, but not this NR part. 

Thanks for your excellent contribution. Much appreciated!

Groete / Greetings
Elardus Engelbrecht

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to