ILE COBOL Programmer's Guide


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:

  1. Establish a program name.
  2. Identify the module object(s), and if required, service program(s) you want to bind into a program object.
  3. 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.
  4. 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.

  5. 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.

  6. 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:

  1. Enter the CRTPGM command.
  2. 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 400 Information Center at this Web site -http://publib.boulder.ibm.com/pubs/html/as400/infocenter.htm.

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:

  1. Listed module objects are copied into what will become the program object.
  2. The module objects containing the PEP is identified and the first import in this module is located.
  3. The module objects are checked in the order in which they are listed and the first import is matched with a module export.
  4. The first module object is returned to and the next import is located.
  5. All imports in the first module object are resolved.
  6. The next module object is continued to and all imports are resolved.
  7. All imports in each subsequent module object are resolved until all of the imports have been resolved.
  8. 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.
  9. Once all the imports have been resolved, the binding process completes and the program object is created.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]