ActionWare400 Technical Notes
Check for Program Existence

On the AS/400, RPG programs may not be loaded more than one time in a
job invocation stack, ie they may not be called recursively.  TM/400 provides
standard program that can be called to determine if a specified program is
already in existence in the job invocation stack.

The program is AMCHKA with two parameters: program name (character 10) and
a return code=Y/N (character 1).

To determine if TM/400 is already loaded in the user's current job, use the
following check:

          CALL TM4/AMCHKA ('AM015' &YESNO)

The program will return a 'Y' if the ActionWare400 main program (AM015) is
already loaded.

The AMCHKA program exists in all TM/400 V5 libraries and is available for use
by user application programs.  Users may copy it to their own library or use it
from any of the TM/400 libraries (typically TM4 or TM4L).  It may be called
from CL or RPG or from any other AS/400 language that can call an RPG
program.  The program being tested for does not have to identified by its
library location, just the program name is needed.

Last Updated:  January, 1996