From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 20-JUL-1992 10:06:21.90
To:	info-vax@sri.com
CC:	
Subj:	OPCON  4/5

+-+-+-+ Beginning of part 4 +-+-+-+
X          call append(log_message)
X        else if (choice .eq. 5) then
X          status = sys$sndjbcw(,%val(sjc$_reset_queue),,submit_list,iosb,,)
X          if (status) status = iosb.sts
X          if (.not. status) call lib$signal (%val(status))`032
X          status = sys$sndjbcw(,%val(sjc$_start_queue),,submit_list,iosb,,)
X          if (status) status = iosb.sts
X          if (.not. status) call lib$signal (%val(status))`032
X          log_message = 'Flushed queue ' // queue_name
X          call append(log_message)
X        end if
X      end do
X     `032
X      status = smg$delete_virtual_display(queue_control_menu)
X     `032
X      end
$ GOSUB UNPACK_FILE

$ FILE_IS = "QUEUE_FIND.FOR"
$ CHECKSUM_IS = 1431200706
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X      subroutine queue_find(number_of_queues)
X
X****************************************************************************
X*                                                                          *
X*     Finds a list of queues on the system.  This is later used by         *
X*     the control queue and job selection routines.                        *
X*                                                                          *
X*                         Version 1.00    29-May-1992                      *
X*                         Version 1.00    29-May-1992                      *
X*                                                                          *
X****************************************************************************
X
X      implicit none
X
X      common /queues/  qname
X
X      include '($quidef)'
X
X      structure   /itmlst/
X        union
X          map
X            integer*2 buflen,itmcod
X            integer*4 bufadr,retadr
X          end map
X          map
X            integer*4 end_list
X          end map
X        end union
X      end structure
X
X      structure   /iosblk/
X        integer*4 sts,zeroed
X      end structure
X
X      integer   sys$getquiw
X
X      integer   i,j,k,l,m,n
X      integer   number_of_queues
X      integer   status
X      integer*2 queue_name_len
X      integer*2 search_name_len /1/
X      integer*4 search_flags
X
X      character*31  queue_name
X      character*31  qname(100)
X      character*1   search_name /'*'/
X
X      record /itmlst/ queue_list(4)
X      record /iosblk/ iosb
X
X      queue_list(1).buflen = search_name_len
X      queue_list(1).itmcod = qui$_search_name
X      queue_list(1).bufadr = %loc(search_name)
X      queue_list(1).retadr = 0
X      queue_list(2).buflen = 4
X      queue_list(2).itmcod = qui$_search_flags
X      queue_list(2).bufadr = %loc(search_flags)
X      queue_list(2).retadr = 0
X      queue_list(3).buflen = 31
X      queue_list(3).itmcod = qui$_queue_name
X      queue_list(3).bufadr = %loc(queue_name)
X      queue_list(3).retadr = %loc(queue_name_len)
X      queue_list(4).end_list = 0
X
X      search_flags = qui$m_search_wildcard
X
X      status = sys$getquiw(,%val(qui$_cancel_operation),,,,,)
X      if (.not. status) call lib$signal(%val(status))
X
X      i = 0
X
X      do while (status)
X
X        status = sys$getquiw(,%val(qui$_display_queue),,queue_list,iosb,,)
X        if (.not. status) call lib$signal(%val(status))
X
X        if (status) status = iosb.sts
X
X        if (status) then
X          i = i + 1
X          qname(i) = queue_name(1:queue_name_len)
X        end if
X
X      end do
X
X      number_of_queues = i
X
X      end
$ GOSUB UNPACK_FILE

