On Thu, Mar 28, 2019 at 2:52 AM Elardus Engelbrecht <
[email protected]> wrote:
> Hi to all,
>
> I've got a requirement where a single line in large dataset (RECFM=VB or
> FB and LRECL=<larger than 2048>) needs to be edited/changed in batch.
> Changed dataset is then to be used in next job steps.
>
> Sounds easy? Interactively with TSO yes, but they want it to be done in a
> batch job.
>
> Something like c '???' '!!!' which can be easily done interactively.
>
> I have a look at the different utilities. One utility I could find useful
> is the EDIT and CHANGE commands running under IKJEFT.
>
> Unfortunately those IKJEFT01 commands require that the dataset lines need
> to be numbered.
>
> I tried it out:
>
> READY
> EDIT '??.TEST' OLD TEXT ASIS NONUM
> EDIT
> CHANGE 1 2000 'ONE' 'TWO'
> IKJ52502I DATA SET NOT LINE NUMBERED
> EDIT
> END
>
> The IKJ52502I is not what I want. Is there a batch utility where I can
> edit a line in large dataset?
>
> I am very sure I am overlooking something obvious.
>
> Many thanks in advance.
>
> Groete / Greetings
> Elardus Engelbrecht
>
>
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). It would be
easiest to do this if you preallocate the output dataset. Perhaps in a
previous IEFBR14 step. Yes, "cp" can create a new sequential dataset. It is
a PITA and I didn't want to bother with it.
--
I just burned 2000 calories!
That's the last time I'll nap with brownies in the oven.
Maranatha! <><
John McKown
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN