pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

typedef union val_cc_combo
{
long long combo;
struct
{
long value;
long condition_code;
} parts
} val_cc_combo
...
val_cc_combo.combo = some_name ();
C/C++ code that extracts the condition code from the 64-bit value:
(short)val_cc_combo.parts.value /* For 16-bit return value */
val_cc_combo.parts.value /* For 32-bit return value */
C/C++ code that extracts the two return values from the 64-bit value:
(short)val_cc_combo.parts.condition_code /* Always 16-bits */
Example 368 C Procedure Extracting Only the Traditional Function Value from a 64-Bit Value
(Works Only on TNS/R Systems)
pTAL procedure with two return values:
int proc p (i, j, k) returnscc;
int(16) i;
int(32) .ext j;
int(64) k;
begin ...
return i, j < k; ! Traditional function value is the value of i.
! Expression j < k sets condition code.
end;
C/C++ prototype for accessing pTAL procedure:
_tal _alias ("P") long some_name1 (short i, int* j, long long k);
Example 369 Migrating a pTAL Procedure With Two Return Values to TNS/E (Works on TNS/R and
TNS/E Systems)
pTAL shell procedure that returns values in the way that C/C++ does:
int proc p_shell (result, i, j, k);
int(32) . result;
int(16) i;
int(32) .ext j;
int(64) k;
begin
int cc;
result := p (i, j, k);
if < then
cc := -1D
else
if > then
cc := 1D
else
cc := 0D;
529