INPUT SPECIFICATION SUMMARY


The following sections summarize program-described and externally described files and file-field descriptions.

Program-Described Files

Program-described files are seldom used with the modern RPG language. Typically, when this type of file exists in a program, the program has been converted from an older system or it is some kind of system utility. See Table 2.12.

Table 2.12: Input Specification Program-Described Files Summary

Column

Title

Values

Description

6

Form type

I

Identifies the statement as an input specification.

7 – 16

File name

Blank

The name of the file (as it appears on a corresponding file specification). The file must be defined as an input, output, update, or combined file on the file specification.

16 – 18

Format entry continuation

The record-identifying entries are continued from the previous statement.

AND

The AND indicates that both the preceding line's and this line's record-identifying codes must be satisfied in order to set on the record-identifying indicator.

OR

The record-identifying entries are continued from the previous statement. The OR indicates that the preceding line's or this line's record-identifying codes must be satisfied in order to set on the record-identifying indicator.

17 – 18

Sequencing

Any letters

Alphabetic characters indicate that no special record sequencing is required. Typically, the letters NS are used to indicate no sequence. This type of entry must appear prior to records that have a required sequence (i.e., a numeric entry in these positions).

01 to 99

Special record sequencing is requested, if the sequence is required. Use the sequence number and sequence option entries to control the sequencing.

19

Sequence number

Blank

A blank is required when sequencing contains no entry or when sequencing contains characters.

1

One record of this type, per sequence, is required. More than one record of this type, per sequence, generates an error.

N

One record of this type, per sequence, is required or more records of this type, per sequences, are allowed.

20

Option

Blank

A blank is required when no sequencing is specified. If sequencing is specified, then a record of this type is required in the sequence.

O

Valid for sequenced files only, an entry of O indicates that this sequence entry is optional.

21 – 22

Record-identifying indicator

Indicator

Any valid indicator except overflow (OA to OF, OV), first page (1P), or RPG II function key (KA to KY) can be specified as a record-identifying indicator.

When a record of the type specified is read, the indicator is set on.

**

Two asterisks indicate that the statements that follow are look-ahead fields. Look-ahead fields are used for viewing the information in the next record in the file when processing a file using the RPG cycle. For example, if a file contains 100 records and the RPG cycle just processed the 39th record, the look-ahead field allows the contents of the 40th record to be interrogated before that record is actually retrieved. Look-ahead fields function with input files only. With other types of files, such as update and combined files, look-ahead fields contain the same data as the record just read.

When the end of file is reached, the data in the look-ahead fields is set to *HIVAL for all field types, except character fields, which are set to 9s.

23 – 46

Record type identifying codes

Position and character value

Up to three record-identifying codes can be specified for each record-identifying entry. If more than three record-identifying codes are required, specify an AND/OR entry in Format Entry Continuation positions.

23 – 27

Position

Blank

No record-identifying code is specified.

1 to 32,766

Position within the record of the value specified for the record-identifying value.

28

Not

Blank

The character specified for the record-identifying value must exist in the record at the position specified.

N

The character specified for the record-identifying value must not exist in the record at the position specified.

29

Comparison type

Blank

No record-identifying code is specified.

C

The character specified for the record-identifying value is a character, and the full value is used for the record-identifying code comparison.

Z

The upper 4 bits of the character specified for the record-identifying value are used as the record-identifying code comparison. This allows comparisons for numeric values of positive or negative value, for example.

D

The lower 4 bits of the character specified for the record identifying-value are used for the record-identifying code.

30

Record-identifying value

Any character

The character used as the record-identifying value.

31 – 38

Record identifying code #2

Same structure as columns 23 to 30.

39 – 46

Record identifying code #3

Same structure as columns 23 to 30.

47 – 80

Not used.

Program-Described File Field Descriptions

Table 2.13 summarizes the input specification program-described file field descriptions.

Table 2.13: Input Specification Program-Described File Field Description Summary

Column

Title

Values

Description

6

Form type

I

Identifies this statement as an input specification.

7 – 30

Not used.

31 – 34

Date/time format

Blank

For date and time fields only; the format specified on the DATFMT or TIMFMT keyword of the file's file specification is used as the format for the date or time value. For non-date and non-time fields, this entry must be blank.

Format

Any valid date or time format is supported

For date fields, the following formats are supported:

Format

Description

Sep

Format

*MDY

MonthDayYear

Yes

mm/dd/yy

*DMY

Day Month Year

Yes

dd/mm/yy

*YMD

Year Month Day

Yes

yy/mm/dd

*JUL

Julian

Yes

yy/ddd

*ISO

ISO standard

No

ccyy-mm-dd

*USA

USA standard

No

mm/dd/ccyy

*EUR

European standard

No

dd.mm.ccyy

*JIS

Japan standard

No

ccyy-mm-dd

For time fields, the following formats are supported:

Format

Description

Sep

Format

*HMS

Standard

Yes

hh:mm:ss

*ISO

ISO standard

No

hh.mm.ss

*USA

USA standard

No

hh:mm AM

*EUR

European standard

No

hh.mm.ss

*JIS

Japan standard

No

hh:mm:ss

35

Date/time separator

Separator

Any valid date or time separator. Separators are valid only for those date and time formats that support separators. For date formats, the following separator characters can be specified:

/ , . - &

For time formats, the following separator characters can be specified:

: , . &

36

Data type

Blank

If the decimal positions are also blank, then the field is a character field. If the decimal positions contain a number value, then the field is a zoned decimal field.

A

(CHARACTER) character field.

