14000 !-------------------------------------------------------------------- & ! & ! Determine and Open Printer Device & ! & !-------------------------------------------------------------------- & ! & ! input: M11.OUTPUT.FORM$ S, F, L = Short, Full, Label format & ! PRM.PRT.- printer parameters & ! & ! output: CH.PRT% printer channel number & ! PRT.QUEABLE% whether the output device is queable & ! PRT.QUE.STRING$ SYS call string to que the file & ! PRT.FILE$ name of the device or file & ! PRT.DEV$ 2-character device code & ! + 00 if generic (eg, LP:) & ! + devnum + -1 if device number spec. & ! F.END% = TRUE if a control Z was typed & ! & ! local: & ! ANS$ temporary storage for user response & ! COLON% position of colon in device specifier & ! DEV.NUM% number of the device drive (one byte) & ! LBASE% offset to screen line for devices & ! PRT% index into parameter device array & ! WIDE% whether the device can do 132 char. & ! & !-------------------------------------------------------------------- & 499 & MAP (DUMMY) DEV.NUM% & \ MAP (DUMMY) DEV.NUM.BYTE.1$ = 1% & ,FILL$ = 1% & 14010 LBASE% = 11% & \ PRT.FILE$ = "" & \ WIDE% = TRUE% & ! Define constants. & 14100 CALL M11SCD (SCR.OUTPUT.LOC%) & \ FOR PRT% = 0% TO 4% & \ GO TO 14119 IF PRM.PRT.DEV$(PRT%) = "NL:" & \ CALL M11SCW (STR$(PRT%+1%), LBASE%+PRT%, 17%) & \ CALL M11SCW ("=", LBASE%+PRT%, 20%) & \ CALL M11SCW (PRM.PRT.NAM$(PRT%), LBASE%+PRT%, 24%) 14119 NEXT PRT% & ! Display the types of printing devices available for the user. & 14120 CALL M11SCR (ANS$, 21%, 40%, 1%, "D", "A", F.END%) & \ RETURN IF F.END% & ! Request a type of printer (or disk file) from user. & 14140 IF ANS$ = "?" THEN CALL M11SCD (SCR.HLP.15%) & \ M11.MSG$ = "" & \ GO SUB 14900 & \ GO TO 14100 & ! Go show help screen, wait for user to read it and the return & ! to the original question. & 14160 IF POS ("D12345", ANS$, 1%) = 0% THEN & M11.MSG$ = "Type in D, 1, 2, 3, 4, or 5 (or ?, or END)." & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ GO TO 14120 & ! Show help message and the return to the original question. & 14180 PRT.DEVICE.ANS$ = ANS$ & \ IF ANS$ = "D" & & THEN CALL M11SCR (PRT.FILE$, 9%, 43%, 26%, "", "A", F.END%) & \ RETURN IF F.END% & \ PRT.FILE$ = TRM$(PRT.FILE$) + ".TMP" & IF POS (PRT.FILE$, ".", 1%) = 0% & \ CALL M11SCW (PRT.FILE$,9%,43%) & \ PRT.FILE$ = TRM$(PRM.DEFAULT.MLF.LOC$) + TRM$(PRT.FILE$) & IF POS (PRT.FILE$, ":", 1%) = 0% & \ PRT.QUEABLE% = FALSE% & \ GO TO 14300 & ! Ask the user for the name of the disk file to print to. & & ELSE PRT% = VAL (ANS$) - 1% & \ PRT.FILE$ = PRM.PRT.DEV$(PRT%) & \ GO TO 14120 IF PRT.FILE$ = "NL:" & \ WIDE% = FALSE% IF PRM.PRT.LEN%(PRT%) < 132% & \ IF PRM.PRT.COD$(PRT%) = "Q" THEN PRT.QUEABLE% = TRUE% & ELSE PRT.QUEABLE% = FALSE% & ! Determine if the device is queable. & 14200 IF M11.OUTPUT.FORM$ = "F" AND NOT WIDE% THEN & M11.MSG$ = "That printing device is not wide enough to handle a full listing." & \ CALL M11SCW (M11.MSG$, 23%, 1%) & \ M11.MSG$ = "Do you wish to choose another device (Y/N)" & \ CALL M11SCW (M11.MSG$, 24%, 1%) & \ CALL M11SCR (ANS$, 24%, 45%, 1%, "Y", "A", F.END%) & \ RETURN IF F.END% & \ CALL M11SCW (ERASE.EOS$, 23%, 1%) & \ GO TO 14010 IF ANS$ = "Y" & ! Check the printer length and warn the user, if necessary. & 14300 GO TO 14320 IF NOT PRT.QUEABLE% & & \ DIM S.TRMNO.STR%(30%) & \ CHANGE SYS (CHR$(6%)+CHR$(26%)+CHR$(0%)+CHR$(0%)) TO S.TRMNO.STR% & \ SUB.TRMNO% = S.TRMNO.STR%(4%) - ((S.TRMNO.STR%(4%)/10%)*10%) & ! Now we've got the last digit of the keyboard #... & & \ M11.MSG$ = "Listings will be queued to device " & + PRM.PRT.DEV$(PRT%) & \ PRT.FILE$ = NUM1$ (SUB.TRMNO%) + NUM1$ (TIME(0%)) + ".TMP" & \ PRT.DEV$ = SEG$ (PRM.PRT.DEV$(PRT%), 1%, 2%) & \ COLON% = POS (PRM.PRT.DEV$(PRT%), ":", 3%) & \ IF COLON% = 3% & THEN PRT.DEV$ = TRM$( PRT.DEV$) + STRING$ (2%, 0%) & ELSE DEV.NUM% = VAL(SEG$(PRM.PRT.DEV$(PRT%),3%,COLON%-1%)) & \ PRT.DEV$ = TRM$(PRT.DEV$) + DEV.NUM.BYTE.1$ + CHR$(-1%) 14310 PRT.QUE.STRING$ = & CHR$(6%) ! FIP - File Processor & + CHR$(-28%) ! Spooling request code & + STRING$ (2%, 0%) ! not used & + STRING$ (2%, 0%) ! use current user account & + SEG$ (FSS$ (PRT.FILE$, 1%), 7%, 12%) & + PRT.DEV$ ! spool to requested device & + STRING$ (2%, 0%) ! reserved, must be zero & + CHR$(4%) ! delete file when thru & + STRING$ (2%, 0%) ! reserved, must be zero & + STRING$ (8%, 0%) & \ GO TO 14350 & 14320 M11.MSG$ = "Listings will be sent to " & + "file " + PRT.FILE$ IF ANS$ = "D" & \ M11.MSG$ = "Listings will be sent to " & + "device " + PRT.FILE$ UNLESS ANS$ = "D" & & ! A unique file name is defined for the temporary file used to store & ! the information being queued to a printer. It is defined as the & ! number of seconds since midnight. This allows multiple files to be & ! queued up without overwriting. (They are automatically deleted & ! after being printed.) & ! Open device and develop user message. & ! Notify user that the request is being fulfilled. & 14350 CALL M11SCW (M11.MSG$, 24%, 1%) & \ SLEEP 1% & \ ON ERROR GO TO 14390 & \ OPEN PRT.FILE$ FOR OUTPUT AS FILE #CH.PRT%, MODE 128% & \ ON ERROR GO TO 19000 & ! Tell user what is happening. & ! (Hold the message on the screen long enough for it to be read.) & ! Open appropriate file, if it is not already there. & 14380 RETURN & & !-------------------------------------------------------------------- & 14390 RESUME 14391 & 14391 M11.MSG$ = "Error in opening " + PRT.FILE$ & \ M11.MSG$ = "File name is invalid as specified." IF ERR = 2 & \ M11.MSG$ = "Account or device in use." IF ERR = 3 & \ M11.MSG$ = "Specified device is full." IF ERR = 4 & \ M11.MSG$ = "Specified account does not exist." IF ERR = 5 & \ M11.MSG$ = "Specified device does not exist." IF ERR = 6 & \ M11.MSG$ = "That device isn't available." IF ERR = 8 & \ M11.MSG$ = "Disk pack mounted for read only." IF ERR = 10 & \ M11.MSG$ = "Specified device is write protected." IF ERR = 14 & \ M11.MSG$ = "That output file already exists." IF ERR = 16 & \ M11.MSG$ = "No pack mounted on specified device." IF ERR = 21 & \ M11.MSG$ = "Disk pack is locked out." IF ERR = 22 & \ M11.MSG$ = "Pack on specified device is private." IF ERR = 24 & \ M11.MSG$ = TRM$ (M11.MSG$) +" Someone logged onto that terminal?" & IF SEG$ (PRT.FILE$, 1%, 2%) = "KB" AND ERR = 8 & \ GO SUB 14900 & \ GO TO 14010 & ! Print out specific error message, then return to try again. &