SETC

Read syntax diagramSkip visual syntax diagram
Syntax

>>-SETC--(--name--,--'value'--,--duplication--)----------------><

Can be used in FASTREXX condition expressions.

Defines or changes a character variable.

name
1–256 character variable identifier. Variable name matching is not case sensitive. Cannot be a system character variable or a system numeric variable. See Using FASTREXX variables.
value
A single value can be entered:
  • Specifying hexadecimal strings. A hexadecimal string must be in the form 'hhhhhh'x. The value enclosed in quotation marks must be an even number of characters and contain valid hexadecimal characters (0–9, A–F).
  • Specifying binary strings. A binary string must be in the form 'nnnnnn'b. The value enclosed in quotation marks must be a combination of "0"s and "1"s.
  • Specifying character strings. For non-numeric types, the value should be enclosed in quotation marks.
  • Specify a variable by specifying &variable_name. A variable is substituted for the value if a matching character, numeric, or tally variable can be located. If a matching variable cannot be found, the string is treated as a literal value. If a numeric or tally variable is referenced, then the value is the number converted to its display form with leading zeros removed.

    You can refer to a substring of a variable by specifying &variable_name(n:length) which returns a string starting at the nth character of the variable for the minimum of the length specified by length or the remaining length of variable. If n is greater than the length of the variable, the value is treated as null.

duplication
Specify an integer n to duplicate the literal value n times.
Note: This can only be used where the value is a literal constant and not a substitute variable.

Example 1

Set up a variable called A10 with A value repeated 10 times.

If RECSIN() = 1 
  SETC('CHECK_CHAR','A',10)
else
  SETC('CHECK_CHAR','B',10)

If FLDI(20,10,,'EQ','&CHECK_CHAR') then
  Return
Else
  Return "DROP"

Example 2

Copy the tenth input record into variable REC10.

If RECSIN() = 10 then
   SETC('REC10','&ZINREC')

Example 3

Copy the name value from column 3 for 20 on the input record into the variable name.

SETC('NAME','&ZINREC(3:20)')