Contents - Index


 

Use VarSubtract to subtract a specified value from a specified variable.

 

VarSubtract may also be entered as VarSubt[ract] or Subt[ract].

 

Required Operands

 

OPER1 is the name of a previously declared numeric variable.

 

OPER2 is a non-negative numeric integer.

 

OPER2 will be subtracted from the value of the OPER1 variable.  The result will be stored in the OPER1 variable.  An unconditional error occurs if the result is less than 0.

 

Return Codes

 

OK Successful.

 

Examples

 

The following example shows how the VarSubtract command could be used within a procedure to search for a string of characters on every third line above the current line:

 

 ------------------------------------------------------------------------

 SET PPDVBL,1

 DCL LINE,NUM,6

 DCL STR,CHAR,65,V

 PARSE STR

 SETD LINE,SSDBASE&SIBSCRPM        ;GET CURRENT LINE NUMBER

 BLOCK

   IF LINE,LE,3                      ;ARE THERE 3 LINES LEFT?

       EXIT ER,'[9820] String "&STR" not found.'

   SUBTRACT LINE,3                   ;UP THREE LINES

   POSITION &LINE

   SET PPDCOND,1                     ;EXAMINE USES RETURN CODE

   EXAMINE "&STR"

   IF SIBRETCD,EQ,OK                 ;IF WE FOUND IT, GET OUT

       EXIT OK

   SET PPDCOND,0                     ;OTHERWISE TRY AGAIN

 ENDBLOCK

 ------------------------------------------------------------------------