B

(NUMERIC) binary field.

C

(CHARACTER) UCS-2 field.

D

(DATE) date field.

F

(NUMERIC) floating point.

G

(GRAPHIC) double-byte character set (DBCS) field.

I

(NUMERIC) integer field.

L

(NUMERIC) The field being defined is zoned decimal with a PRECEDING sign value.

N

(CHARACTER) named indicator.

P

(NUMERIC) packed decimal field.

R

(NUMERIC) The field being defined is zoned decimal with trailing sign value.

S

(NUMERIC) zoned decimal.

T

(TIME) time field.

U

(NUMERIC) unsigned integer field.

Z

(TIMESTAMP) timestamp field.

34 – 38

Start position of field

1 to 32767

The starting position within the file's record of the field.

39 – 46

Ending position of field

1 to 32767

The ending position within the file's record of the field. Start positions and end positions are collectively referred to as the From and To positions.

47 – 48

Decimal positions

Blank

The field's data-type is non-numeric, unless one of the following applies: the field is an array or array element, in which case the data-type is specified by the array definition; the field is of type I (signed integer) or U (unsigned integer), in which case the field is numeric.

0 to 30

The number of decimal positions for the numeric field.

49 – 62

Field name

Name

The name of the field being defined. In addition to a symbolic name, an array name, array element, data structure name, indicator variable, indicator array element, or PAGEn can be specified.

63 – 64

Control field

Blanks

The field is not a control field.

L1 to L9

The field is a control field. When a record is read by the RPG cycle, if the contents of the field change, the level-break indicator is set on. If more than one field contains the same level-break indicator, the indicator is set on when any of the fields change.

When a specific level-break indicator is set on, all low-level break indicators are also set on. For example, if indicator L4 is set on, L3, L2, and L1 are also set on.

65 – 66

Match field

Blanks

The field is not a matched field.

M1 to M9

The field is a matched field and has a corresponding matched field in another file.

67 – 68

Field record relation

Blank

No field/record relationship exists.

Record-identifying indicator

The indicator that associates this field with a specific record-identifying entry code and indicator for this file.

69 – 70

Field status indicator (PLUS)

Blank

No indicator is set on.

Indicator

The indicator is set on when a record is read and the content of this field is greater than zero.

71 – 72

Field status indicator (MINUS)

Blank

No indicator is set on.

Indicator

The indicator is set on when a record is read and the content of this field is less than zero.

73 – 74

Field status indicator (Blank/Zero)

Blank

No indicator is set on.

Indicator

The indicator is set on when a record is read and the content of this field is equal to zero (for numeric fields) or blanks (for character fields).

Externally Described Files

Externally described files are the rule when writing new applications with the modern RPG language. External definitions allow the programmer to avoid specifying lengthy record-format descriptions and to easily take advantage of modern operations.

None of the following specifications are required for externally described files. The compiler automatically generates the necessary input specifications to support this type of file. See Table 2.14.

Table 2.14: Input Specification Externally Described Files Summary

Column

Title

Values

Description

6

Form type

I

Identifies this statement as an input specification.

7 – 16

Record format name

Name

The name of a record format from an externally described file.

17 – 20

Not used.

21 – 22

Record-identifying indicator

Any valid indicator except overflow (OA to OF, OV), first page (1P), or RPG II function key (KA to KY) can be specified as a record-identifying indicator.

When a record of the type specified is read, the indicator is set on.

Note

The look-ahead field codes (**) are supported by externally described data, but the look-ahead field entries must be program described.

23 – 80

Not used.

Externally Described Field Descriptions

Externally described files need no input specifications. The RPG compiler automatically generates record format(s) from the external definition. Externally described files can, however, rename their external field names and assigned level-break, match field, and field indicators. See Table 2.15.

Table 2.15: Input Specifications Externally Described Field Description Summary

Column

Title

Values

Description

6

Form type

I

Identifies this statement as an input specification.

7 – 20

Not used.

21 – 30

External field name

Blank

The name of the externally described field is used as the name of the field in the program and is referred to as the internal name.

Name

Name of the externally described file's field being renamed to the name specified in the field name positions.

31 – 48

Not used.

49 – 62

Field name

Name

The name used to access the data in the file's record. If the external field name is blank, the field name specified here is also the external name being referenced.

63 – 64

Control field

Blanks

The field is not a control field.

L1 to L9

The field is a control field. When a record is read by the RPG cycle, if the contents of the field change, the level-break indicator is set on. If more than one field contains the same level-break indicator, the indicator is set on when any of the fields change.

When a specific level-break indicator is set on, all low-level break indicators are also set on. For example, if indicator L4 is set on, L3, L2, and L1 are also set on.

65 – 66

Match field

Blanks

The field is not a matched field.

M1 to M9

The field is a matched field and has a corresponding matched field in another file.

67 – 68

Field record relation

Blank

No field/record relationship exists.

Record-identifying indicator

The indicator that associates this field with a specific record-identifying entry code and indicator for this file.

69 – 70

Field status indicator (PLUS)

Blank

No indicator is set on.

Indicator

The indicator is set on when a record is read and the content of this field is greater than zero.

71 – 72

Field status indicator (MINUS)

Blank

No indicator is set on.

Indicator

The indicator is set on when a record is read and the content of this field is less than zero.

73 – 74

Field status Indicator (Blank/Zero)

Blank

No indicator is set on.

Indicator

The indicator is set on when a record is read and the content of this field is equal to zero (for numeric fields) or blanks (for character fields).

75 – 80

Not used.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net