Create RPG/400 Program (CRTRPGPGM)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The command Create RPG Program (CRTRPGPGM) is used to start the RPG/400 compiler.

Top

Parameters

Keyword Description Choices Notes
PGM Program Qualified object name Optional, Positional 1
Qualifier 1: Program Name, *CTLSPEC
Qualifier 2: Library Name, *CURLIB
SRCFILE Source file Qualified object name Optional, Positional 2
Qualifier 1: Source file Name, QRPGSRC
Qualifier 2: Library Name, *LIBL, *CURLIB
SRCMBR Source member Name, *PGM Optional, Positional 3
GENLVL Generation severity level 0-99, 9 Optional
TEXT Text 'description' Character value, *SRCMBRTXT, *BLANK Optional
OPTION Source listing options Values (up to 14 repetitions): *SOURCE, *NOSOURCE, *SRC, *NOSRC, *XREF, *NOXREF, *GEN, *NOGEN, *DUMP, *NODUMP, *SECLVL, *NOSECLVL, *SRCDBG, *NOSRCDBG, *LSTDBG, *NOLSTDBG Optional
GENOPT Generation options Values (up to 10 repetitions): *LIST, *NOLIST, *XREF, *NOXREF, *ATR, *NOATR, *DUMP, *NODUMP, *PATCH, *NOPATCH, *OPTIMIZE, *NOOPTIMIZE Optional
INDENT Source listing indentation Character value, *NONE Optional
CVTOPT Type conversion options Single values: *NONE
Other values (up to 3 repetitions): *DATETIME, *VARCHAR, *GRAPHIC
Optional
SRTSEQ Sort sequence Single values: *HEX, *JOB, *JOBRUN, *LANGIDUNQ, *LANGIDSHR
Other values: Qualified object name
Optional
Qualifier 1: Sort sequence Name
Qualifier 2: Library Name, *LIBL, *CURLIB
LANGID Language identifier Name, *JOBRUN, *JOB Optional
SAAFLAG SAA flagging *NOFLAG, *FLAG Optional
PRTFILE Print file Qualified object name Optional
Qualifier 1: Print file Name, QSYSPRT
Qualifier 2: Library Name, *LIBL, *CURLIB
REPLACE Replace program *YES, *NO Optional
TGTRLS Target release Simple name, *CURRENT, *PRV Optional
USRPRF User profile *USER, *OWNER Optional
AUT Authority Name, *LIBCRTAUT, *ALL, *CHANGE, *USE, *EXCLUDE Optional
PHSTRC Phase trace *NO, *YES Optional
ITDUMP Intermediate text dump Character value, *NONE Optional
SNPDUMP Snap dump Character value, *NONE Optional
CODELIST Codelist Character value, *NONE, *ALL Optional
IGNDECERR Ignore decimal data error *NO, *YES Optional
ALWNULL Allow null values *NO, *YES Optional
Top

Program (PGM)

Specifies the program name and library for the compiled RPG program.

*CTLSPEC
The program name indicated in positions 75 - 80 of the Control specification.
program-name
Enter the name by which the program will be known.
*CURLIB
The current library will be used. If you have not specified a current library, QGPL will be used.
library-name
Enter the name of the library where the compiled program is to be stored.
Top

Source file (SRCFILE)

Specifies the name of the source file that contains the source program.

QRPGSRC
The default source file, QRPGSRC, contains the RPG program to be compiled.
source-file-name
Enter the source file name that contains the RPG source program to be compiled.
*LIBL
The system searches the library list to find the library where the source file is located.
*CURLIB
The current library will be used. If you have not specified a current library, QGPL will be used.
library-name
Enter the name of the library where the source file is located.
Top

Source member (SRCMBR)

Specifies the name of the member of the source file.

*PGM
The name specified by the PGM parameter as the source file member name.
source-file-member-name
Enter the name of the member that contains the source program.
Top

Generation severity level (GENLVL)

Specifies the diagnostic-message severity level at which creation of a program object stops.

9
The default severity level is 9.
severity-level-value
Enter a two-digit number 01 through 50.
Top

Text 'description' (TEXT)

Specifies what text is used to describe the program function.

*SRCMBRTXT
Use the text description from the source file member.
*BLANK
No text appears.
Top

Source listing options (OPTION)

Specifies options to use when the source program is compiled.

*SOURCE or *SRC
The compiler supplies a source listing.
*NOSOURCE or *NOSRC
The compiler does not supply a source listing.
*XREF
The compiler supplies a cross-reference listing.
*NOXREF
The compiler does not supply a cross-reference listing.
*GEN
A program object is created that can be run after the program compiles.
*NOGEN
No program object is created.
*NODUMP
The program template does not print when an error occurs.
*DUMP
The program template prints when an error occurs.
*NOSECLVL
Message text is not printed.
*SECLVL
Message text is printed.
*NOSRCDBG
Do not produce source-level debugging information. Source-level error information will not be created unless *LSTDBG is specified.
*SRCDBG
The compiler produces source-level error information and source-level debugging information for use with CoOperative Development Environment/400 (CODE/400). Source-level or listing-level debugging information is also necessary if you want to use the system debugger (STRDBG OPMSRC(*YES)) to debug OPM and ILE programs at the same time.

