CL parameters

172 Views


A parameter is a value that is passed to a command or program to provide user input or control the actions of the command or program.

Parameter values

A parameter value is user-supplied information that is used during the running of a command.

An individual value can be specified in a constant value, a variable name, an expression, or a list of values.

Constant values: A constant value is the actual value. The types of constants are character string (includes names, date and hexadecimal values), decimal, and logical.

A constant value is an actual numeric value or a specific character string whose value does not change. Three types of constants can be used by the control language: character string (quoted or unquoted), decimal, and logical.

Character strings: A character string is a string of any EBCDIC characters (alphanumeric and special) that are used as a value.

Hexadecimal values: A hexadecimal value is a constant that is made up of a combination of the hexadecimal digits A through F and 0 through 9. All character strings except names, dates, and times can be specified in hexadecimal form. To specify a hexadecimal value, the digits must be specified in multiples of two, be enclosed in single quotation marks, and be preceded by an X. Examples are: X'F6' and X'A3FE'

Date values: A date value is a character string that represents a date.

Decimal values: A decimal value is a numeric string of one or more digits, optionally preceded by a plus (+) or minus (-) sign.

 A decimal value is a numeric string of one or more digits, optionally preceded by a plus (+) or minus (-) sign. Therefore, a decimal value can have no more than 17 character positions.

Logical values:

A logical value is a single character (1 or 0) that is enclosed in single quotation marks. Logical values are often used as a switch to represent a condition such as on or off, yes or no, and true or false.

Floating-point constants:

A floating-point constant is a representation of a numerical constant, shown as an optional sign followed by one or more digits and a decimal point, which may be at the end.

Variable name:

A variable contains a data value that can be changed when a program is run.

A variable name is the name of the variable that contains the value.

The variable is used in a command to pass the value that it contains at the time the command is run.

The change in value can result if one of the following conditions occur: the value is received from a data area, a display device file field, or a message; the value is passed as a parameter; a Change Variable (CHGVAR) command is run in the program; or another program that is called changes the value before returning it.

The types of variables are character string (includes names), decimal, logical, and integer.

Decimal and logical values must match the type of value expected for the parameter.

Character variables can specify any type of value.

CL variables can be used to specify values for almost all parameters of CL commands.

A CL variable must contain only one value; it may not contain a list of values separated by blanks.

The value of any CL program variable can be defined as one of the following types: 

Character: A character string that can contain a maximum of 9999 characters. The character string can be coded in quoted or unquoted form, but only the characters in the string itself are stored in the variable. v

Decimal: A packed decimal value that can contain a maximum of 15 digits, of which no more than nine can be decimal positions.  Logical: A logical value of '1' or '0' that represents on/off, true/false, or yes/no.

Integer: A two-byte or four-byte binary integer value that can be either signed (value may be positive or negative) or unsigned (value is always positive).

Parameters in keyword form

CRTLIB LIB(MYLIB) TYPE(*TEST)

Parameters in positional form

CRTLIB     MYLIB      *TEST

Parameters cannot be coded in positional form beyond the positional coding limit. If you attempt to code parameters in positional form beyond that point, the system returns an error message.

Using positional form in your CL program source may save time when writing the program, but will be more difficult for you or someone else to maintain. Commands written using keyword form are generally easier to understand and enhance.

 

Post Comments