pTAL Conversion Guide

pTAL Built-In Routines
pTAL Conversion Guide527302-002
18-20
$EXCHANGE
$EXCHANGE
$EXCHANGE exchanges the contents of two variables of the same data type.
var1 input,output
anytype: var
is a variable whose contents are exchanged with var2.
var2 input,output
anytype: var
is a variable whose contents are exchanged with var1.
$EXCHANGE exchanges the contents of two variables.
var1 and var2 must meet the following requirements:
var1 and var2 must both be INT variables or both be INT(32) variables.
Neither var1 nor var2 can be a structure, but they can be a fields of structures.
Neither var1 nor var2 can be STRING, UNSIGNED, or USE variables, nor can
they be bit strings.
var1, var2, or both can be array elements.
Example 18-11. Call to $COUNTDUPS Routine
LITERAL buffersize = 100;
INT .EXT buffer[ 0:buffersize-1 ];
INT maxwords;
INT duplication_count;
maxwords := maxbuff;
$COUNTDUPS(@buffer, maxwords, duplication_count);
pTAL privileged procedure No
Can be executed only by privileged procedures No
Sets condition code No
Sets $CARRY No
Sets $OVERFLOW No
) ;
VST615.vsd
$EXCHANGE
( var1 , var2