pTAL Conversion Guide

Hardware Indicators
pTAL Conversion Guide527302-002
20-23
Testing Hardware Indicators
The following example illustrates these cases:
i := i + 1;
IF i >= 0 THEN ! OK: >= is a relational operator
IF > THEN ...
i := i + 1;
IF >= THEN ! OK: >= is a condition code
IF > THEN...
An IF statement that tests a hardware indicator cannot be labeled. See Section 7,
Labels, for more information and an example.
Topics:
Nesting Condition Code Tests on page 20-24
Testing Condition Codes Set in Conditional Expressions on page 20-25
Example 20-9. Testing Hardware Indicators in IF Statements
INT a;
a := a - 1;
IF < THEN ... ! OK: indicator is tested immediately
INT a;
a := a + 1;
IF $CARRY THEN ... ! OK: indicator is tested immediately
CALL WRITEREAD(...);
IF <> THEN... ! OK: indicator is tested immediately
Example 20-10. Testing Hardware Indicators in IF Statements (TAL Only)
INT a;
a := a - 1;
BEGIN
IF < THEN ... ! ERROR: intervening BEGIN is invalid
...
a := a + 1;
END;
IF $CARRY THEN ... ! ERROR: intervening END is invalid
CALL WRITEREAD(...);
firstchar := str_buff;
IF <= THEN ... ! ERROR: intervening assignment
! statement is invalid
WHILE <= DO ! ERROR: Condition codes can be tested
... ! only in IF statement
IF < THEN ... ! ERROR: Condition code is not set by
! previous statement