You cannot specify *SRCDBG and *LSTDBG together. Specify one or the other.

*NOLSTDBG
Do not produce a listing view or listing-level debugging information. Source-level error information will not be created unless *SRCDBG is specified.
*LSTDBG
The compiler produces a listing view, source-level error information, and listing-level debugging information for use with CoOperative Development Environment/400 (CODE/400). Source-level or listing-level debugging information is also necessary if you want to use the system debugger (STRDBG OPMSRC(*YES)) to debug OPM and ILE programs at the same time.

You cannot specify *SRCDBG and *LSTDBG together. Specify one or the other.

Top

Generation options (GENOPT)

Specifies options to use to create object code.

*NOLIST
Does not supply the intermediate representation of the program (IRP) listing.
*LIST
Lists the intermediate representation of the program (IRP).
*NOXREF
No cross-reference listing is supplied for the intermediate representation of the program (IRP).
*XREF
Supplies a cross-reference listing of all objects defined in the intermediate representation of the program (IRP).
*NOATR
Does not supply an attribute listing.
*ATR
Lists the attributes for the intermediate representation of a program (IRP) source program.
*NODUMP
Does not print the program template when an error occurs.
*DUMP
Prints a program template.
*NOPATCH
Does not reserve a program patch area in the compiled program.
*PATCH
Reserves space in the compiled program for a program patch area.
*NOOPTIMIZE
The compiler will not perform program optimization.
*OPTIMIZE
The compiler creates a program for more efficient processing.
Top

Source listing indentation (INDENT)

Specifies that DO statements and IF-ELSE clauses will be indented for readability. Also specifies what character is used to connect corresponding DO-ENDDO pairs and IF-ELSE pairs.

*NONE
Listings are not indented within DO statements or IF-ELSE clauses.
character-string
Use the given character string to connect corresponding nesting level.
Top

Type conversion options (CVTOPT)

Specifies how the RPG/400 compiler handles date, time, and timestamp database data types, and variable-length data types which are retrieved from externally-described files.

*NONE
Date, time, timestamp and variable-length database data types are ignored and not accessible in the RPG/400 program.
*DATETIME
Date, time, and timestamp database data types are to be declared as fixed-length character fields and are accessible in the RPG/400 program.
*VARCHAR
Variable-length database data types are to be declared as fixed-length character fields and are accessible in the RPG/400 program.
*GRAPHIC
DBCS-graphic data types are to be declared as fixed length character fields and are accessible in the RPG/400 program.

Note: Choose both of the parameters *VARCHAR and *GRAPHIC if you want variable-length DBCS graphic data types to be declared in your program.

Top

Sort sequence (SRTSEQ)

Specifies the sort sequence table to be used.

Note: To use the values coded in the SRTSEQ and LANGID parameters of the CRTRPGPGM or CRTRPTPGM command, you must specify D in the Alternate-Collating-Sequence field on the Control specification. The alternate collating sequence is retrieved from the system either at compile time or run time. If you use the D option, the alternate collating sequence affects: all character comparison operations; LOKUP and SORTA for character table and arrays; and sequence checking for character compile-time data, and pre-run-time arrays and tables. When the alternate sequence is retrieved at run time, sequence-checking for compile-time data is delayed until run time.

*HEX
The hexadecimal values of the characters are used to determine the sort sequence. This is the default.
*JOB
Uses the SRTSEQ value associated with the job when the RPG program is created.
*JOBRUN
Uses the SRTSEQ value associated with the job when the RPG program is run.
*LANGIDUNQ
Uses a unique weighted table. This special value is used in conjunction with the LANGID parameter to select the sort sequence table.
*LANGIDSHR
Uses a shared weighted table. This special value is used in conjunction with the LANGID parameter to select the sort sequence table.
sort-sequence-table-name
Enter the name of the sort sequence table.
*LIBL
The compiler searches the library list to find the library where the sort sequence table is located. This is the default.
*CURLIB
The current library is searched to find the sort sequence table. If you have not specified a current library, QGPL is used.
library-name
Enter the name of the library where the sort sequence table is located.
Top

Language identifier (LANGID)

Specifies the language identifier to be used when the sort sequence is *LANGIDUNQ or *LANGIDSHR. The LANGID parameter is used in conjunction with the SRTSEQ parameter to select the sort sequence table.

