Using the Create Program (CRTPGM) Command
The Create Program (CRTPGM) command creates a program object from one or
more previously created module objects and, if required, one or more service
programs. You can bind module objects created by any of the ILE Create
Module commands, CRTCBLMOD, CRTCMOD, CRTRPGMOD or CRTCLMOD.
Note:
In order to use the CRTPGM command, you must have authority to use the command
and the modules required must first have been created using the CRTCBLMOD,
CRTCMOD, CRTRPGMOD, or CRTCLMOD commands.
Before you create a program object using the CRTPGM command, do the following:
- Establish a program name.
- Identify the module object(s), and if required, service program(s) you
want to bind into a program object.
- Identify any binding directories you intend to use. Implicit references
to binding directories, for ILE COBOL runtime service programs and ILE bindable
APIs, are made from module objects created by CRTCBLMOD and CRTBNDCBL.
- Identify which module object's PEP will be used as the PEP for the program
object being created. Specify this module object in the ENTMOD parameter
of CRTPGM.
If you Specify ENTMOD(*FIRST) instead of explicitly identifying
a module object in the ENTMOD parameter, then the order in which the binding
occurs is important in deciding which module object has the PEP for the program
object being created. The module objects that you list in the MODULE parameter,
or those located through a binding directory, may contain one or more PEPs
when only one can be used. The order in which binding occurs is also important
for other reasons such as the resolution of symbols. For further information
on binding, refer to the ILE Concepts book.
- Establish whether the command will allow duplicate procedures and or variable
names.
You may be binding module objects into a program object that each
define the same variable names and procedure names in multiple different ways.
- Identify the activation group in which the program is run. Refer to Activation and Activation Groups for description of activation groups.
To create a program object using the CRTPGM command, perform the following
steps:
- Enter the CRTPGM command.
- Enter the appropriate values for the command parameters.
Table 1 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 iSeries Information Center at this Web site -http://www.ibm.com/eserver/iseries/infocenter.
Table 1. Parameters for CRTPGM Command and their Default Values
| 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)
ALWLIBUPD(*NO)
|
Once you have entered the CRTPGM command, the program object is created
as follows:
- Listed module objects are copied into what will become the program object.
- The module objects containing the PEP is identified and the first import
in this module is located.
- The module objects are checked in the order in which they are listed and
the first import is matched with a module export.
- The first module object is returned to and the next import is located.
- All imports in the first module object are resolved.
- The next module object is continued to and all imports are resolved.
- All imports in each subsequent module object are resolved until all of
the imports have been resolved.
- If OPTION(*RSLVREF) is specified and any imports cannot be resolved with
an export, the binding process terminates without creating a program object.
If OPTION(*UNRSLVREF) is specified then all imports do not need to be resolved
to exports for the program object to be created. If the program object uses
one of these unresolved imports at run time, a MCH4439 exception message is
issued.
- Once all the imports have been resolved, the binding process completes
and the program object is created.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.