21 Program Specifications

This chapter contains these topics:

21.1 About Program Specifications

There are several kinds of RPG/400 specifications as described in IBM's Languages: RPG/400 User's Guide. When your source program is compiled, these specifications are arranged in the following sequence:

An RPG/400 program does not have to use all specifications. A typical JD Edwards World program contains Header, File Description, Extension, Input, and Calculation specifications. Few programs have Output specifications.

Note:

There are a few programs which have been converted to, or written in, RPGIV (ILE). RPGIV has been available since 1994. RPGIV programs have Data specification entries and no Extension specification entries. Consult IBM reference manuals for details.

21.2 What Are Header (Control) Specifications?

The Header (control) specifications (H specs) include the name of the program.

  • The first line identifies the program, P55011X, including its description, Item Information Update.

  • The next fourteen lines are comments that are included in JD Edwards World programs for copyright purposes and reproduction restrictions.

Figure 21-1 Header (Control) Specifications

Description of Figure 21-1 follows
Description of "Figure 21-1 Header (Control) Specifications"

21.3 What Are File Description Specifications?

File description specifications (F Specs) describe all the files that your program uses. The information for each file includes:

  • The name of the file

  • How the file is used (for example, input)

  • The size of records in the file for internal files or if the file has an external definition

  • Whether or not the file is keyed

  • Input or output device used for the file

  • If the file will have records added to it

Figure 21-2 File Description Specifications

Description of Figure 21-2 follows
Description of "Figure 21-2 File Description Specifications"

When the Program Generator generates a program, it arranges the included files in alphabetical order within the F Specs.

When a program runs, it opens the files in bottom-to-top order. Some general rules, in regard to files, are the following:

  • Place the files that have the most I/Os at the bottom of the F specs.

  • Place any small usage files or files that are closed after first use at the top of the F specs.

  • Place the display or print files at the bottom of the list.

Line 35 shows a request for the compiler to copy in F specs from JDECPY. All F spec copy names begin with D.

21.4 What Are Extension Specifications?

Extension specifications describe all tables and arrays used in the program. The information includes:

  • Name of the file, table, or array

  • Number of entries in a table or array input record

  • Length of the table or array entry

  • Optional comment text

Figure 21-3 Extension Specifications

Description of Figure 21-3 follows
Description of "Figure 21-3 Extension Specifications"

Lines 44 through 47 are used in this program to facilitate error handling and field editing.

  • The first line defines an array called EMK which has a maximum of 64 entries, each with a length of 4 characters.

Line 52 requests that the compiler program copy in a specific set of E Specs.

  • The E Specs, E0001, are used in any program that executes the common subroutine, C0001.

21.5 What Are Input Specifications?

Input specifications describe the records, fields, data structures, and named constants used by the program. The information in the input specifications includes:

  • The name of the file

  • The sequence of record types

  • Whether record-identifying indicators, control-level indicators, field-record relation indicators, or field indicators are used

  • Whether data structures, look-ahead fields, record identification codes, or match fields are used

  • The type of each file (alphanumeric or numeric; packed-decimal, zoned decimal, or binary format)

  • The location of each field in the record

  • The name of each field in the record

  • All named constants

Figure 21-4 Input Specifications

Description of Figure 21-4 follows
Description of "Figure 21-4 Input Specifications"

Lines 73 through 83 are used to define some of the vocabulary overrides that appear on this screen.

  • The ending lengths change from program to program, and the program retrieves the values for each field at the time it executes the housekeeping subroutine, S999.

  • In JD Edwards World RPGIV (RPGL) programs, there may be D specs and no I or E specs.

21.6 What Are Calculation Specifications?

Calculation specifications describe the calculations to be done on the data and the order of the calculations. Calculation specifications can also be used to control certain input and output operations. The information includes:

  • Control-level and conditioning indicators for the operation specified (generally not used in JD Edwards World software)

  • Fields or constants to be used in the operation

  • The operation to be processed

  • Whether resulting indicators are set after the operation is processed

Figure 21-5 Calculation Specifications

Description of Figure 21-5 follows
Description of "Figure 21-5 Calculation Specifications"

The C Specs are the heart of the processing of a program. JD Edwards World programs are designed with a MAINLINE portion which is a select set of C Specs that call other subroutines.

21.7 What Are Output Specifications?

Output specifications describe the records and fields in the output files and the conditions under which output operations are processed. They include information such as:

  • Name of the file

  • Type of record to be written

  • Spacing and skipping instructions of printer files

  • Output indicators that condition when the record is to be written

  • Name of each field in the output record

  • Location of each field in the output record

  • Edit codes and edit words

  • Constants to be written

  • Format name for a workstation file

Figure 21-6 Output Specifications

Description of Figure 21-6 follows
Description of "Figure 21-6 Output Specifications"

JD Edwards World uses the RPG EXCPT operation to release locks on data records. The O Specs inform the program which record format is to be released when the EXCPT UNLOCK calculation is performed. Additional formats can be identified with a name such as UNLCKA or UNLCKB.

Note:

Typically, JD Edwards World does not perform reporting functions using O Specs.

You can use the Opcode "UNLCK" instead of EXCPT/O-SPECS.