Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF |
BOOK
![]() Flow control commands GDDM-PGF V2R1.3 OPS User's Guide SC33-1776-00 |
|
The primary control command is the IF command, as in: if &c = 2 then color red if 'This is fine' = &v if &x < sqrt(&xx) then locate page 1The IF command sets a TRUE-FALSE flag, of which only one exists. You test the flag, and act on the result using THEN and ELSE commands. You can have more than one THEN and ELSE associated with each IF command. Here are some examples: )ops msg 'Type 1 for screen, 2 for plotter' alarm )ops readcmd prompt 'Enter 1 or 2:' white )ops if &$rcmd = 1 )ops then fill 3211 )ops then draw off )ops else fill red 2 )ops else draw white Note: In the above example, and in several examples in this chapter, the character $ is used. The actual character is the currency symbol, and will vary according to the language in which you are working. To see what character applies to you, execute: q sysvarThe character in front of the variables shown is the one that you must use. If &$rcmd equals 1, the two THEN commands are executed. Otherwise the two ELSE commands are executed. You can achieve a more conventional select-construct using ELSE-IF cascades, as in: )ops .again )ops readtag )ops if &$rtag = 0 then locate &$page+1 )ops else if &$rtag = 1 then exec p1 )ops else if &$rtag = 2 then exec p23 )ops else if &$rtag = 3 then end )ops else if &$rtag = 4 then locate page 1 )ops else goto again |
![]() |