2 A simple picture of a task

A task is implemented by the application code plus an interface file. The interface file is a text file containing declarations of the parameters and actions (i.e. commands) which the task can carry out. The source code looks like this

        SUBROUTINE MYTASK ( STATUS )
        INCLUDE ’SAE_PAR’
        INTEGER STATUS
  
        IF ( STATUS .NE. SAI__OK ) RETURN
          do things
        END

That is, it appears as a subroutine which is linked into some ADAM code called the task fixed-part. It is conventional to test STATUS on entry and to exit without action if it is not equal to SAI__OK. The value SAI__OK is defined in the include file SAE_PAR. When the task does things, it might have to wait for some other task or system to reply.

The things a task might be waiting for include

An ADAM instrumentation application works by telling the ADAM system what kind of thing it is expecting to happen by giving it a REQUEST through calling TASK_PUT_REQUEST.

  CALL TASK_PUT_REQUEST(REQUEST,STATUS)

and then returning to the code which called it (the task’s fixed-part). See Appendix E for possible values of REQUEST.

The fixed-part waits for messages to arrive. If one arrives which your application has warned it about, then it will call your application after storing information about the message where you can collect it.

The following sections describe how to wait for the various possibilities.