?? NEWTITLE := '  NOS/VE Set Management ' ??
MODULE stm$translate_set_names;
?? RIGHT := 110 ??
{
{ PURPOSE:
{   This module includes procedures that translate from set name to set
{   ordinal.


?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc ste$error_condition_codes
*copyc stt$set_ordinal
?? POP ??
*copyc i#program_error
*copyc osp$set_status_abnormal
*copyc stp$clear_read_access
*copyc stp$get_active_volume_list
*copyc stp$search_ast_by_set
*copyc stp$search_ast_by_unique_set
*copyc stp$set_read_access
?? OLDTITLE ??
?? NEWTITLE := '  stp$get_pf_volumes', EJECT ??

  PROCEDURE [XDCL, #GATE] stp$get_pf_volumes
   (VAR pf_volumes: array [1 .. * ] OF rmt$recorded_vsn;
    VAR number_of_volumes: integer;
    VAR status: ost$status);

    VAR
      i: integer,
      p_jobs_scratch_volumes: ^stt$volume_list;

    status.normal := TRUE;
    number_of_volumes := 1;
    IF (LOWERBOUND(pf_volumes) <> 1) OR (UPPERBOUND(pf_volumes) > UPPERVALUE(i)) THEN
      i#program_error;
    IFEND;

    PUSH p_jobs_scratch_volumes: [1 .. UPPERBOUND (pf_volumes)];
    stp$get_active_volume_list (p_jobs_scratch_volumes^, number_of_volumes, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;
    FOR i := 1 TO UPPERBOUND (pf_volumes) DO
      IF i <= number_of_volumes THEN
        pf_volumes [i] := p_jobs_scratch_volumes^ [i].recorded_vsn;
      IFEND;
    FOREND;

  PROCEND stp$get_pf_volumes;
?? OLDTITLE ??
?? NEWTITLE := '  [XDCL] stp$get_sets_ordinal ', EJECT ??
*copyc sth$get_sets_ordinal

  PROCEDURE [XDCL] stp$get_sets_ordinal (set_name: stt$set_name;
    VAR set_ordinal: stt$set_ordinal;
    VAR master_vol: rmt$recorded_vsn;
    VAR status: ost$status);

    VAR
      ast_entry: stt$active_set_entry,
      ast_index: stt$ast_index,
      set_found: boolean;

    stp$set_read_access;
    stp$search_ast_by_set (set_name, ast_entry, ast_index, set_found);
    stp$clear_read_access;
    IF set_found THEN
      status.normal := TRUE;
      master_vol := ast_entry.master_vsn;
      set_ordinal.entry_type := stc$valid;
      set_ordinal.unique_set_name := ast_entry.unique_set_name;
    ELSE
      osp$set_status_abnormal (stc$set_management_id, ste$set_not_active, stc$null_parameter, status);
      set_ordinal.entry_type := stc$unused;
    IFEND;

  PROCEND stp$get_sets_ordinal;
?? OLDTITLE ??
?? NEWTITLE := '  [XDCL] stp$translate_set_ordinal ', EJECT ??
*copyc sth$translate_set_ordinal

  PROCEDURE [XDCL] stp$translate_set_ordinal (set_ordinal: stt$set_ordinal;
    VAR set_name: stt$set_name;
    VAR status: ost$status);

    VAR
      ast_entry: stt$active_set_entry,
      ast_index: stt$ast_index,
      set_found: boolean;

    status.normal := TRUE;
    IF set_ordinal.entry_type = stc$valid THEN
      stp$set_read_access;
      stp$search_ast_by_unique_set (set_ordinal.unique_set_name, ast_entry, ast_index, set_found);
      stp$clear_read_access;
      IF set_found THEN
        status.normal := TRUE;
        set_name := ast_entry.set_name;
      ELSE
        osp$set_status_abnormal (stc$set_management_id, ste$set_not_active, stc$null_parameter, status);
      IFEND;
    ELSE
      osp$set_status_abnormal (stc$set_management_id, ste$set_ord_not_set, stc$null_parameter, status);
    IFEND;

  PROCEND stp$translate_set_ordinal;
?? OLDTITLE ??
MODEND stm$translate_set_names;
