! ----- GET_DEFAULT_QUEUE.FUN ----- ! ! ----- SUBROUTINE TO GET DEFAULT PRINT QUEUE ----- ! ! ---------- PASSED: ---------- ! ! ----- ACTION_INDEX = User-entered program action array index ! ----- BACKWARDS = TRUE if we're moving backwards thru prompts ! ----- DEBUG_MODE = TRUE if Debug Mode was enabled ! ----- DIV = User-entered division for this new user ! ----- PLEASE_TRY_AGAIN = "Please Try Again" error message ! ----- QUEUE_CTR = Count of default queues ! ----- QUEUE_DIVISIONS() = Default print queue divisions ! ----- QUEUE_DEFAULTS() = Default print queue number for div ! ----- QUEUE_PROMPTS() = Default print queue prompt string ! ----- QUEUE_QUEUE_CNTS() = Count of default queues for div ! ----- QUEUE_QUEUE() = Default print queues ! ----- USER_ACTIONS(ACTION_INDEX) = Main Program action ! ! ---------- RETURNED: ---------- ! ! ----- ACTION_SEQ = Next User Input Sequence routine (999 if ! ----- done with all user prompting) ! ----- BACKWARDS = TRUE if we're moving backwards thru prompts ! ----- PRTQ = User-entered Default Print Queue ! ! ----- Last Change 09/17/93 by Brian Lomasky ----- ! SUB GET_DEFAULT_QUEUE(WORD PRTQ) %INCLUDE "NUSER.INC" DECLARE LONG DEFAULT_INDEX ! DEFAULT PRINT QUEUE INDEX DECLARE STRING DEFAULT_QUEUE ! DEFAULT PRINT QUEUE TO DISPLAY DECLARE STRING ENTERED_QUE ! USER-ENTERED PRINT QUEUE NUMB DECLARE LONG MATCHING_DIV_INDEX ! MATCHING ARRAY INDEX FOR DIV DECLARE WORD Q ! TEMPORARY QUEUE ARRAY INDEX DECLARE WORD RECORD_FOUND ! TRUE IF MATCHING RECORD FOUND DECLARE WORD TEMP ! TEMPORARY WORD VARIABLE DECLARE STRING TEMP_STRING ! TEMPORARY STRING VARIABLE DECLARE WORD VALID_ENTRY ! TRUE IF VALID ENTRY PRTQ = -1% ! DEFAULT OF NO DEFAULT QUEUE ! ----- LOCATE THE MATCHING DIVISION FOR THIS DEFAULT ----- ! ----- PRINT QUEUE, IF ANY ----- TEMP = 0% MATCHING_DIV_INDEX = 0% WHILE TEMP < QUEUE_CTR ! FOR EACH DIVISION DEFAULT QUE: TEMP = TEMP + 1% IF QUEUE_DIVISIONS(TEMP) = DIV THEN ! ----- STORE INDEX OF MATCHING DIVISION ----- MATCHING_DIV_INDEX = TEMP TEMP = QUEUE_CTR! SET TO EXIT LOOP END IF NEXT ! ----- DONE IF NO MATCHING DIVISION ----- IF MATCHING_DIV_INDEX = 0% THEN IF BACKWARDS THEN ACTION_SEQ = ACTION_SEQ - 1% ELSE ACTION_SEQ = ACTION_SEQ + 1% END IF ! ----- DONE IF WE ARE COPYING THIS USER'S ACCOUNT ----- ACTION_SEQ = 999% IF COPY_USERS_ACCOUNT EXIT SUB END IF ! ----- DONE IF NO DEFAULT QUEUES FOR THIS DIVISION ----- IF QUEUE_QUEUE_CNTS(MATCHING_DIV_INDEX) = 0% THEN IF BACKWARDS THEN ACTION_SEQ = ACTION_SEQ - 1% ELSE ACTION_SEQ = ACTION_SEQ + 1% END IF ! ----- DONE IF WE ARE COPYING THIS USER'S ACCOUNT ----- ACTION_SEQ = 999% IF COPY_USERS_ACCOUNT EXIT SUB END IF BACKWARDS = FALSE ! NOT MOVING BACK THRU PROMPTS VALID_ENTRY = FALSE WHILE NOT VALID_ENTRY PRINT RECORD_FOUND = TRUE ! ----- EXTRACT AND PRINT THE PROMPT STRING ----- TEMP_STRING = QUEUE_PROMPTS(MATCHING_DIV_INDEX) ! ----- REPLACE ANY "ddd" WITH THE DIVISION ----- TEMP = POS(TEMP_STRING, "ddd", 1%) WHILE TEMP <> 0% TEMP_STRING = LEFT(TEMP_STRING, & TEMP - 1%) + DIV + & RIGHT(TEMP_STRING, TEMP + 3%) TEMP = POS(TEMP_STRING, "ddd", 1%) NEXT PRINT TEMP_STRING ! ----- PRINT EACH DEFAULT PRINT QUEUE ----- Q = 0% DEFAULT_QUEUE = "" DEFAULT_INDEX = -1% WHILE Q < QUEUE_QUEUE_CNTS(MATCHING_DIV_INDEX) Q = Q + 1% TEMP_STRING = QUEUE_QUEUE( & MATCHING_DIV_INDEX, Q) ! ----- REPLACE ANY "ddd" WITH DIVISION ----- TEMP = POS(TEMP_STRING, "ddd", 1%) WHILE TEMP <> 0% TEMP_STRING = LEFT(TEMP_STRING, & TEMP - 1%) + DIV + & RIGHT(TEMP_STRING, TEMP + 3%) TEMP = POS(TEMP_STRING, "ddd", 1%) NEXT PRINT " " + NUM1$(Q - 1%) + ") " + TEMP_STRING IF QUEUE_DEFAULTS(MATCHING_DIV_INDEX) = Q THEN DEFAULT_INDEX = Q - 1% DEFAULT_QUEUE = TEMP_STRING END IF NEXT PRINT " (Default of " + DEFAULT_QUEUE + ")" & IF DEFAULT_QUEUE <> "" WHEN ERROR IN LINPUT #98%, & " Enter one of the above numbers: "; & ENTERED_QUE USE RECORD_FOUND = FALSE CONTINUE END WHEN IF NOT RECORD_FOUND THEN BACKWARDS = TRUE! MOVING BACK THRU PROMPTS IF COPY_USERS_ACCOUNT THEN ! ----- SET TO GET USERNAME ----- ACTION_SEQ = 1% ELSE ACTION_SEQ = ACTION_SEQ - 1% END IF EXIT SUB END IF ! ----- UPPERCASE AND DISCARD ANY GARBAGE CHARS ----- ENTERED_QUE = EDIT$(ENTERED_QUE, 38%) IF ENTERED_QUE = "B" THEN BACKWARDS = TRUE! MOVING BACK THRU PROMPTS IF COPY_USERS_ACCOUNT THEN ! ----- SET TO GET USERNAME ----- ACTION_SEQ = 1% ELSE ACTION_SEQ = ACTION_SEQ - 1% END IF EXIT SUB END IF ENTERED_QUE = NUM1$(DEFAULT_INDEX) IF ENTERED_QUE = "" ! ----- SEE IF A VALID CHOICE WAS MADE ----- Q = 0% WHILE Q < QUEUE_QUEUE_CNTS(MATCHING_DIV_INDEX) Q = Q + 1% IF ENTERED_QUE = NUM1$(Q - 1%) THEN ! ----- RETURN USER-ENTERED QUEUE ----- PRTQ = Q ! ----- SET TO EXIT LOOP ----- Q = 999% END IF NEXT IF PRTQ < 1% THEN PRINT PRINT "Error - Invalid response" + & TRM$(PLEASE_TRY_AGAIN) PRINT ITERATE END IF PRINT VALID_ENTRY = TRUE NEXT ! ----- CONTINUE WITH DESIRED PROMPT ----- ACTION_SEQ = ACTION_SEQ + 1% ! ----- DONE IF WE ARE COPYING THIS USER'S ACCOUNT ----- ACTION_SEQ = 999% IF COPY_USERS_ACCOUNT END SUB