On 9/10/2020 3:09 PM, Stanislawski, Shawn (National VM Capability) wrote:

> Anyone have a great idea on how to use PIPE to replace single record 
> at a specified record number in a file without having to read /
> write out the entire file, with the following caveats?
> 
>   *   the file could be either recfm FIXED or VARIABLE
>   *   the new record could potentially be either shorter or longer than its 
> original

If you want to pad or truncate as needed, probably the simplest way is
to convert V2C and then back C2V.  Assuming the input is numbered for
DISKUPDATE:

  (end /) ...
    | in: fanout
    | chop 10
    | copy
    | diskrandom fn ft fm
    | xlate 00-ff 40
    | out: specs 1-* v2c 11 select 1 1.10 1 11-* 13
    | specs 1.10 1 11-* c2v 11
    | diskupdate fn ft fm
    / in:
    | out:

I was always a little disappointed that COMBINE wouldn't truncate and
the f2V conversions wouldn't pad.  And speaking of V format, I don't
think I ever got around to complaining about this error way back:

> pipe literal 123| specs 1-* v2c 1.2 | cons        
> Output field too short to contain field length.
> ... Issued from stage 2 of pipeline 1.         
> ... Running "specs 1-* v2c 1.2".               
> Processing item number 1: 1-* v2c 1.2.         

The message is wrong, since 2 is just long enough to contain the field
length, but even if I asked for only one character I don't get why this
is an error.  V2B and V2X don't care if there's room for the output; why
should V2C?

Uh-oh.  I must never have tried THIS before:

> pipe literal 123| specs 1-* v2c 1.3 right | cons
>   1                                          

That's just wrong.

¬R

Reply via email to