Dan wrote:

> We have a need to zero out several fiels with data
> decimal errors, but cannot lock the file while doing
> so.  Also need to read into a DS to TESTN a *CHAR
> field, without a lock, then CHAIN back to the file
> and UPDAT from a DS where the *CHAR definition exists.
> From what I can tell, the read into DS scenario requires
> an internally defined file.
>
> Oh, and we are using RPGIII - as we have sites that are backlevel
> as far as V3R2, RPGIV is 'ix-nayed' for now.

You can probably do it much more simply than the way you are planning. If
you compile a program with IGNDECERR(*YES) invalid packed decimal fields
will be read in as zeroes, so you merely have to update them. I created a
file, ABCPF, with record format IABCPF and 2 fields: ZONE and PACK. I
created 3 invalid records loaded entirely with characters 'A', 'B' and
*BLANK respectively. After running the program the fields all contained
valid data. For the zoned fields 'A' had become '1', 'B' '2', and *BLANK
*ZERO. The packed fields were all zeroised. The complete program, which
uses the cycle, is produced below.

     FABCPF   UP  E                    DISK
     IIABCPF      01
     OIABCPF  D        01
     O                         ZONE
     O                         PACK

On the output specs you need only define the fields you actually want to
update. Obviously you will want to test the program on a copy of the file
first to make sure the results are what you expect!

Dave...
               _________  ,___o
             __________   _\ <;_
           ___________   (_)/ (_)       http://www.twickenhamcc.co.uk
=======================================================
The opinions expressed in this communication are my own and do not
necessarily reflect those of my employer.



This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.