Declared Field STATEMENT

PURPOSE:  The declared field statement is used to declare temporary fields that will be used during the Process Module (PM) execution.  Declared field statements can occur only in the DECLARE section.  This is to provide for defining local variables.

SYNTAX

[$start_position]  field_name, data_type [,{field_width; MAX} [,decimal_places]]

[,OCCURS m [{BY; * } n [ {BY; *} [o]] [{RECORD; COLUMN} /MAJOR/]]

[,DATA value]

[,IE = "input_edit_string"]

[,OE = "output_edit_string"]

[,PP = "print_picture_string"]

[,TITLE = "title_string"]

[,\\ALIAS names\\]

[,/USAGE IS/ {ASCII; BINARY}]

[,USE VALUES \\field_value = "string"\\]

[,VALID conditional clause] {,CV;, CF;, COMPUTE} = clause

[,SWAP BYTES]

All options (except DATA value) are as described in the field definition statements in Schema Definitions (SD).

DATA value

specifies an initial value for the field.  The  value for alpha and character fields should be enclosed in quotation marks.  The value for date fields must be entered as an integer in the form YYYYMMDD.

The DATA clause eliminates the need to assign initial values for declared fields in the INITIAL section.

All fields defined with a data clause should be specified at the beginning of the DECLARE section

Example

DECLARE SECTION
CTR,INT, 3
FLAG, CHAR, 4

The following example shows two ways DATA can be entered for an OCCURS field.

CODE,INT, 3, OCCURS 3
DATA
/100, 200, 300
DATA END
 
CODE,INT, 3, OCCURS 3
DATA
/100
/200
/300
DATA END

NOTES:  Declared field statements are identical to field definition statements in SD’s with two exceptions: 

  1. Declared fields cannot have record types (that is, the RECORD ID and STRUCTURE options are not allowed).

  2. Declared fields can have a DATA clause.

The declared area is functionally equivalent to a BINARY record form.

Fields which are defined as DATETIME uses the DEC date and time specification in the DATA clause:

17-APR-1991  12:34:56.789

ACCENT R processes the DATETIME field internally as an enhanced FULLDATE data type.  It contains the time of a day with a resolution of .00515 seconds.

When declared fields are referenced elsewhere in the PM, they can be identified with the suffix :D.

For declared fields with an OCCURS clause, the DATA clause requires that an initial value be specified for each occurrence in the array.  To specify a DATA clause for an OCCURS field, use a DATA statement to precede the data values.

Values can be specified on one or more lines.  A slash (/) is the first character on the line.  Multiple values on a line are separated by commas.

A DATA END statement indicates the end of the DATA clause for this OCCURS field.

SEE ALSO:  Schema Definition - Field Definitions