Command reference / prog

CRTCBLPGM

Create COBOL Program

The CRTCBLPGM command compiles a COBOL source program into a program object. You can use this command interactively, in batch mode, or in a CL program. All object names specified for the CRTCBLPGM command must be composed of alphanumeric characters, the first of which must be alphabetic. The names cannot exceed 10 characters in length.

Allowed environments: *ALL. Positional parameters: 5.

Parameters

PGM Program

Specifies the program name and library name for the COBOL program object you are creating. The possible values are: The possible library values are:

Type
*QUAL
Required
No
Case
Uppercase
*PGMID
The name for the program object is taken from the PROGRAM-ID paragraph in the COBOL source program.
program-name
Enter a name to identify the compiled COBOL program. If you specify a program name for this parameter, and run the compilation in batch mode, the first program in the batch job uses this name; any other programs use the name specified in the PROGRAM-ID paragraph in the source program.
*CURLIB
If you do not specify a library name, the current library is used. If you have not assigned a library as the current library, QGPL is used.
library-name
Enter the name of the library to contain the created program object.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Program Program

Type
*NAME
Required
No
Default
*PGMID
Length
10
Case
Uppercase

Suggested / special values: *PGMID

Library Library

Type
*NAME
Required
No
Default
*CURLIB
Length
10
Case
Uppercase

Suggested / special values: *CURLIB

SRCFILE Source file

Specifies the name of the source file that contains the COBOL source to be compiled. The possible values are: The possible library values are:

Type
*QUAL
Required
No
Case
Uppercase
QLBLSRC
The IBM-supplied source file, QLBLSRC, contains the COBOL source to be compiled.
source-file-name
Enter the name of the source file that contains the COBOL source to be compiled. This source file should have a record length of 92.
*LIBL
If you do not specify a library name, the system searches the library list to find the library where the source file is located.
*CURLIB
The current library is used. If you have not assigned a library as the current library, QGPL is used.
library-name
Enter the name of the library where the source file is located.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Source file Source file

Type
*NAME
Required
No
Default
QCBLSRC
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

SRCMBR Source member

Specifies the name of the member that contains the COBOL source to be compiled. You can specify this parameter only if the source file referred to in the SRCFILE parameter is a database file. The possible values are:

Type
*NAME
Required
No
Default
*PGM
Length
10
Case
Uppercase

Suggested / special values: *PGM

*PGM
If you specified a program name for the PGM parameter, the compiler looks for the source program in a member having the same name as the program, and creates an object program with the same name as the program and member. If you did not specify a program name for the PGM parameter, the compiler looks for the program source in the first member of the database source file, and creates an object program using the name specified in the PROGRAM-ID paragraph.
source-file-member-name
Enter the name of the member that contains the COBOL source.

OPTION Compiler options

Specifies the options to use when the COBOL source is compiled. The possible values are:

Type
*CHAR
Required
No
Length
10
List limit
50
Case
Uppercase

Suggested / special values: *SOURCE, *NOSOURCE, *SRC, *NOSRC, *NOXREF, *XREF, *GEN, *NOGEN, *NOSEQUENCE, *SEQUENCE, *NOVBSUM, *VBSUM, *NONUMBER, *NUMBER, *LINENUMBER, *NOMAP, *MAP, *NOOPTIONS, *OPTIONS, *QUOTE, *APOST, *SECLVL, *NOSECLVL, *PRTCORR, *NOPRTCORR, *NOSRCDBG, *SRCDBG, *NOLSTDBG, *LSTDBG, *PRINT, *NOPRINT

