LOAD


ANSI

 

The LOAD instruction transfers the contents of a list item, based on an index, to a destination variable. The instruction uses the following format:

 

 

[label]

LOAD

{dest}{sep}{index}{sep}{source}

 

Where:

label

Optional. A Program Execution Label.

dest

Required. A previously defined Character String Variable or Numeric Variable that receives the selected {source} value.

sep

Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.

index

Required. A previously defined Numeric Variable, Literal, or Expression indicating the {source} variable that is moved.

source

Required. A previously defined Character String Variable, Literal, Numeric Variable or literal, list of string and/or numeric variables and/or literals, or a VARLIST of string and/or numeric variables and/or literals from which a value is selected.

Flags Affected: EOS, LESS, OVER, ZERO

Note the following:

  1. The value of {index} designates which item in {source} is transferred into {dest}. The transfer is a MOVE (list item type to destination type) process and all rules concerning a MOVE of this type apply.

  2. Only the integer portion of {index} is used (i.e., 3 for 3.85).

  3. If the value of {index} is greater than or less than the number of items in {source}, the instruction is ignored. The first item in {source} would require an {index} value of 1, the second item a value of 2, the third item a value of 3 and so on.

  4. Any ARRAY variables within {source} must be specific array elements: ITEM(1), not ITEM(X) (where X is a numeric variable).

  5. {source} has no limit on the number of Data Definition Labels that may be specified. The list 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.

  6. Null entries in the list are allowed and are signified by two commas with no variable name between them. When the index value is associated with a null entry no LOAD operation is performed, the same as when the index value is out of range or invalid.

  7. Literal entries in {source} are allowed.

 

 

See Also: Example Code, STORE, Character String Instructions

 



PL/B Language Reference LENSET LOWERCASE