SUBROUTINE SQUARE(STATUS)
INTEGER STATUS
REAL R,RR
CALL PAR_GET0R('VALUE',R,STATUS)
IF (STATUS .EQ. SAI__OK) THEN
RR = R*R
CALL PAR_PUT0R('VALUE',RR,STATUS)
ENDIF
END
We could run this from ICL as follows (having done a DEFINE SQUARE SQUARE) to define the command:
ICL> X=5
ICL> SQUARE (X)
ICL> =X
25
ICL>
In order for the ADAM task to return a value to ICL we must use a variable for the parameter and place it on the command line. The variable name must be placed in parentheses, then the name of a temporary HDS object is substituted by ICL.
A modification of this scheme is needed with character variables to allow the
case where the contents of the character variable is itself a device, file or
object name.
In such cases, the supplied name cannot be replaced by some other name so,
to indicate that they may not be replaced, name values in variables must be
preceded by @.
ICL The Interactive Command Language for ADAM