*SOURCE
The compiler produces a source listing, consisting of the COBOL source code and all compilation-time error messages.
*SRC
The compiler produces a source listing, consisting of the COBOL source code and all compilation-time error messages.
*NOSOURCE
The compiler does not produce the source part of the listing. If you do not require a source listing, you should use this option because compilation may take less time.
*NOSRC
The compiler does not produce the source part of the listing. If you do not require a source listing, you should use this option because compilation may take less time.
*NOXREF
The compiler does not produce a cross-reference listing for the source program.
*XREF
The compiler produces a cross-reference listing for the source program.
*GEN
The compiler creates a program object after the source program is compiled.
*NOGEN
The compiler does not create a program object after the source program is compiled. You might specify this option if you want only error listings at this time.
*NOSEQUENCE
The reference numbers are not checked for sequence errors.
*SEQUENCE
The reference numbers are checked for sequence errors. Sequence errors do not occur if the *LINENUMBER option is specified.
*NOVBSUM
Verb-usage counts are not printed.
*VBSUM
Verb-usage counts are printed.
*NONUMBER
The source-file sequence numbers are used for reference numbers.
*NUMBER
The user-supplied sequence numbers (columns 1 through 6) are used for reference numbers.
*LINENUMBER
The sequence numbers created by the compiler are used for reference numbers. This option combines program source code and source code introduced by COPY statements into one consecutively numbered sequence. Use this option if you specify FIPS (Federal Information Processing Standards) flagging or SAA* flagging.
*NOMAP
The compiler does not list the Data Division map.
*MAP
The compiler lists the Data Division map.
*NOOPTIONS
Options in effect are not listed for this compilation.
*OPTIONS
Options in effect are listed for this compilation.
*QUOTE
Specifies that the delimiter quotation mark (") is used for nonnumeric literals and Boolean literals. This also specifies that the value of the figurative constant QUOTE has the EBCDIC value of a quotation mark.
*APOST
Specifies that the delimiter apostrophe (') is used for nonnumeric literals and Boolean literals. This also specifies that the value of the figurative constant QUOTE has the EBCDIC value of an apostrophe.
*NOSECLVL
Second level message text is not listed for this compilation.
*SECLVL
Second level message text is listed for this compilation.
*PRTCORR
The compiler inserts comment lines in the compiler listing indicating which elementary items were included as a result of the use of the CORRESPONDING phrase.
*NOPRTCORR
The compiler does not insert comment lines in the compiler listing when the CORRESPONDING phrase is used.
*NOSRCDBG
This option determines the kind of information you see on your programmable work station when using client tooling to compile your COBOL programs. The compiler does not produce source-level debugging information. If *NOLSTDBG is also in effect, the compiler does not produce source-level error information either.
*SRCDBG
This option determines the kind of information you see on your programmable work station when using client tooling to compile your COBOL programs. The compiler produces source-level error information and source-level debugging information. You cannot specify *SRCDBG and *LSTDBG together. Specify one or the other.
*NOLSTDBG
This option determines the kind of information you see on your programmable work station when using client tooling to compile your COBOL programs. The compiler does not produce a listing view, or listing-level debugging information. If *NOSRCDBG is also in effect, the compiler does not produce source-level error information either.
*LSTDBG
This option determines the kind of information you see on your programmable work station when using client tooling to compile your COBOL programs. The compiler produces a listing view, source-level error information, and listing-level debugging information. You cannot specify *SRCDBG and *LSTDBG together. Specify one or the other.
*PRINT
The compiler produces a spool listing.
*NOPRINT
The compiler does not produce a spool listing.

GENOPT Generation options

Specifies the options to use when the program object is created. The listings could be required if a problem occurs in COBOL. The possible values are:

Type
*CHAR
Required
No
Length
12
List limit
50
Case
Uppercase

Allowed values: *NOLIST, *LIST, *NOXREF, *XREF, *NOPATCH, *PATCH, *NODUMP, *DUMP, *NOATR, *ATR, *RANGE, *NORANGE, *UNREF, *NOUNREF, *NOOPTIMIZE, *OPTIMIZE, *NODDSFILLER, *DDSFILLER, *NOSYNC, *SYNC, *NOCRTF, *CRTF, *NODUPKEYCHK, *DUPKEYCHK, *STDERR, *NOSTDERR, *NOEXTACCDSP, *EXTACCDSP, *NOINZDLT, *INZDLT, *NOBLK, *BLK, *STDINZ, *NOSTDINZ, *FS21DUPKY, *NOFS21DUPKY

*NOLIST
No IRP (intermediate representation of program), associated hexadecimal code, or error messages are listed.
*LIST
The IRP, its associated hexadecimal code, and any error messages are listed.
*NOXREF
Does not produce a cross-reference listing of the objects defined in the IRP.
*XREF
Produces a cross-reference listing of all objects defined in the IRP.
*NOPATCH
Does not reserve space in the compiled program for a program patch area.
*PATCH
Reserves space in the compiled program for a program patch area. The program patch area can be used for debugging purposes.
*NODUMP
Does not list the program template.
*DUMP
Lists the program template.
*NOATR
Does not list the attributes for the IRP source.
*ATR
Lists the attributes for the IRP source.
*RANGE
At run-time, the system verifies that subscripts are within the correct ranges, but does not verify index ranges. It also checks for reference modification and compiler-generated substring operations.
*NORANGE
Does not verify ranges at run-time.
*UNREF
Includes unreferenced data items in the compiled program.
*NOUNREF
Does not include unreferenced data items in the compiled program. This reduces the number of ODT (object definition table) entries used, allowing a larger program to be compiled. The unreferenced data items still appear in the cross-reference listings produced through the *XREF option.
*NOOPTIMIZE
The compiler performs only standard optimizations for the program.
*OPTIMIZE
The program object created may run more efficiently, and may require less storage. However, specifying *OPTIMIZE can substantially increase the time required to compile a program.
*NODDSFILLER
If no matching fields are found by a COPY DDS statement, no field descriptions are created.
*DDSFILLER
When no matching fields are found by a COPY DDS statement, a single character FILLER field description, "07 FILLER PIC X", is always created.
*NOSYNC
The SYNCHRONIZED clause is syntax checked.
*SYNC
The SYNCHRONIZED clause causes the alignment of an elementary item on a natural boundary in storage.
*NOCRTF
Files that are unavailable at the time of an OPEN operation are not created dynamically.
*CRTF
Files that are unavailable at the time of an OPEN operation are created dynamically.
*NODUPKEYCHK
Does not check for duplicate keys for INDEXED files.
*DUPKEYCHK
Checks for duplicate keys for INDEXED files.
*STDERR
Standard error handling is used. See the chapter on error handling in the COBOL/400 User's Guide for more information about error handling.
*NOSTDERR
The error handling method of Version 1, Releases 1 and 2, is used. See the chapter on error handling in the COBOL/400 User's Guide for more information about error handling.
*NOEXTACCDSP
The compiler does not allow extended ACCEPT or extended DISPLAY statements.
*EXTACCDSP
The compiler allows extended ACCEPT and extended DISPLAY statements.
*NOINZDLT
Relative files with sequential access are not initialized with deleted records during the CLOSE operation if the files were opened for OUTPUT. That is, the record boundary is determined by the number of records written at OPEN OUTPUT time. Subsequent OPEN operations allow access only up to the record boundary.
*INZDLT
Relative files with sequential access are initialized with deleted records during the CLOSE operation if the files were opened for OUTPUT. Active records in the files are not affected. That is, the record boundary is defined as the file size for subsequent OPEN operations.
*NOBLK
The compiler allows blocking only of SEQUENTIAL access files with no START statement. If a BLOCK CONTAINS clause is specified, the BLOCK CONTAINS clause is ignored, except for tape files.
*BLK
When used with BLOCK CONTAINS, the compiler allows blocking from DYNAMIC access files and SEQUENTIAL access files with a START statement. Blocking is not allowed for RELATIVE files opened for output operations. The BLOCK CONTAINS clause controls the number of records to be blocked. When no BLOCK CONTAINS clause is specified, the compiler allows blocking only of SEQUENTIAL access files with no START statement. The operating system determines the number of records to be blocked.
*STDINZ
The compiler initializes data items to system defaults, provided that the items are not subject to a VALUE clause.
*NOSTDINZ
For those items with no VALUE clause, the compiler does not initialize data items to system defaults.
*FS21DUPKY
The compiler reports a file status of 21 when processing an indexed file with duplicate keys in random or dynamic access mode, if the value of the key is changed between the mandatory READ statement and a following REWRITE or DELETE statement.
*NOFS21DUPKY
The compiler does not report a file status of 21 when processing an indexed file with duplicate keys in random or dynamic access mode. A REWRITE statement can change the key of a record.

GENLVL Generation severity level

Specifies the severity level that determines if a program object is created. The severity level corresponds to the severity level of the messages produced during compilation of the program. If the severity level of error messages is greater than the value you specify, a program object is not created. For example, if you specify 19 for this parameter, a program object is not created if the severity level of any of the messages is 20 or greater. The possible values are:

Type
*INT2
Required
No
Default
29
Range
0 to 29
Case
Uppercase
29
If errors occur with a severity level greater than 29, no program object is created.
severity-level
Specify a one or two-digit number, 0 through 29. If errors occur with a severity level greater than this level, no program object is created.

TEXT Text 'description'

A brief description of the program and its function. The possible values are:

Type
*CHAR
Required
No
Default
*SRCMBRTXT
Length
50
Case
Mixed case

Suggested / special values: *SRCMBRTXT, *BLANK

*SRCMBRTXT
Use the same text for the program object as that which describes the database file member containing the COBOL source. If the source comes from a device or in-line file, specifying *SRCMBRTXT has the same effect as specifying *BLANK.
*BLANK
No text is specified.
text-description
Enter the text that briefly describes the program and its function. The text can be a maximum of 50 characters in length and must be enclosed in apostrophes. The apostrophes are not part of the 50-character string.

REPLACE Replace program

Specifies if a new program object is created when a program object of the same name in the same library already exists. The possible values are:

Type
*CHAR
Required
No
Default
*YES
Length
4
Case
Uppercase

Allowed values: *YES, *NO

*YES
A new program object is created and any existing program object of the same name in the specified library is moved to library QRPLOBJ.
*NO
A new program object is not created if a program object of the same name already exists in the specified library.

TGTRLS Target release

Specifies the release level of the operating system on which you intend to use the object being created. You can specify an exact release level in the format VxRxMx, where Vx is the version, Rx is the release, and Mx is the modification level. For example, V3R1M0 is Version 3, Release 1, Modification level 0. Note: To use the object on the target system, you must save the object to the target release level specified on the create command and then restore it on the target system. For example, if your system is running V3R1M0 and you want to create a program object for distribution to a V2R3M0 system, you must create the program with TGTRLS(V2R3M0) or TGTRLS(*PRV), save the program with TGTRLS(V2R3M0) or TGTRLS(*PRV), and restore the program on the V2R3M0 system. The program object can also be restored on a V3R1M0 system. Note: The program may be able to be restored on a release level earlier than the one you specified on the create command. Use DSPPGM to determine the earliest release the program can run.

Type
*CHAR
Required
No
Default
*CURRENT
Length
8
Case
Uppercase
*CURRENT
The object is to be used on the release of the operating system currently running on your system. For example, if V3R1M0 is running on the system, *CURRENT means you intend to use the object on a system with V3R1M0 installed. You can also use the object on a system with any subsequent release of the operating system installed.
*PRV
The object is to be used on the previous release with modification level 0 of the operating system. For example, if V3R1M0 is running on your system, *PRV means you intend to use the object on a system with V2R3M0 installed. You can also use the object on a system with any subsequent release of the operating system installed.
release-level
Specify the release in the format VxRxMx. The object can be used on a system with the specified release or with any subsequent release of the operating system installed. Valid values depend on the current version, release, and modification level, and they change with each new release. To see the list of valid values, press F4=Prompt on the TGTRLS parameter of the command.

USRPRF User profile

Specifies the user profile that will run the compiled COBOL program. The profile of the program owner or the program user is used to run the program and control which objects can be used by the program (including the authority the program has for each object). The possible values are:

Type
*CHAR
Required
No
Default
*USER
Length
6
Case
Uppercase

Allowed values: *USER, *OWNER

*USER
The user profile of the program user is to be used when the program is run.
*OWNER
The user profiles of both the program's owner and user are to be used when the program is run. The collective sets of object authority in both user profiles are to be used to find and access objects during the running of the program. Any objects that are created during the program are owned by the program's user.

AUT Authority

Specifies the authority given to users who do not have specific authority to the program object, who are not on the authorization list, or whose group has no specific authority to the program object. You can alter the authority for all users, or for specific users after the program object is created by using the GRTOBJAUT (Grant Object Authority) or RVKOBJAUT (Revoke Object Authority) commands. The possible values are:

Type
*NAME
Required
No
Default
*LIBCRTAUT
Length
10
Case
Uppercase

Suggested / special values: *LIBCRTAUT, *CHANGE, *ALL, *USE, *EXCLUDE

*LIBCRTAUT
The public authority for the object is taken from the CRTAUT keyword of the target library (the library that is to contain the created program object). This value is determined when the program object is created. If the CRTAUT value for the library changes after the program object is created, the new value does NOT affect any existing objects.
*ALL
Provides authority for all operations on the program object except those limited to the owner or controlled by authorization list management authority. The user can control the program object's existence, specify security for it, change it, and perform basic functions on it, but cannot transfer its ownership.
*CHANGE
Provides all data authority and the authority for performing all operations on the program object except those limited to the owner or controlled by object authority and object management authority. The user can change the object and perform basic functions on it, such as running and debugging the program object.
*USE
Provides object operational authority and read authority; authority for basic operations on the program object such as running the program. The user is prevented from changing the object. Note: A user must have *USE authority to a program to obtain a formatted dump of the variables of the program. To dump variables, the program must also have observable information. If you do not want some users to be able to dump the variables, then give them only *OBJOPR plus *EXECUTE authority to the program. This will allow them to call the program but not dump its variables. If you do not want any users to be able to dump the variables, then use Change Program (CHGPGM) to remove the program's observable information.
*EXCLUDE
The user cannot access the program object.
authorization-list-name
Enter the name of an authorization list of users and authorities to which the program is added. The program object is secured by this authorization list, and the public authority for the program object is set to *AUTL. The authorization list must exist on the system when the CRTCBLPGM command is issued.

PRTFILE Print file

Specifies the name of the file to which the compiler listing is directed and the library where the file is located. The file should have a minimum record length of 132. If a file with a record length less than 132 is specified, information is lost. The possible values are: The possible library values are:

Type
*QUAL
Required
No
Case
Uppercase
QSYSPRT
If you do not specify a file name, the compiler listing is directed to QSYSPRT, an IBM-supplied file.
file-name
Enter the name of the file to which the compiler listing is directed.
*LIBL
The system searches the library list to find the library where the file is located.
*CURLIB
The current library is used. If you have not assigned a library as the current library, QGPL is used.
library-name
Enter the name of the library in which the file is located.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Part 11-01

Type
*NAME
Required
No
Default
QSYSPRT
Length
10
Case
Uppercase

Part 11-11

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

Examples

CRTCBLPGM PGM(MYLIB/XMPLE1) SRCFILE(MYLIB/QLBLSRC) SRCMBR(XMPLE1) OPTION(*SOURCE) TEXT('My COBOL program')

This command calls the COBOL compiler to create a program named XMPLE1. The source program is in member XMPLE1 of source file QLBLSRC in library MYLIB. A compiler listing is created.

IBM command documentation

Generated from os/cl/catalog/CRTCBLPGM.json and os/cl/help/CRTCBLPGM.json.