$ FILE_IS = "QUEUE_MONITOR.FOR"
$ CHECKSUM_IS = 642312993
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X      subroutine queue_monitor
X
X****************************************************************************
X*                                                                          *
X*     This is a continous monitor of the state and number of entries in    *
X*     each queue.                                                          *
X*                                                                          *
X*                         Version 1.00    29-May-1992                      *
X*                         Version 1.00    29-May-1992                      *
X*                                                                          *
X****************************************************************************
X
X      implicit none
X
X      include     '($quidef)'
X      include     '($smgdef)'
X      include     'smg_common.for'
X
X      structure /qstatus/
X        character*20    name
X        character*12    status
X        character*4     current
X        character*4     waiting
X      end structure
X
X      structure   /itmlst/
X        union
X          map
X            integer*2 buflen,itmcod
X            integer*4 bufadr,retadr
X          end map
X          map
X            integer*4 end_list
X          end map
X        end union
X      end structure
X
X      structure   /iosblk/
X        integer*4 sts,zeroed
X      end structure
X
X      logical quit
X
X      character*31  queue_name
X      character*31  search_name /'*'/
X      character*43  label   /'Name                  Status       Cur Wait'/
X      character*80  line
X
X      integer   delay   /3/
X      integer   executing_jobs,pending_jobs,holding_jobs,retained_jobs
X      integer   i,j,k
X      integer   noacess,terminator
X      integer   number_of_jobs,number_of_queues
X      integer   qswindow
X      integer   queue_status
X      integer   status
X      integer   sys$getquiw
X      integer   timed_release_jobs
X      integer   waiting_jobs,current_jobs
X      integer*2 queue_name_len
X      integer*2 search_name_len /1/
X      integer*4 search_flags
X
X      record /iosblk/ iosb
X      record /itmlst/ queue_list(10)
X      record /qstatus/ queue(100)
X
X      quit = .false.
X
X******************************************
X*     Setup displays for queuestatus     *
X******************************************
X
X      status = smg$create_virtual_display(20,46,qswindow,smg$m_border,,)
X      status = smg$paste_virtual_display(qswindow,pbid,1,33)
X      status = smg$label_border(qswindow,label,,3,smg$m_reverse,,)
X
X      queue_list(1).buflen = search_name_len
X      queue_list(1).itmcod = qui$_search_name
X      queue_list(1).bufadr = %loc(search_name)
X      queue_list(1).retadr = 0
X      queue_list(2).buflen = 4
X      queue_list(2).itmcod = qui$_search_flags
X      queue_list(2).bufadr = %loc(search_flags)
X      queue_list(2).retadr = 0
X      queue_list(3).buflen = 31
X      queue_list(3).itmcod = qui$_queue_name
X      queue_list(3).bufadr = %loc(queue_name)
X      queue_list(3).retadr = %loc(queue_name_len)
X      queue_list(4).buflen = 4
X      queue_list(4).itmcod = qui$_queue_status
X      queue_list(4).bufadr = %loc(queue_status)
X      queue_list(4).retadr = 0
X      queue_list(5).buflen = 4
X      queue_list(5).itmcod = qui$_executing_job_count
X      queue_list(5).bufadr = %loc(executing_jobs)
X      queue_list(5).retadr = 0
X      queue_list(6).buflen = 4
X      queue_list(6).itmcod = qui$_holding_job_count
X      queue_list(6).bufadr = %loc(holding_jobs)
X      queue_list(6).retadr = 0
X      queue_list(7).buflen = 4
X      queue_list(7).itmcod = qui$_pending_job_count
X      queue_list(7).bufadr = %loc(pending_jobs)
X      queue_list(7).retadr = 0
X      queue_list(8).buflen = 4
X      queue_list(8).itmcod = qui$_retained_job_count
X      queue_list(8).bufadr = %loc(retained_jobs)
X      queue_list(8).retadr = 0
X      queue_list(9).buflen = 4
X      queue_list(9).itmcod = qui$_timed_release_job_count
X      queue_list(9).bufadr = %loc(timed_release_jobs)
X      queue_list(9).retadr = 0
X      queue_list(10).end_list = 0
X
X      search_flags = (qui$m_search_wildcard .or. qui$m_search_all_jobs)
X
X      do while (.not. quit)
X        status       = sys$getquiw(,%val(qui$_cancel_operation),,,,,)
X
X        i = 0
X
X        do while (status)       !Scan queues
X
X          status = sys$getquiw(,%val(qui$_display_queue),,queue_list,iosb,,)
X          if (.not. status) call lib$signal(%val(status))
X          if (status) status = iosb.sts
X          if (status) then
X            i = i + 1
X            queue(i).name = queue_name(1:queue_name_len)
X
X            call convert_status_queue(queue_status,queue(i).status)
X
X            current_jobs = executing_jobs + pending_jobs
X            waiting_jobs = holding_jobs + retained_jobs + timed_release_jobs
X
X            write (queue(i).current,'(i3)') current_jobs
X            write (queue(i).waiting,'(i3)') waiting_jobs
X
X          end if
X        end do
X
X        number_of_queues = i
X
X        status = smg$set_cursor_abs(qswindow,1,1)
X
X        do i =1,number_of_queues
X          line = ' ' // queue(i).name // '  ' // queue(i).status //
X     &           ' ' // queue(i).current // ' ' // queue(i).waiting
X          status = smg$put_line(qswindow,line)
X        end do
X
X        call getkey(delay,terminator)
X
X        if (terminator .eq. smg$k_trm_ctrlz) then
X          quit = .true.
X        else if (terminator .eq. smg$k_trm_ctrlw) then
X          status = smg$repaint_screen(pbid)
X        end if
X
X      end do
X
X      status = smg$delete_virtual_display(qswindow)
X
X      end
$ GOSUB UNPACK_FILE

