Initialisation SUBROUTINE xxx_yyy_INI( IRETC )
Processing SUBROUTINE xxx_yyy( IPRO_MODE, IRETC )
Delete Outputs SUBROUTINE xxx_yyy_DEL( IRETC )
Termination SUBROUTINE xxx_yyy_TRM( IRETC )
The xxx_yyy_INI and xxx_yyy_TRM routines are optional. Subordinate routines should all start xxx_.
For Asynchronous Processors, xxx_yyy_DEL must restore the data structure to its state before xxx_yyy was called (although a sequence of appends are reversed by a single xxx_yyy_DEL). xxx_yyy and xxx_yyy_DEL must be separate routines i.e. one cannot be an entry point in the other.
The xxx_yyy routine has to handle all supported types of processing mode (the IPRO_MODE parameter will be one of KSU_INSERT, KSU_REPLACE or KSU_APPEND as defined in su_mnemonics.inc). If the processor only supports one mode then this parameter may used to communicate other information to it.
The following code fragments, which assumes an asynchronous processor that does not support append, illustrates the way processing is reported to the DSM.
.
.
INCLUDE 'su_mnemonics.inc'
INCLUDE 'zunit.inc'
* Argument Declarations:-
* =====================
integer iretc, ipro_mode
.
.
logical inputs_exist
.
.
** The processor does not support APPEND mode.
if (ipro_mode .eq. ksu_append) then
write(iqlog,*) 'xxx_yyy does not support APPEND mode'
iretc = 1
return
endif
** Prepare data structure, rolling back downstream processing
** if required.
call dsm_pro_prepare( ksu_xxx, ipro_mode, iretc )
* If Data Structure Manager signals quit then no further
* action.
if (iretc .ne. KSU_OK) return
inputs_exist = .false.
.
.
Now search the data structure for inputs. If any found
then process them and set inputs_exist = .true.
.
.
** If any inputs exist signal processor complete to the Data
** Structure Manager.
if (inputs_exist) then
call dsm_pro_complete( ksu_xxx, iretc )
** Otherwise, warn of missing inputs.
else
write(iqprnt,*) 'xxx_yyy has nothing to process'
write(iqlog,*) 'xxx_yyy has nothing to process'
endif
return
* xxx ...
elseif (isu_id .eq. KSU_XXX) then
if (ioper .eq. KSU_INITIALISE) then
call xxx_yyy_ini(iretc)
elseif (ioper .eq. KSU_PROCESS) then
call xxx_yyy(mode,iretc)
elseif (ioper .eq. KSU_DELETE) then
call xxx_yyy_del(iretc)
elseif (ioper .eq. KSU_TERMINATE) then
call xxx_yyy_trm(iretc)
endif