pTAL Conversion Guide

Hardware Indicators
pTAL Conversion Guide527302-002
20-16
Setting Hardware Indicators in TAL
°
In TAL, STRING functions and INT functions can return either a single byte
or an INT value, independent of the data type of the value returned by the
function. If the function returns a single byte, the type of ASCII character
represented by the byte determines the condition code as follows:
If the function returns an INT value, the numeric value of the INT
determines the condition code.
In pTAL, the numeric value returned by the function always determines the
value of the condition code.
°
In TAL and pTAL, if the right side of an assignment statement is an INT
function, the condition code is determined by the INT value returned by the
function. The value returned is always an INT, even if the expression in the
functions RETURN statement is a byte value. The byte value is not sign-
extended. In TAL, however, if the expression in the return statement yields
a byte value, the condition code is determined by the ASCII character
represented by the byte.
In pTAL, if the expression in the return statement is a byte value, the
condition code is determined by the numeric value of the byte returned,
treated as an 8-bit integer:
INT PROC p; ! p is an INT function but the
BEGIN ! expression in the RETURN statement
RETURN "A"; ! yields a single byte
END;
PROC p1;
BEGIN
INT i;
i := p; ! Condition code is available because
END; ! p returns an INT value
! In TAL, the condition code is CCE
! because the ASCII value loaded to
! the stack, "A", is an alphabetic
! character
! In pTAL, the condition code is CCG
! because the numeric value of "A"
! is 33, which is greater than 0
ASCII Character Condition Code
Uppercase or lowercase alphabetic CCE
Numeric CCL
Special character CCG