$ FILE_IS = "QUEUE_SELECT.FOR"
$ CHECKSUM_IS = 589105473
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X      subroutine queue_select(subprogram)
X     `032
X****************************************************************************
X*                                                                          *
X*     Allows the user to select a queue to control.  (Start, stop, etc.)   *
X*     Also selects a queue whose jobs to display.                          *
X*                                                                          *
X*                         Version 1.00    29-May-1992                      *
X*                         Version 1.00    29-May-1992                      *
X*                                                                          *
X****************************************************************************
X`032
X      implicit none
X`032
X      common /queues/  qname
X`032
X      include '($smgdef)'
X      include 'smg_common.for'
X`032
X      integer status
X      integer i,j,k,l,m,n
X      integer queue_select_menu
X      integer choice
X      integer terminator
X`032
X      logical  quit
X`032
X      character*31  selected_queue
X      character*31  qname(100)
X      character*(*) subprogram
X`032
V      status = smg$create_virtual_display(14,32,queue_select_menu,smg$m_borde
Xr,,)
X      status = smg$create_menu(queue_select_menu,qname,smg$k_vertical,,,,)
X      status = smg$paste_virtual_display(queue_select_menu,pbid,4,5)
X`032
X      quit = .false.
X`032
X      do while (.not. quit)
V        status = smg$select_from_menu(kb,queue_select_menu,choice,,,,,termina
Xtor,
X     &           selected_queue,,)
X`032
X        if (terminator .eq. smg$k_trm_ctrlz) then
X          quit = .true.
X        else           !Route to proper subroutine
X          if (subprogram .eq. 'queue_control') then
X            call queue_control(selected_queue)
X          else if (subprogram .eq. 'job_display') then
X            call job_display(selected_queue)
X          end if
X        end if
X      end do
X`032
X      status = smg$delete_virtual_display(queue_select_menu)
X`032
X      end
$ GOSUB UNPACK_FILE

$ FILE_IS = "SEND.FOR"
$ CHECKSUM_IS = 409415880
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X      subroutine send(username)
X     `032
X****************************************************************************
X*                                                                          *
X*     This sends out a message marked urgent to a specified user or to     *
X*     every user on the system.  This is useful for making announcements   *
X*     especially for remote users.                                         *
X*                                                                          *
X*                         Version 1.00    29-May-1992                      *
X*                         Version 1.00    29-May-1992                      *
X*                                                                          *
X****************************************************************************
X
X      implicit none
X     `032
X      include '($brkdef)'
X      include '($smgdef)'
X      include 'smg_common.for'
X
X      logical quit
X     `032
X      integer   status,timeout
X      integer   send_type
X      integer   sys$brkthruw
X      integer   time_out
X      integer   message_len
X      integer   terminator
X      integer   send_id
X     `032
X      character*12  username
X      character*100 message
X      character*10  prompt /'Message:  '/
X     `032
X      status = smg$create_virtual_display(2,60,send_id,smg$m_border,,)
X      status = smg$paste_virtual_display(send_id,pbid,10,8)
X      status = smg$read_string(kb,message,prompt,100,,,,message_len,
X     &         terminator,send_id,,,,)
X     `032
X      if (terminator .eq. smg$k_trm_ctrlz) then
X        quit = .true.
X      else if (terminator .eq. smg$k_trm_ctrlw) then
X        status = smg$repaint_screen(pbid)
X      else
X        if (username .eq. 'ALL USERS') then
X          send_type = brk$c_allusers
X        else
X          send_type = brk$c_username
X        end if
X
X        status = sys$brkthruw(,message,username,%val(send_type),,,,
X     &           %val(brk$c_urgent),%val(time_out),,)
X        if (.not. status) call lib$signal(%val(status))
X      end if
X     `032
X      status = smg$delete_virtual_display(send_id)
X       `032
X      end
$ GOSUB UNPACK_FILE

$ FILE_IS = "SMG_COMMON.FOR"
$ CHECKSUM_IS = 1281442373
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X****************************************************
X*     Variables and common block for SMG stuff     *
X****************************************************
X
X      common /smg/ pbid,kb,old_messages_id`032
X      integer   pbid,kb,old_messages_id`032
X     `032
X      integer   smg$put_line,smg$create_virtual_display,smg$create_pasteboard
V      integer   smg$paste_virtual_display,smg$erase_display,smg$repaint_scree
Xn
X      integer   smg$create_menu,smg$label_border
X      integer   smg$delete_virtual_display
X      integer   smg$create_virtual_keyboard
X      integer   smg$set_cursor_abs
X      integer   smg$select_from_menu
X      integer   smg$delete_pasteboard
X      integer   smg$read_keystroke     `032
X      integer   smg$read_string
X      integer   smg$set_broadcast_trapping
X      integer   smg$get_broadcast_message
X      integer   smg$unpaste_virtual_display
X      integer   smg$cancel_input
X     `032
$ GOSUB UNPACK_FILE

$ FILE_IS = "USER_SELECT.FOR"
$ CHECKSUM_IS = 2131760685
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X      subroutine user_select
X
X****************************************************************************
X*                                                                          *
-+-+-+-+-+ End of part 4 +-+-+-+-+-

