──┬─ <Boolean constant> ───────────────┬───────────────────────────────┤ ├─ <Boolean constant identifier> ────┤ ├─ <Boolean identifier> ─────────────┤ ├─ <file residence inquiry> ─────────┤ ├─ <Boolean file attribute primary> ─┤ ├─ <Boolean task attribute primary> ─┤ ├─ <task state> ─────────────────────┤ ├─ <arithmetic comparison> ──────────┤ ├─ <string comparison> ──────────────┤ ├─ <file mnemonic comparison> ───────┤ ├─ <task mnemonic comparison> ───────┤ └─ ( ── <Boolean expression> ── ) ───┘
Explanation
Syntax for Boolean constants, Boolean constant identifiers, and Boolean identifiers is provided in Basic Constructs. The other types of Boolean primaries are defined in the following topics.
File Residence Inquiry
──┬─ <file identifier> ────┬─┬─ IS ───┬─ RESIDENT ─────────────────────┤ └─ FILE ── <file title> ─┘ └─ ISNT ─┘
Explanation
The file inquiry checks to see whether a file is available. If the file was declared in the job, the file identifier is used in the inquiry.
Examples
The following example illustrates a file residence inquiry expression:
IF INFILE1 IS RESIDENT THEN SUB1;
The residence of files that are not declared in the job can be checked, using the FILE <file title> form. For example:
FILE (JACOB)OBJECT/LION IS RESIDENT
The file residence inquiry can also be used to check whether or not a tape is available. However, it cannot be used to check on the existence of individual files on a tape.
The following example is invalid:
?BEGIN JOB; FILE F (KIND=TAPE, SERIALNO="PAYROL", TITLE=PAYROL/FILE000); IF F IS RESIDENT THEN DISPLAY"TAPE F IS AVAILABLE" ELSE ISPLAY"TAPE F IS NOT AVAILABLE"; ?END JOB.
The file residence inquiry can even be used to check on the existence of a global data specification, because a data specification is read as if it were an input file. For example:
?BEGIN JOB; FILE G (KIND=READER, TITLE=IN/COUNT); DATA IN/COUNT 1 2 3 ? IF G IS RESIDENT THEN DISPLAY"GLOBAL DATA IN/COUNT IS PRESENT" ELSE DISPLAY"GLOBAL DATA IN/COUNT IS MISSING"; ?END JOB.
Using File Attributes to Inquire about File Residence
The Boolean file attribute RESIDENT can be used instead of the file residence inquiry to check on the residence of files at the local host that is declared in the job. For example;
?BEGIN JOB; FILE F (TITLE=BRANCH/SALES, KIND=DISK); IF F(RESIDENT) THEN DISPLAY"FILE F IS RESIDENT" ELSE DISPLAY"FILE F IS NOT RESIDENT"; ?END JOB.
The file residence inquiry cannot be used to check on files that reside on a remote system connected through a BNA network. However, this capability is provided by the AVAILABLE file attribute. AVAILABLE attempts to open a file, and then returns an integer value indicating a successful open (and thus the existence of the file) or the reason for failure, without suspending the program or requiring operator intervention. For example:
?BEGIN JOB; FILE F (TITLE=BRANCH/SALES, KIND=DISK, DEPENDENTSPECS, HOSTNAME=MLM); IF F(AVAILABLE) = 1 THEN DISPLAY"FILE F IS RESIDENT AT MLM" ELSE DISPLAY"FILE F IS NOT RESIDENT AT MLM"; ?END JOB.
Boolean File Attribute Primary
<Boolean file attribute primary>
── <file identifier> ── ( ── <Boolean file attribute> ── ) ────────────┤
Explanation
The Boolean file attribute primary returns the value of a Boolean file attribute of the specified file.
Boolean Task Attribute Primary
<Boolean task attribute primary>
── <task identifier> ── ( ── <Boolean task attribute> ── ) ────────────┤
Explanation
The Boolean task attribute primary returns the value of a Boolean task attribute associated with the specified task variable.
Task State
── <task identifier> ─┬─ IS ───┬─┬─ INUSE ───────┬─────────────────────┤ └─ ISNT ─┘ ├─ COMPLETED ───┤ ├─ SCHEDULED ───┤ ├─ ACTIVE ──────┤ ├─ STOPPED ─────┤ ├─ ABORTED ─────┤ ├─ COMPLETEDOK ─┤ └─ COMPILEDOK ──┘
Explanation
The state returns information about the status of a task. The task must be associated with a task variable that has the specified task identifier.
The following are the different task states.
Task State |
Meaning |
---|---|
The task is SCHEDULED, ACTIVE, or STOPPED. |
|
The task was initiated and has terminated. |
|
The task has not yet been initiated by the system. |
|
The task is currently running. |
|
The task was stopped by the operator, suspended by the system, or programmatically suspended. |
|
The task faulted or was discontinued. |
|
The task is completed and was terminated without faulting or being discontinued. |
|
The task compiled without syntax errors. |
The result of the task state expression is dependent only on the value of the STATUS attribute for the task. If the value of the STATUS attribute for the task is NEVERUSED, then all task state expressions return the values FALSE for IS and TRUE for ISNT.
Example
The following example uses the task state expression:
RUN OBJECT/X [TVAR]; IF TVAR IS COMPLETEDOK THEN SUB1 ELSE IF TVAR IS ABORTED THEN DISPLAY"UNSUCCESSFUL RUN";
Arithmetic Comparison
──┬─ <real expression> ────┬─ <real relation> ─────────────────────────► └─ <integer expression> ─┘ ►─┬─ <real expression> ────┬───────────────────────────────────────────┤ └─ <integer expression> ─┘
──┬─ LSS ─┬────────────────────────────────────────────────────────────┤ ├─ LEQ ─┤ ├─ GTR ─┤ ├─ GEQ ─┤ ├─ EQL ─┤ ├─ NEQ ─┤ ├─ < ───┤ ├─ > ───┤ └─ = ───┘
Explanation
An arithmetic comparison compares the values of two real or integer expressions. If their values are related in the way specified by the real relation, the arithmetic comparison returns TRUE; otherwise, it returns FALSE.
The real relations have the following meanings.
Real Relation |
Meaning |
---|---|
LSS, < |
Less than |
LEQ |
Less than or equal to |
GTR, > |
Greater than |
GEQ |
Greater than or equal to |
EQL, = |
Equal to |
NEQ |
Not equal to |
String Comparison
── <string expression> ─┬─ = ───┬─ <string expression> ────────────────┤ ├─ EQL ─┤ └─ NEQ ─┘
Explanation
A string comparison is a Boolean primary that enables comparison of the values of two string expressions. Two strings are equal only if all characters in the first string occur in the same order as in the second string, and the lengths of the two strings are equal.
File Mnemonic Comparison
── <file identifier> ── ( ── <mnemonic file attribute> ── ) ───────────► ►─┬─ IS ───┬─ <file mnemonic primary> ─────────────────────────────────┤ └─ ISNT ─┘
Explanation
A file mnemonic comparison is used to inquire about the values of mnemonic file attributes associated with a file. The file mnemonic comparison returns TRUE if the specified file attribute has the same value as the file mnemonic primary. Refer to Mnemonic Primaries and Interrogating File Attributes for related information.
Task Mnemonic Comparison
── <task identifier> ── ( ── <mnemonic task attribute> ── ) ───────────► ►─┬─ IS ───┬─ <task mnemonic primary> ─────────────────────────────────┤ └─ ISNT ─┘
Explanation
A task mnemonic comparison is used to inquire about the values of task attributes associated with a task variable. The task mnemonic comparison returns TRUE if the specified task attribute has the same value as the task mnemonic primary.
Example
The following example includes two task mnemonic comparisons that interrogate the value of the STATUS attribute:
PROCESS RUN OBJECT/X [TVAR1]; PROCESS RUN OBJECT/Y [TVAR2]; DO WAIT UNTIL TVAR1(STATUS) IS TERMINATED AND TVAR2(STATUS) IS TERMINATED;
This example initiates two asynchronous tasks and then waits for both of them to finish before proceeding.