The Modern RPG IV Language

The CRTBNDRPG command performs a single source-file-to-program compilation. It checks the syntax source file for errors and, upon successful syntax checking, it generates a *MODULE object. The command automatically evokes the CRTPGM command upon successful *MODULE generation. After a successful bind, a *PGM is generated. This *PGM object can be called through the conventional program interfaces, such as the CL CALL command of the OS/400 operating system.

Note that the actual native AS/400 interface displays full-text descriptions for command parameters. These keywords are the CL command interface to the various parameters. For example, the CL command prompter displays "Program ......" for the program name parameter, but the keyword for this parameter is PGM. The keyword form of the parameter name is used in this appendix.

PGM (Program Name)

The name of the program and library of the program (*PGM) being created. The program name and library name must conform to AS/400 naming conventions. If no library is specified, the created program is stored in the current library.

SRCFILE (Source File Name)

Specify the name of the source file that contains the RPG IV source member being compiled. A fully qualified source file name can be specified. The default source file name is QRPGLESRC. Other names, such as QRPGSRC, also are used.

If a program-development environment is being used, such as Program Development Manager (PDM), the source file name is generally established based on the source file being worked with.

SRCMBR (Source File Member)

Specify the name of the member of the file specified on the SRCFILE parameter. The member name is where the RPG IV source code resides.

GENLVL (Generation Severity)

Specify the maximum error severity that is acceptable while still generating the program object. The program is created only when any errors generated are less than or equal to the generation severity.

TEXT

Specify some descriptive text for the program being compiled. This text is embedded into the program object, and is visible through several system interfaces, such as DSPOBJD, WRKOBJ, DSPPGM, and PDM.

DFTACTGRP (Default Activation Group)

Specify *YES for this option when the program must be run in the default activation group. The default activation group name is *DFTACTGRP. DFTACTGRP(*NO) is recommended for RPG IV programs that take advantage of procedures. Activation groups are an integrated language environment (ILE) construct and are beyond the scope of this appendix.

*YES Specify DFTACTGRP(*YES) to force the program to run in the default activation group. When DFTACTGRP(*YES) is specified, the ACTGRP parameter is ignored.

Specifying DFTACTGRP(*YES) causes the RPG IV program to behave like traditional RPG III program objects. The override scoping, open scoping, and resource use are the same as that of RPG III programs. This option allows programmers to plug-in replacements for legacy RPG III and RPG II applications with RPG IV without concern for the common runtime environment built around the newer AS/400 compilers.

Stand-alone RPG IV programs without procedure calls can typically use this option without impacting performance or runtime. There are several limitations in this configuration, however. These limitations may cause the experienced RPG IV programmer to choose DFTACTGRP(*NO). The following restrictions are placed on an RPG IV program when DFTACTGRP(*YES) is specified:

DFTACTGRP(*YES) is useful when moving an application to the RPG IV environment. By using the CVTRPGSRC command to convert RPG III source code to its equivalent RPG IV source code, the CRTBNDRPG with DFTACTGRP(*YES) specified is one method to do a plug-in replacement of the original program.

*NO Specify DFTACTGRP(*NO) for most RPG IV compiles. When *NO is specified, the program runs in the activation group specified on the ACTGRP parameter.

DFTACTGRP(*NO) is useful when you intend to take advantage of advanced RPG IV features, such as procedure calls or ILE features such as named activation groups, calling service programs, or binding directories.

BNDDIR (Binding Directory)

Specify the name of one or more binding directories. These directories are used to locate *MODULE and *SRVPGM objects for binding with the compiled program. Several binding directory names can be specified.

ACTGRP (Activation Group)

Specify the ACTGRP parameter to indicate the activation group in which this program runs.

OPTION

Specify the compile listing and object generation options to use when the source is compiled. Specify one or more of the following options in any order. Separate the individual options with one or more blanks or use the command prompter. When multiple or contradictory options are specified, the last option specified is used for the compile.

DBGVIEW (Debug View Level)

Specify the level of debugging that will be available to debug the compiled program.

OUTPUT (Compiler Output Listing)

Specify the output listing option to generate a listing or avoid generating a listing.

OPTIMIZE (Optimization Level)

Specify the level of optimization to be performed on the program. Optimization on the AS/400 is generally technologically superior to other compilers. The overall throughput of the program, however, is not always dependent on the level of optimization. Actually, for general-purpose business applications, optimizing RPG IV programs is only marginally affective.

INDENT (Indented Compiler Listing)

Specify the INDENT option to control whether structured operations are printed in an indented source-listing format. The character used to highlight the indent levels also is specified on this parameter.

Note

Any indentation you request here will not be reflected in the listing debug view, which is created when you specify DBGVIEW(*LIST).

CVTOPT (Data Type Conversion Options)

Specify the CVTOPT option to control how certain data types of externally described files are handled by the compiled program. Each option converts its corresponding data type to a fixed-length character field.

SRTSEQ (Sort Sequence Table)

Specify the SRTSEQ option to control the sort sequence table that is used in the RPG IV source program.

LANGID (Language Identifier)

Use the LANGID parameter to specify the language identifier used when the sort sequence (SRTSEQ) parameter is *LANGIDUNQ or *LANGIDSHR. The LANGID parameter is used with the SRTSEQ parameter to specify the sort sequence table.

REPLACE (Replace Existing Program upon Successful Compile)

Specify the REPLACE option to have the compiler replace an existing compiled program after this program compiles successfully.

USRPRF (User Profile Authority Adoption)

Specify the USRPRF parameter to control how the program runs. The authority of the program's owner can be used when the program runs or the authority of the user running the program can be used.

AUT (User Authority)

Specify the AUT parameter to control the authority given to user profiles that don't have explicit authority to the program.

TRUNCNBR (Truncate Numbers on Overflow)

Specify the TRUNCNBR parameter to issue a message when a number is truncated during a move to the result field. This parameter applies only to traditional fixed-format operations and is for backward compatibility. Previous versions of RPG ignored truncation. The default for this parameter also causes truncation to be ignored. However, specifying TRUNCNBR(*NO) causes a message to be issued when truncation occurs.

FIXNBR (Fix Decimal Data Errors for Zoned Numeric Fields)

Specify the FIXNBR parameter to cause the compiler to generate code that allows zoned numeric fields containing blanks or other non-numeric data to be converted to valid data.

TGTRLS (Target Operating System Release)

Specify the TGTRLS parameter to target prior versions and releases of the operating system. This option directs the compiler to generate code that is backward compatible with the targeted release. The IBM OS/400 operating system doesn't allow programs to run on back-releases. Only current and future versions and releases are reasonably guaranteed.

ALWNULL (Allow Null-Capable Fields in Database Records)

Specify the ALWNULL parameter to control whether the program allows records with null-capable fields to be read. Files declared as input-only support nulls in this manner. No other file processing supports nulls.

Категории