PACKKEY
NCHAR
The PACKKEY instruction appends one or more variables from a list into a single destination character variable. Unlike the PACK instruction, the PACKKEY instruction uses the defined length of each source field in the packing of the data, using spaces to fill in between the Length Pointer and the Physical Length. The instruction uses the following format:
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
dest
Required. A previously defined Character String Variable or National Character String Variable that receives the appended source variables.
sep
Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.
source
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 are appended together and placed in the {dest} operand.
Flags Affected: EOS
Note the following:
The transfer process is exactly the same as:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Only the {dest} operand changes. All other operands remain unchanged.
The criteria for transferring the data from {source} is as follows:
If a character string variable, the first character through the Length Pointer is transferred. Blanks are then moved to {dest} for each character position after the Length Pointer to the Physical Length.
If a Null String variable, blanks are transferred for the Physical Length of the field.
If a numeric variable, the Physical String is transferred.
If a string literal, the entire literal contents are transferred.
If an integer variable, the entire variable is transferred in reverse byte order sequence, i.e., the least significant byte is moved to the next available byte in the {dest} operand.
If an ARRAY variable without a specific array element is used, all array elements are transferred. Otherwise, only the specific array element is transferred.
The Form Pointer of {dest} is set to one (1) and its Length Pointer is set to the last character transferred. If all the list items are null, {dest} is set to null.
If {dest} is too small, the remaining characters or list items are ignored and the EOS Condition Flag is set.
{source} 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, UNPACK, PACK, Character String Instructions
![]() |