program testit ! Copyright (c) 1988, Michael W. Wheeler !labels !usr_interface: - used to bypass the heart of this main routine ! and go directly to the user interface. !constants %include "$jbcmsgdef" %from %library "sys$library:basic$starlet.tlb" %include "$quidef" %from %library "sys$library:basic$starlet.tlb" %include "$smgdef" %from %library "sys$library:basic$starlet.tlb" %include "$smgmsg" %from %library "sys$library:basic$starlet.tlb" %include "smg$routines" %from %library "sys$library:basic$starlet.tlb" %include "$smgtrmptr" %from %library "sys$library:basic$starlet.tlb" %include "$ssdef" %from %library "sys$library:basic$starlet.tlb" external long constant cli$_present !types record itmlst word buflen, itmcod long bufadr, retadr end record record iosblk long io_status, reserved end record !variables declare long sys_status, nullarg, search_flags, & lines, direction, msg_dpid, p1 declare byte recall_lines declare itmlst quelist(5%) declare iosblk iosb declare string queuename, file_name, prompt %include "que_struct.bas" !procedures !functions external long function sys$getquiw, & get_que_info, & init_smg, & write_display( long, long ), & user_interface, & cli$present, & cli$get_value, & file_exists( string ), & read_logfile( string ), & write_logfile( string ), & confirm( string ), & window_message( string, long, long ), & get_queues( string ), & ! get_queue_type, & get_que_choice, & get_broadcast_msgs( long ) !pbid = 0% !recall_lines = 0% !logfile_data = 0% p1 = 0% queue_type = (qui$m_search_symbiont or qui$m_search_batch) sys_status = init_smg if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if if cli$present( "queue_name" by desc ) = cli$_present then sys_status = cli$get_value( "queue_name" by desc, & queuename by desc, ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if p1 = -1% first_entry = -1% if queuename <> "*" then queue_spec = -1% end if sys_status = get_queues( queuename by desc ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if if queue_name_len = 0% then if queue_count > 1% then sys_status = get_que_choice if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if if menu_choice = 0% then sys_status = get_broadcast_msgs( pbid ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if exit program sys_status else goto usr_interface ! queuename = available_queues(menu_choice) ! search_queue = queuename end if end if else queue_spec = 0% sys_status = get_queues( "" by desc ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if end if search_flags = (queue_type or qui$m_search_all_jobs or & qui$m_search_wildcard) ! file_name = "sys$scratch:" + mid(queue_name, 1%, queue_name_len) + ".log" if queue_name_len = 0% then quelist(1%)::buflen = len(queuename) quelist(1%)::itmcod = qui$_search_name quelist(1%)::bufadr = loc(search_queue) quelist(1%)::retadr = 0% quelist(2%)::buflen = 4% quelist(2%)::itmcod = qui$_search_flags quelist(2%)::bufadr = loc(search_flags) quelist(2%)::retadr = 0% quelist(3%)::buflen = len(queue_name) quelist(3%)::itmcod = qui$_queue_name quelist(3%)::bufadr = loc(queue_name) quelist(3%)::retadr = loc(queue_name_len) quelist(4%)::buflen = 4% quelist(4%)::itmcod = qui$_queue_flags quelist(4%)::bufadr = loc(qflags) quelist(4%)::retadr = 0% quelist(5%)::buflen = 0% quelist(5%)::itmcod = 0% else quelist(1%)::buflen = queue_name_len quelist(1%)::itmcod = qui$_search_name quelist(1%)::bufadr = loc(queue_name) quelist(1%)::retadr = 0% quelist(2%)::buflen = 4% quelist(2%)::itmcod = qui$_search_flags quelist(2%)::bufadr = loc(search_flags) quelist(2%)::retadr = 0% quelist(3%)::buflen = 4% quelist(3%)::itmcod = qui$_queue_flags quelist(3%)::bufadr = loc(qflags) quelist(3%)::retadr = 0% quelist(4%)::buflen = 0% quelist(4%)::itmcod = 0% end if ! if not(p1) then ! sys_status = get_queue_type ! if (sys_status and 1%) = 0% then ! call lib$signal( sys_status by value ) ! end if ! end if ! Make sure any context blocks are released. sys_status = sys$getquiw( , & qui$_cancel_operation by value, & nullarg by value,, & iosb by ref,, ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if ! until iosb::io_status <> jbc$_normal sys_status = sys$getquiw( , & qui$_display_queue by value, & nullarg by value, & quelist(1%) by ref, & iosb by ref,, ) if (sys_status and 1%) = 0% then call lib$stop( sys_status by value ) else if (iosb::io_status <> jbc$_nomoreque) and & (iosb::io_status <> jbc$_normal) then call lib$stop( iosb::io_status by value ) end if end if if iosb::io_status = jbc$_normal then ! if file_exists( file_name ) then ! sys_status = smg$create_pasteboard( pbid by ref,, & ! tt_rows by ref, & ! tt_cols by ref, ) ! if (sys_status and 1%) = 0% then ! call lib$signal( sys_status by value ) ! end if ! sys_status = smg$create_virtual_keyboard( kbid by ref,,,, & ! recall_lines by ref ) ! if (sys_status and 1%) = 0% then ! call lib$signal( sys_status by value ) ! end if ! prompt = "There is a log file for this queue. Do you wish to read it? [No]: " ! if confirm( prompt ) then ! prompt = "Reading logfile. Please wait..." ! sys_status = window_message( prompt, 0%, msg_dpid ) ! if (sys_status and 1%) = 0% then ! call lib$signal( sys_status by value ) ! end if ! sys_status = read_logfile( file_name ) ! if (sys_status and 1%) = 0% then ! call lib$signal( sys_status by value ) ! end if ! sys_status = smg$delete_virtual_display( msg_dpid by ref ) ! if (sys_status and 1%) = 0% then ! call lib$signal( sys_status by value ) ! end if ! else ! sys_status = get_que_info ! if (sys_status and 1%) = 0% then ! call lib$signal( sys_status by value ) ! end if ! end if ! else ! sys_status = get_que_info ! if (sys_status and 1%) = 0% then ! call lib$signal( sys_status by value ) ! end if ! end if queue_flags = qflags sys_status = get_que_info if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if end if ! next if menu_choice = 0% then sys_status = write_display( screen, datalines ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if end if else ! sys_status = get_queue_type ! if (sys_status and 1%) = 0% then ! call lib$signal( sys_status by value ) ! end if ! if menu_choice = 0% then ! sys_status = get_broadcast_msgs( pbid ) ! if (sys_status and 1%) = 0% then ! call lib$signal( sys_status by value ) ! end if ! exit program sys_status ! end if sys_status = get_queues( "" by desc ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if sys_status = get_que_choice if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if if menu_choice = 0% then sys_status = get_broadcast_msgs( pbid ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if exit program sys_status end if end if usr_interface: sys_status = user_interface if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if !if logfile_data = 0% then ! sys_status = write_logfile( file_name ) ! if (sys_status and 1%) = 0% then ! call lib$signal( sys_status by value ) ! end if !end if sys_status = get_broadcast_msgs( pbid ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if end program sys_status