The Create Program (CRTPGM) command creates a program object from one or more previously created modules and, if required, one or more service programs. You can bind modules created by any of the ILE Create Module commands, CRTRPGMOD, CRTCMOD, CRTCBLMOD, or CRTCLMOD.
Before you create a program object using the CRTPGM command, you should:
You indicate which module contains the program entry procedure through the ENTMOD parameter of CRTPGM. The default is ENTMOD(*FIRST), meaning that the module containing the first program entry procedure found in the list for the MODULE parameter is the entry module.
Assuming you have only one module with a main procedure, that is, all modules but one have NOMAIN specified, you can accept the default (*FIRST). Alternatively, you can specify (*ONLY); this will provide a check that in fact only one module has a main procedure. For example, in both of the following situations you could specify ENTMOD(*ONLY).
Specify the named activation group QILE if your program has no special requirements or if you are not sure which group to use. In general, it is a good idea to run an application in its own activation group. Therefore, you may want to name the activation group after the application.
Note that the default activation group for CRTPGM is *NEW. This means that your program will run in its own activation group, and the activation group will terminate when the program does. Whether or not you set on LR, your program will have a fresh copy of its data the next time you call it. For more information on activation groups see Specifying an Activation Group.
To create a program object using the CRTPGM command, perform the following steps:
Table 32 lists the CRTPGM command parameters and their default values. For a full description of the CRTPGM command and its parameters, refer to the CL and APIs section of the Programming category in the i5/OS Information Center at this Web site - http://www.ibm.com/systems/i/infocenter/.
Parameter Group | Parameter(Default Value) |
---|---|
Identification |
PGM(library name/program name) MODULE(*PGM) |
Program access | ENTMOD(*FIRST) |
Binding |
BNDSRVPGM(*NONE) BNDDIR(*NONE) |
Run time | ACTGRP(*NEW) |
Miscellaneous |
OPTION(*GEN *NODUPPROC *NODUPVAR *WARN *RSLVREF) DETAIL(*NONE) ALWUPD(*YES) ALWRINZ(*NO) REPLACE(*YES) AUT(*LIBCRTAUT) TEXT(*ENTMODTXT) TGTRLS(*CURRENT) USRPRF(*USER) |
Once you have entered the CRTPGM command, the system performs the following actions: