"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> wrote on 02/21/2019
04:21:31 PM:
----- Message from Booth Martin <booth@xxxxxxxxxxxx> on Thu, 21 Feb
2019 15:21:26 -0600 -----


"RPG programming on the IBM i (AS/400 and iSeries)" <rpg400-


Re: Does the CLEAR operation on an input-only file do anything?

Lets say I successfully chain and get Jack's record with a field NAME =
'Jack'. Then lets say next up is Judy, and we chain to the file and no

record is found. What is the value of the NAME field in my program? I
guess what I am asking is, because of this coding, does that suggest
there is an unrecognized downstream problem?

Exactly. From the testing I've done, the value of NAME appears to stay
'Jack'. This is the problem I'm dealing with. I've reported the coding
error to the vendor. They are "Researching" the issue. I think the
confusion is that most of the time, they use CLEAR on a data structure. If
I read the manuals correctly, the fields in a data structure are always
cleared. But things are different when clearing a record format.

On 2/21/2019 2:52 PM, MichaelQuigley@xxxxxxxxxx wrote:
I've been working with what I would consider a bug in a vendor
program. They're processing a file conditioned on an optional field in
secondary file. The secondary file is specified as input-only,
described, and keyed. For each record in the primary file, they do a
to the secondary (input-only) file. Then the code is something like:


chain (keys) secondary-record;
if not %found;
clear secondary-record;


In the ILE RPG Reference Manual under Initialization Operations, it

"When these operation codes are applied to record formats, only fields
which are output are affected (if factor 2 is blank) or all fields (if
factor 2 is *ALL)."

Also in the manual under "Clearing Record Formats" and the CLEAR

if *ALL is not specified, only those fields with a usage of output or
are affected. All field-conditioning indicators of the record format
affected by the operation.

So am I correct in getting back to the vendor and telling them they
coding the CLEAR incorrectly? i.e., It should be coded:

clear *all secondary-record;

Michael Quigley
Computer Services
The Way International

This thread ...

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

This mailing list archive is Copyright 1997-2020 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].