*JOBRUN
Uses the LANGID value associated with the job when the RPG program is run. This is the default.
*JOB
Uses the LANGID value associated with the job when the RPG program is created.
language-identifier
Enter the language identifier to be used (for example, FRA for French and DEU for German).
Top

SAA flagging (SAAFLAG)

Specifies if there will be flagging of specifications not supported by SAA RPG.

*NOFLAG
No flagging will be performed.
*FLAG
Flagging will be performed.
Top

Print file (PRTFILE)

Specifies the name of the file where the compiler listing is to be placed and the library where the file is located.

QSYSPRT
The compiler listing is placed in the QSYSPRT file.
file-name
Enter the name of the file where the compiler listing is to be placed.
*LIBL
The system searches the library list to find the library.
*CURLIB
The current library will be used. If you have not specified a current library, QGPL will be used.
library-name
Enter the name of the library where the file is located.
Top

Replace program (REPLACE)

Specifies if a new program object will be created when there is an existing program object of the same name in the same library.

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

Target release (TGTRLS)

Specifies the release of the operating system on which you intend to use the object being created. In the examples given for the *CURRENT and *PRV values, and when specifying the target-release value, the format VxRxMx is used to specify the release, where Vx is the version, Rx is the release, and Mx is the modification level. For example, V2R3M0 is version 2, release 3, modification level 0.

Valid values for this parameter change every release.

The possible values are:

*CURRENT
The object is to be used on the release of the operating system currently running on your system. For example, if V2R3M5 is running on the system, *CURRENT means that you intend to use the object on a system with V2R3M5 installed. You can 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 V2R3M5 is running on your system, *PRV means you intend to use the object on a system with V2R2M0 installed. You can also use the object on a system with any subsequent release of the operating system installed.
target-release
Specify the release in the format VxRxMx. You can use the object 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. If you specify a release-level that is earlier than the earliest release level supported by this command, an error message is sent indicating the earliest supported release.

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.

Top

User profile (USRPRF)

Specifies the user profile under which the compiled RPG program runs.

*USER
The program runs under the user profile of the program's user.
*OWNER
The program runs under the user profiles of both the program's owner and user. The USRPRF parameter will not be updated if the program already exists.
Top

Authority (AUT)

Specifies what authority is granted for the program.

*LIBCRTAUT
The default public authority for created objects is taken from the CRTAUT keyword which is associated with the target library. The value is determined at create time. If the value of the CRTAUT keyword of the library changes after the create, the new value will not affect any existing objects.
*ALL
Complete authority for the program except for transfer of object ownership.
*CHANGE
All operations are permitted except those dealing with the object's existence and its management.
*USE
Authority to read or run the compiled program, but not debug or change it.

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
No authority.
authorization-list name
The name of the authorization list which secures the object. The public authority will be *AUTL.
Top

Phase trace (PHSTRC)

Specifies if phase trace information about the compiler is to be included in the listing.

*NO
Does not provide compiler phase information.
*YES
Provides compiler phase information.
Top

Intermediate text dump (ITDUMP)

Specifies creation of the dynamic listing of intermediate text.

*NONE
Does not supply intermediate text dump.
phase-name
Enter the last two characters of each phase name.
Top

Snap dump (SNPDUMP)

Specifies if a listing of major data area and intermediate text is supplied.

*NONE
Does not supply a snap dump.
phase-name
Enter the last two characters of each phase name.
Top

Codelist (CODELIST)

Specifies if a dynamic listing of IRP is supplied for a specific phase.

*NONE
Does not supply an intermediate IRP dump.
*ALL
Supplies an intermediate IRP dump.
phase-name
Enter the last two characters of each phase name.
Top

Ignore decimal data error (IGNDECERR)

Specifies if decimal data errors are ignored.

*NO
Decimal data errors are not ignored.
*YES
Decimal data errors are ignored.
Top

Allow null values (ALWNULL)

Specifies whether an RPG/400 program will accept null values from null-capable fields in an externally-described input file.

*NO
Specifies that the RPG/400 program will not accept null value fields.
*YES
Specifies that an RPG/400 program will accept null value fields for an externally-described input file.
Top

Examples

Example 1: Compiling a Source Program into a Program Object

CRTRPGPGM   PGM(MYLIB/XMPLE1)
            SRCFILE(MYLIB/QRPGSRC)  SRCMBR(XMPLE1)
            OPTION(*SOURCE)  TEXT('My RPG III program')

This command calls the compiler for RPG/400 to create a program named XMPLE1. The source program is in member XMPLE1 of source file QRPGSRC in library MYLIB. A compiler listing is created.

Top

Error messages

*ESCAPE Messages

QRG9001
Compile failed. Program not created.
QRG9004
The release &1 specified on the TGTRLS option is not supported.
QRG9005
The *SRCDBG or *LSTDBG compiler option cannot be processed.
Top