Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

@IF (format 4) - Query job and user switches

&pagelevel(3)&pagelevel

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 U is not specified then a job
switch is checked.

int

Number of the switch (0..31) whose setting is to be checked.

If the keyword U is specified before the switch number then the user switch
int belonging to the user's own ID is checked instead of the job switch int.

text

EDT statement or data line. If the condition is fulfilled, the string is treated
as if it had been entered at the prompt in L mode. In particular, the decision
to interpret the text as data input or as a statement is made in accordance
with the same rules (for more information, see section “L mode”).

The text operand starts immediately after the character ':', i.e. any
specified blanks form part of the operand and are taken over into the line in
the case of data input.

If text is not specified (although the colon is), then an empty line (line of
length 0) is inserted.

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 #S3 if job switch 15 is set, and the string variable #S2 otherwise.

(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.