In EDT procedures, this format of the @IF statement checks which job and/or user switches are active and inactive (see also @SETSW and section “Job switches”). Depending on the result, a specified string either is or is not processed as input.
Operation | Operands | L mode |
@IF | {ON | OFF} = [U] int :[text] |
ON OFF U | Processing branches if the specified switch is set. Processing branches if the specified switch is not set. Specifies that a user switch is to be checked. If |
int | Number of the switch ( If the keyword |
text | EDT statement or data line. If the condition is fulfilled, the string is treated The If |
The previous specification of GOTO
or RETURN
without a colon in procedures continues to be supported for reasons of compatibility.
Note
Using @IF with @RETURN as a statement outside of procedures may cause EDT to terminate (see the @RETURN statement).
Example
1. @SET #S2 = 'SWITCH 15 IS OFF' 1. @SET #S3 = 'SWITCH 15 IS ON 1. @PROC 8 1. @ @IF ON = 15 : @GOTO 4 2. @ @PRINT #S2 N 3. @ @RETURN ---------------------------------------- (1) 4. @ @PRINT #S3 N 5. @END 1. @SETSW OFF = 15 ----------------------------------------------- (2) 1. @DO 8 --------------------------------------------------------- (3) SWITCH 15 IS OFF 1. @SETSW ON = 15 ------------------------------------------------ (4) 1. @DO 8 --------------------------------------------------------- (5) SWITCH 15 IS ON 1.
(1) | The procedure in work file 8 outputs the string variable |
(2) | Switch 15 is reset. |
(3) | The procedure in work file 8 is executed. |
(4) | Switch 15 is set. |
(5) | Work file 8 is executed. |