2 The ADAM Main Routine

When a task is first started, MAINTASK (in dtask_main.f) finds out if it is being run via the ADAM message system or directly from the shell, by inspecting the environment variable ICL_TASK_NAME.

If ICL_TASK_NAME is not set, it is assumed that the task is being run direct from the shell – signal handling is disabled and DTASK_DCLTASK() is called. The parameter system is activated, the user’s code is run through once and the parameter system de-activated, updating GLOBAL parameters if required. The program then exits. Any output messages or parameter prompts will go directly to stdout and replies to parameter prompts are read from stdin – the message system will take no part in the proceedings. This very simple running of a task is not discussed further in this document.

If ICL_TASK_NAME is set, it is assumed that the task is being run via the ADAM message system – signal handling is enabled (DTASK_SETSIG()) and DTASK_DTASK() is called to handle messages.