General syntax of DEFINE DATA PARAMETER
:
DEFINE
DATA |
||||||
PARAMETER |
USING
parameter-data-area |
|||||
parameter-data-definition | ||||||
END-DEFINE |
This document covers the following topics:
For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.
The DEFINE DATA PARAMETER
statement is used to define
the data elements that are to be used as incoming parameters in a Natural
subprogram, external subroutine or helproutine. These parameters can be defined within the
statement itself (see Parameter Data
Definition); or they can be defined outside the program in
a parameter data area (PDA), with the
statement referencing that data area.
Parameter data elements must not be assigned initial or constant
values, and they must not have edit mask (EM
), header
(HD
) or print mode (PM
)
definitions; see also EM, HD, PM
Parameters for Field/Variable.
The parameter data area and the objects which reference it must be contained in the same library (or in a steplib).
For parameter data definition, the following syntax applies:
level | group-name [(array-definition)] | ||||||||||||||
redefinition | |||||||||||||||
variable-name | (format-length[/array-definition]) | [BY VALUE [RESULT ]]
[OPTIONAL ]
|
|||||||||||||
( | [/array-definition]) | DYNAMIC |
|||||||||||||
[(array-definition)]
HANDLE OF
OBJECT |
Syntax Element Description:
Syntax Element | Description | |
---|---|---|
level |
Level Number:
Level number is a 1- or 2-digit number in the range from 01 to 99 (the leading zero is optional) used in conjunction with field grouping. Fields assigned a level number of 02 or greater are considered to be a part of the immediately preceding group which has been assigned a lower level number. The definition of a group enables reference to a series
of fields (may also be only 1 field) by using the group name. With certain
statements ( A group may consist of other groups. When assigning the level numbers for a group, no level numbers may be skipped. |
|
group-name |
Group Name:
The name of a group. The name must adhere to the rules for defining a Natural variable name. See also the following sections:
|
|
array-definition |
Array Dimension
Definition:
With an array-definition, you define the lower and upper bounds of dimensions in an array-definition. For further information, see Array Dimension Definition and Variable Arrays in a Parameter Data Area. |
|
redefinition |
Redefinition:
A Note: |
|
variable-name |
Variable Name:
The name to be assigned to the variable. Rules for Natural variable names apply. For information on naming conventions for user-defined variables. For further information, see Naming Conventions for User-Defined Variables in Using Natural. |
|
format-length |
Format/Length Definition:
The format and length of the field. For information on format/length definition of user-defined variables, see Format and Length of User-Defined Variables in the Programming Guide. |
|
HANDLE OF OBJECT |
Handle of Object:
Used in conjunction with NaturalX. A handle identifies a dialog element in code and is stored in handle variables. For further information, see NaturalX in the Programming Guide. |
|
A , U or
B |
Data Type:
Alphanumeric ( |
|
DYNAMIC |
DYNAMIC Option:
A parameter may be defined as |
|
Call Mode:
Depending on whether call-by-reference, call-by-value or
call-by-value-result is used, the appropriate transfer mechanism is applicable.
For further information, see the |
||
(without BY VALUE )
|
Call-by-Reference:
Call-by-reference is active by default when you omit the
|
|
BY VALUE |
Call-by-Value:
When you specify
|
|
Example of BY
VALUE :
|
||
* Program DEFINE DATA LOCAL 1 #FIELDA (P5) ... END-DEFINE ... CALLNAT 'SUBR01' #FIELDA... |
* Subroutine SUBR01 DEFINE DATA PARAMETER 1 #FIELDB (P9) BY VALUE END-DEFINE ... |
|
BY VALUE RESULT |
Call-by-Value-Result:
While With |
|
OPTIONAL |
Optional Parameters:
For a parameter defined without For a parameter defined with In the invoking object, the notation
With the
|
Note:
See also
Matching Format Specification of Array
Dimensions in the Programming
Guide.