?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE Deadstart : Manage System Deadstart Status data' ??
MODULE dsm$manage_system_ds_status;

{ PURPOSE:
{   This module contains the procedures that are used to manage the System Deadstart Status data that
{   resides in the SSR.  This data is used in the System Deadstart Status statistic that is logged to the
{   Engineering log at every deadstart after the point of commitment.

?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc dst$rb_system_deadstart_status
?? POP ??
*copyc dsp$get_data_from_ssr
*copyc dsp$store_data_in_ssr
*copyc i#call_monitor
?? EJECT ??
*copyc dsv$mainframe_type
*copyc dsv$system_deadstart_status_p
*copyc osv$build_level
?? TITLE := 'dsp$save_sys_status_build_level', EJECT ??

{ PURPOSE:
{   This procedure saves the current build level in the System Deadstart Status data in the SSR.

  PROCEDURE [XDCL] dsp$save_sys_status_build_level;

    VAR
      system_deadstart_status: dst$ssr_system_deadstart_status,
      system_deadstart_status_seq_p: ^SEQ ( * );

    system_deadstart_status_seq_p := #SEQ (system_deadstart_status);
    dsp$get_data_from_ssr (dsc$ssr_system_deadstart_status, system_deadstart_status_seq_p);
    system_deadstart_status.general_info.os_release_identifier := osv$build_level;
    dsp$store_data_in_ssr (dsc$ssr_system_deadstart_status, #SEQ (system_deadstart_status));
    IF dsv$system_deadstart_status_p <> NIL THEN
      dsv$system_deadstart_status_p^.general_info.os_release_identifier := osv$build_level;
    IFEND;

  PROCEND dsp$save_sys_status_build_level;
?? TITLE := 'dsp$save_sys_status_current_ds', EJECT ??

{ PURPOSE:
{   This procedure saves the current deadstart type in the System Deadstart Status data in the SSR.

  PROCEDURE [XDCL] dsp$save_sys_status_current_ds
    (    current_deadstart: 0 .. 0f(16));

    VAR
      auto_restart: 0 .. 1,
      rb: dst$rb_system_deadstart_status,
      system_deadstart_status: dst$ssr_system_deadstart_status,
      system_deadstart_status_seq_p: ^SEQ ( * );

    system_deadstart_status_seq_p := #SEQ (system_deadstart_status);
    dsp$get_data_from_ssr (dsc$ssr_system_deadstart_status, system_deadstart_status_seq_p);
    system_deadstart_status.general_info.deadstarts_performed_code.current_deadstart := current_deadstart;
    IF dsv$mainframe_type = dsc$mt_2000_mainframe THEN
      rb.reqcode := syc$rc_system_deadstart_status;
      rb.action := dsc$rb_sds_retrieve_bct_flag;
      rb.bct_flags := dsc$rb_sds_bct_auto_restart;
      i#call_monitor (#LOC (rb), #SIZE (rb));
      IF rb.bct_flag_set THEN
        rb.reqcode := syc$rc_system_deadstart_status;
        rb.action := dsc$rb_sds_clear_bct_flag;
        rb.bct_flags := dsc$rb_sds_bct_auto_restart;
        i#call_monitor (#LOC (rb), #SIZE (rb));
        auto_restart := 1;
      ELSE
        auto_restart := 0;
      IFEND;
      system_deadstart_status.general_info.deadstarts_performed_code.auto_restart := auto_restart;
    IFEND;
    dsp$store_data_in_ssr (dsc$ssr_system_deadstart_status, #SEQ (system_deadstart_status));
    IF dsv$system_deadstart_status_p <> NIL THEN
      dsv$system_deadstart_status_p^.general_info.deadstarts_performed_code.current_deadstart :=
            current_deadstart;
      IF dsv$mainframe_type = dsc$mt_2000_mainframe THEN
        dsv$system_deadstart_status_p^.general_info.deadstarts_performed_code.auto_restart := auto_restart;
      IFEND;
    IFEND;

  PROCEND dsp$save_sys_status_current_ds;
?? TITLE := 'dsp$save_sys_status_ds_file', EJECT ??

{ PURPOSE:
{   This procedure saves the deadstart file source in the System Deadstart Status data in the SSR.

  PROCEDURE [XDCL] dsp$save_sys_status_ds_file
    (    deadstart_file_source: 0 .. 0ff(16));

    VAR
      system_deadstart_status: dst$ssr_system_deadstart_status,
      system_deadstart_status_seq_p: ^SEQ ( * );

    system_deadstart_status_seq_p := #SEQ (system_deadstart_status);
    dsp$get_data_from_ssr (dsc$ssr_system_deadstart_status, system_deadstart_status_seq_p);
    system_deadstart_status.general_info.deadstart_file_source := deadstart_file_source;
    dsp$store_data_in_ssr (dsc$ssr_system_deadstart_status, #SEQ (system_deadstart_status));
    IF dsv$system_deadstart_status_p <> NIL THEN
      dsv$system_deadstart_status_p^.general_info.deadstart_file_source := deadstart_file_source;
    IFEND;

  PROCEND dsp$save_sys_status_ds_file;
MODEND dsm$manage_system_ds_status;
