SETLPTR


ANSI, NCHAR

 

The SETLPTR instruction changes the value of the length pointer (LP). The instruction uses the following format:

 

 

[label]

SETLPTR

{dest}[{sep}{pos}]

 

Where:

label

Optional. A Program Execution Label.

dest

Required. A previously defined Character String Variable or National Character String Variable whose length pointer is modified.

sep

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

pos

Optional. A previously defined Character String Variable, Numeric Variable, single character Literal, Expression, decimal constant or equivalent {ctrl} character that determines the new {dest} length pointer position.

Flags Affected: EOS, OVER

Note the following:

  1. If no {pos} variable is specified, the Length Pointer of {dest} is set to the Physical Length.

  2. If the second operand is a decimal constant, the Length Pointer is set to its value.

  3. If {pos} is a character string, the Form Pointed character sets the Length Pointer of {dest} using the following formula:

    Form Pointer = CHARACTER VALUE - 31
     

  4. If {pos} is a single character literal, the specified character is used according to the same formula as for a character string (above).

  5. If {pos} is a numeric variable, only the integer portion is used (i.e., 8 if 8.67).

  6. The Length Pointer may be set between zero and the Physical Length of {dest}.

  7. If the new Length Pointer is less than the Form Pointer, the Form Pointer is set to the new Length Pointer and the EOS Condition Flag is set.

  8. If the new Length Pointer is outside the Physical Length of {dest}, the pointers remain unchanged and the OVER Condition Flag is set.

  9. Enhanced ARRAY processing is supported for the SETLPTR instruction.

  10. The {pos} operand can not be a National Character String Variable or a National Character String Literal.

 

 

See Also: Example Code, LENSET, Character String Instructions

 



PL/B Language Reference SET SFORMAT