That's correct CLEAR won't affect input only files unless *ALL is specified.
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of MichaelQuigley@xxxxxxxxxx
Sent: Thursday, February 21, 2019 3:52 PM
Subject: Does the CLEAR operation on an input-only file do anything?
I've been working with what I would consider a bug in a vendor supplied program. They're processing a file conditioned on an optional field in a secondary file. The secondary file is specified as input-only, externally described, and keyed. For each record in the primary file, they do a chain to the secondary (input-only) file. Then the code is something like:
chain (keys) secondary-record;
if not %found;
In the ILE RPG Reference Manual under Initialization Operations, it reads:
"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 operation
if *ALL is not specified, only those fields with a usage of output or both are affected. All field-conditioning indicators of the record format are affected by the operation.
So am I correct in getting back to the vendor and telling them they aren't coding the CLEAR incorrectly? i.e., It should be coded:
clear *all secondary-record;
The Way International
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com