CPOS - conditionally modify command file flow of control.

Syntax:

cpos expression; operation

Examples:

cpos 35;wmi    <- wmi if bit 35 on
cpos /13;wmi   <- wmi if bit 13 off
cpos gt5;+5    <- skip four lines if lower
                      half of PSW > 5
cpos /13;$okay <- go to label "okay" if bit 13 is off
cpos ;9999     <- end the command file successfully

Description:

CPOS, written by Bull, is intended to provide a flow of control capability for command file (DRUN or CRUN) applications. It permits either conditional alteration of the normal serial processing of input file responses for a command file application, or conditional execution of a single command based on the contents of the user program switch word (PSW).

The first parameter represents a boolean expression. If this is true, the second expression is evaluated. The condition expression may contain any of the following operands:

Form  Is true when:                        Restriction
i     bit i of the PSW is on               0 <= i < 36
LTn   c(PSW) bits 18-35 is less than n     n < 262144
LEn   c(PSW) bits 18-35 is <= n            n < 262144
GTn   c(PSW) bits 18-35 is greater than n  n < 262144
GEn   c(PSW) bits 18-35 is >= n            n < 262144
EQn   c(PSW) bits 18-35 is equal to n      n < 262144
NEn   c(PSW) bits 18-35 is not equal to n  n < 262144
DEF   this is a DRUN session

Permissible operators include + (or), * (and), - (exclusive or), and / (not). Although / is a unary operator involving only one operand, by convention A/B is taken to mean A*/B.

The second parameter is an operation to perform if the condition is true. If this is a number, then it is a relative line in the command file where execution is to continue. A positive value moves forward, and a negative value move backward. (Zero would result in a jump to the CPOS line itself). A forward move beyond the end of the file (e.g. 9999), terminates the command file normally. If the string starts with a "$", then is is taken as a label for and absolute location in the file marked by a $*$LBL line. Anything else is taken as a TSS command to be executed.

A null expression is always true, and is used for "goto" type actions.

See Also:

expl switch

Copyright © 1996, Thinkage Ltd.