UNPACK
ANSI
The UNPACK instruction disassembles a variable into one or more variables. It replaces a series of RESET and MOVE instructions. The instruction uses the following format:
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
source
Required. A previously defined Character String Variable, National Character String Variable, or FORM variable that is disassembled into the {dest} variables.
sep
Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.
dest
Required. A previously defined Character String Variable, National Character String Variable, Numeric Variable, a list of string and/or numeric variables, or a VARLIST of string and/or numeric variables that receive the contents of the {source} operand.
Flags Affected: EOS, OVER
Note the following:
If {source} is a character string variable or literal, the Logical String contents are transferred. Otherwise, the Physical String contents are transferred. {source} remains unchanged.
UNPACK processes each list item in sequential order. The process extracts a string of data equal to the Physical Length of the next list item and places it in the variable.
If the Logical String of {source} is exhausted before the list is complete, the remaining list items are blank filled and cleared if character string variables or zeroed if numeric.
If an arrayed variable without a specific array element is specified in the list, all array elements are processed. Otherwise, only the specific array element is processed.
If {source} is a Null String variable or a null literal, all character string items are blank filled and cleared, all numeric items are zeroed and the EOS Condition Flag is set.
If all of the characters of the source variable are blank, the numeric value of zero is moved to the destination numeric variable. If the format of the characters that are moved to the numeric variable is invalid, the number of characters that would correctly fit into the numeric variable is skipped, the value of the numeric variable is set to zero and the processing continues.
If any of the variables in the destination list is a Numeric Variable and the characters from the source do not fit the numeric format exactly, the OVER flag is set and the value of the destination variable is set to zero.
The processing implemented for the UNPACK statement does not conform to a MOVE operation.
{dest} may be continued on additional lines by terminating each continued line with a colon (:) in place of the comma between the last list item on the continued line and the first list item on the new line.
See Also: Example Code, PACK, PACKKEY, PARSE, Character String Instructions
![]() |