4 Carrying out a simple command

Suppose your application is very simple, for example, SUMS.IFL contains

  interface SUMS
     parameter VALUE
        type ’_REAL’
     endparameter
     action SQUARE
        obey
        endobey
     endaction
  endinterface

and SUMS.FOR contains

        SUBROUTINE SUMS ( STATUS )
        IMPLICIT NONE
        INCLUDE ’SAE_PAR’
        INCLUDE ’ACT_ERR’
        INTEGER STATUS
        REAL VALUE
  
        IF ( STATUS .NE. SAI__OK ) RETURN
        CALL PAR_GET0R ( ’VALUE’, VALUE, STATUS )
        CALL MSG_SETR ( ’ANS’, VALUE**2 )
        CALL MSG_OUT ( ’ ’, ’answer is = ^ANS’, STATUS )
        END

This can be built as a task called SUMS and loaded using ICL. When it is loaded, the fixed-part reads the interface file and discovers that the task has just one action, called SQUARE, and one parameter called VALUE. If you send a command to it of the form

  ICL> send sums obey square

then the task will prompt you for VALUE. It will attempt to square your reply and then return to the fixed-part. If you send the command again, you will not be prompted for VALUE. The task will remember the value of VALUE unless your application calls PAR_CANCL, or you KILL the task from ICL.