?? NEWTITLE := '  NOS/VE Set Management ' ??
MODULE stm$read_job_set_table;
?? RIGHT := 110 ??
{
{ PURPOSE:
{   This module contains those procedure that merely read the job  active  set
{   table.
{
{ DESIGN:
{   Reference to  the  job  active  set  table  is  by  the  XREF'ed  variable
{   stv$p_jast.   There  is  a job active set table for each job.  This module
{   runs in ring 2 (223 ring bracket).

?? NEWTITLE := '  Global Declarations Referenced by this module' ??
?? PUSH (LISTEXT := ON) ??
*copyc stt$jast_index
?? POP ??
*copyc stv$p_jast
?? OLDTITLE ??
?? NEWTITLE := '  [XDCL, #GATE] stp$search_jast_for_set', EJECT ??
*copyc sth$search_jast_for_set

  PROCEDURE [XDCL, #GATE] stp$search_jast_for_set
    (    required_set: stt$set_name;
     VAR jast_entry: stt$job_active_set_entry;
     VAR set_found: boolean);

    VAR
      jast_index: integer;

    set_found := FALSE;
    IF stv$p_jast <> NIL THEN
      FOR jast_index := LOWERBOUND (stv$p_jast^.table) TO UPPERBOUND (stv$p_jast^.table) DO
        IF stv$p_jast^.table [jast_index].entry_type = stc$valid THEN
          IF stv$p_jast^.table [jast_index].set_name = required_set THEN
            jast_entry := stv$p_jast^.table [jast_index];
            set_found := TRUE;
            RETURN; {----->
          IFEND;
        IFEND;
      FOREND;
    IFEND;

  PROCEND stp$search_jast_for_set;
?? OLDTITLE ??
?? NEWTITLE := '  [XDCL] stp$search_jast_for_unique_set ', EJECT ??

  PROCEDURE [XDCL] stp$search_jast_for_unique_set
    (    required_set: stt$unique_set_name;
     VAR jast_entry: stt$job_active_set_entry;
     VAR set_found: boolean);

{  PURPOSE:
{    This procedure determines if the current job has previously accessed the
{    set.  This is done by searching the job active set table keyed by
{    unique set name.

    VAR
      jast_index: integer;

    set_found := FALSE;
    IF stv$p_jast <> NIL THEN
      FOR jast_index := LOWERBOUND (stv$p_jast^.table) TO UPPERBOUND (stv$p_jast^.table) DO
        IF stv$p_jast^.table [jast_index].entry_type = stc$valid THEN
          IF stv$p_jast^.table [jast_index].unique_set_name = required_set THEN
            jast_entry := stv$p_jast^.table [jast_index];
            set_found := TRUE;
            RETURN; {----->
          IFEND;
        IFEND;
      FOREND;
    IFEND;

  PROCEND stp$search_jast_for_unique_set;
?? OLDTITLE ??
?? NEWTITLE := '  [XDCL] stp$search_jast_for_unused', EJECT ??

  PROCEDURE [XDCL] stp$search_jast_for_unused
    (    stv$p_jast: ^stt$job_active_set_table;
     VAR jast_index: integer;
     VAR unused_found: boolean);

{  PURPOSE:
{    This procedure determines if there is any unused space in the job active
{    set table, if an unused entry is found, the index to that entry is
{    returned.

    VAR
      upper: stt$jast_index;

    unused_found := FALSE;
    IF stv$p_jast <> NIL THEN
      jast_index := LOWERBOUND (stv$p_jast^.table);
      upper := UPPERBOUND (stv$p_jast^.table);
      WHILE (NOT unused_found) AND (jast_index <= upper) DO
        IF stv$p_jast^.table [jast_index].entry_type = stc$unused THEN
          unused_found := TRUE;
        ELSE
          jast_index := jast_index + 1;
        IFEND;
      WHILEND;
    IFEND;

  PROCEND stp$search_jast_for_unused;
?? OLDTITLE ??
MODEND stm$read_job_set_table;
