From the RPG manual:
"The EXTIND keyword indicates whether the file is used in the program
depending on the value of the external indicator.
EXTIND lets the programmer control the operation of input, output, update,
and combined files at run time. If the specified indicator is on at program
initialization, the file is opened. If the indicator is not on, the file is
not opened and is ignored during processing. The *INU1 through *INU8
indicators can be set as follows:
* By the i5/OS control language.
* When used as a resulting indicator for a calculation operation or as field
indicators on the input specifications. Setting the *INU1 through *INU8
indicators in this manner has no effect on file conditioning."
IOW whatever indicator is on at the START of the pgm, that file will open.
I have used this technique before on a S/34 (if I remember correctly)
utilizing 2 primary files. I think that should still work.
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jerry Adams
Sent: Thursday, August 21, 2008 1:50 PM
To: Midrange-RPG (rpg400-l@xxxxxxxxxxxx)
Subject: Cycling - MUltiple Input Files
I have two RPG IV programs that are, for the most part, identical. While
there are a few additional bits of logic in the second one, the primary
difference is that the primary input file has a different record length.
What I would like to do is use the EXTIND(*INUx) keyword to condition the
two files; one as IPE the other as ISE. The CL that drives this would set
the appropriate switch. What I am not sure about is whether or not this is
permissible; can't recall ever doing this in even RPG II, and the manual
didn't answer the question. I can simply make the changes and see what
happens, but I thought if anyone knew that this won't fly it was save me
Changing the files to IF and USROPN, while perhaps possible, would not be
the best option if the former idea would work.
I really would like to merge these into a single program to cut down on the
Jerry C. Adams
IBM System i Programmer/Analyst