Saturday, September 5, 2009

The SET Statement

Syntax


Format 1














SET



{



index-name-1
identifier-1



}



... TO



{



index-name-2
identifier-2
integer-1



}



Format 2














SET {index-name-3} ...



{



UP
DOWN



}



BY



{



identifier-3
integer-2



}



Format 3














SET



{



{mnemonic-name-1}



... TO



{



ON
OFF



}}



...



Format 4







SET {condition-name-1} ... TO TRUE...



Description


The SET statement is used to set values for indices and conditions. Each of the four formats works differently and is described below in the correspondingly numbered item.



  1. The first format of the SET statement is used to assign values to indices or assign the value of an index to another variable. The variable(s) between SET and TO is set to the value of the data item or literal following TO.

  2. The second format of the SET statement is used to increase or decrease the value of an index. The variable(s) between SET and UP or DOWN is INCREASED (for UP) or DECREASED (for DOWN) by the value of the data item or literal following BY.

  3. The third format of the SET statement is used to set the value of an external switch. The mnemonic(s) between SET and TO is set to ON or OFF according to the ON or OFF option supplied.

  4. The fourth format of the SET statement is used to set the condition-name conditions to true. The condition(s) between SET and TO is set to TRUE.


Tips



  1. Regular MOVE and mathematical statements do not work on indices. Use the SET statement to manipulate an index.

  2. For format 4, if more than one value is associated with the condition-name being true, the first value listed is the one that will be used.