1 SUB M11SFB & 2 !******************************************************************** & ! & ! & ! M11SFB & ! & ! Routine to fillup the Screen File & ! & ! & !******************************************************************** & ! 3 ! Program : M11SFB & ! Revision : 01 29-Dec-81 & ! Programmer : John Montrym & ! Releaser : Jean Fullerton & ! Patcher : Don Gohn & ! Patch releaser: & ! 11 !******************************************************************** & ! & ! C O P Y R I G H T & ! 20 !******************************************************************** & ! & ! & ! Modification History & ! & ! & ! REV REVISION DATE REASON & ! --- -------- ---- ------ & ! 01 20-Aug-82 1. Converted to a subprogram & ! (callable from SMAILU) & ! 2. Gets names of screen input & ! files from Master Screen File & ! (SMMSF.DAT) instead of & ! prompting user for them & ! 3. Reduced and changed & ! informational messages & ! displayed at terminal & ! 100 !-------------------------------------------------------------------- & ! & ! Summary & ! & ! & ! This subprogram takes the contents of a series of ASCII stream & ! files containing help screens and stores them in 510-byte records & ! in the Mail-11 system help screen relative file. Each ASCII stream & ! file is stored in 3 510-byte records. The name of each ASCII file & ! is read from the Master Screen File, another ASCII file which & ! contains the names of each screen file. & ! & ! Please note: In order to get all the text you want, the last line & ! of your ASCII input file should end with a terminator; in & ! other words, don't try to get the cursor to stay at the end of the & ! last line displayed -- let it go to the beginning of the next line. & ! 200 !-------------------------------------------------------------------- & ! & ! Interfaces & ! & ! COMERR - Common Error buffer & ! MAPPRM - System Parameter File buffer & ! MAPCUS - Constants and variables needed by this SMAILU & ! and it's three subprograms & ! 300 !-------------------------------------------------------------------- & ! & ! Input / Output & ! & ! Channel File Name MAP Name Status at entry/exit & ! ------- --------- -------- -------------------- & ! CH.KB% "KB:" INBUF OPEN/OPEN & ! CH.CMD% MASTER.CMD.FILE$ none *CLOSED/CLOSED & ! CH.SCR% PRM.SCREEN.FILE$ none CLOSED/CLOSED & ! CH.PRM% "M11PAR.DAT" MAPPRM CLOSED/CLOSED & ! CH.SCI% INPUT.FILESPEC$ none CLOSED/CLOSED & ! CH.MSF% MASTER.SCREEN.FILE$ none CLOSED/CLOSED & ! & ! * This file is not used by this module. However, the channel & ! will be open if the subprogram M11FLC was called prior & ! to execution of this module & ! 400 !-------------------------------------------------------------------- & ! & ! Variable and Array Definitions & ! & ! & ! A$ Dynamic string which will buffer & ! entire screen input file & ! B$ Dynamic string which will buffer & ! one screen input file record & ! C Used to set up CNTRL c trapping & ! C$ Buffer to hold record written to & ! output screen file & ! CNT% Subscript to control which of the & ! 3 output records we are processing & ! for the current screen & ! EOF% End of file for screen input file & ! ERL Line in which error occurred & ! ERR Set to error after error & ! INPUT.FILESPEC$ Name of the current screen input file & ! LEN.A% Total length of A$ & ! MASTER.SCREEN.FILE$ Name of file that contains names of & ! all the ASCII screen files & ! NULLFILL% number of nulls needed to fill out & ! 510 byte record & ! PARM.FILE$ Name of System Parameter file & ! RECSIZ% Constant which indicates size of & ! output file record (510 bytes) & ! SCR.NUMBER% Record number for the next record & ! written to the output file & ! SCREEN.INTERVAL% Constant which indicates how many & ! 510 byte records used for each & ! screen (3) & ! START% Pointer to next 510 bytes in A$ & ! 600 !-------------------------------------------------------------------- & ! & ! & ! C O M M O N D E C L A R A T I O N S & ! & ! & !-------------------------------------------------------------------- & 601 ! Append COMERR.601 here. & 650 !-------------------------------------------------------------------- & ! & ! & ! M A P S T A T E M E N T S & ! & ! & !-------------------------------------------------------------------- & 700 !-------------------------------------------------------------------- & ! & ! Subprograms: & ! & ! Name Description & ! ---- ----------- & ! 800 !-------------------------------------------------------------------- & ! & ! Subroutines: & ! & ! Line Number Description & ! ---- ------ ----------- & ! & !-------------------------------------------------------------------- & ! & ! Functions: & ! & ! Name Description & ! ---- ----------- & ! & ! FN.GET.DATA$ Get string data from the parameter file & ! & !-------------------------------------------------------------------- & 900 !*************************************************************** & ! & ! & ! D I M E N S I O N D E C L A R A T I O N S & ! & ! & !*************************************************************** & & & 1000 !*************************************************************** & ! & ! & ! S T A R T P R O G R A M L O G I C & ! & ! & !*************************************************************** & 1010 ON ERROR GOTO 19000 & \ ERR.CALLNAM$ = "SMAILU VER:00" & \ ERR.SUBNAM$ = "M11SFB VER:00" & \ ERR.MSG$ = "Unexpected fatal error in M11SFB" & \ C = CTRLC & \ WAIT 0% & \ MASTER.SCREEN.FILE$ = EDIT$(TASK.DEV.ACCT$,128%) + "SMMSF.DAT" & \ RECSIZ% = 510% & \ SCREEN.INTERVAL% = 3% & \ PRINT #CH.KB%, CR;LF;LF;"Build Screen File";CR;LF;LF;LF & \ SLEEP 5% & ! Set standard error trap. Initialize constants. & 1020 OPEN MASTER.SCREEN.FILE$ FOR INPUT AS FILE #CH.MSF% & ! Open the Master Screen File which will contain the names of all the & ! screen input files. & 1025 GO TO 1030 IF PARMS.READ.IN% & \ PARM.FILE$ = TASK.DEV.ACCT$ + "SMPAR.DAT" & \ OPEN PARM.FILE$ FOR INPUT AS FILE #CH.PRM% & \ DUMMY$ = FN.GET.DATA$ & \ DUMMY$ = FN.GET.DATA$ & \ PRM.SCREEN.FILE$ = FN.GET.DATA$ & \ CLOSE #CH.PRM% & ! If the parameter file has been read then skip this. Otherwise, & ! open it and get the the screen file spec. Then close it. & 1030 OPEN PRM.SCREEN.FILE$ AS FILE #CH.SCR% & ,ORGANIZATION RELATIVE FIXED & ,RECORDSIZE 510% & ,ACCESS MODIFY & ,ALLOW NONE & \ SCR.NUMBER% = 1% & ! Open the Mail-11 Screen File. & ! Set the initial record number. & 1040 INPUT LINE #CH.MSF%, INPUT.FILESPEC$ & \ INPUT.FILESPEC$ = EDIT$(INPUT.FILESPEC$,(2%+4%+32%)) & \ OPEN INPUT.FILESPEC$ FOR INPUT AS FILE #CH.SCI% & ,RECORDSIZE 512% & ! Open the input ASCII file. & ! Leave lots of room for long lines. & 1050 !-------------------------------------------------------------------- & ! & ! For each input file ... & ! & !-------------------------------------------------------------------- & 1060 EOF% = FALSE% & \ A$ = "" & ! Clear end-of-file flag. & 1080 UNTIL EOF% & 1100 INPUT LINE #CH.SCI%, B$ & \ A$ = A$ + B$ & ! Tack input string onto output string. & 1120 NEXT & ! All done reading input file. & 1121 LEN.A% = LEN(A$) & ! Determine how many records are needed (round up). & & 1130 !-------------------------------------------------------------------- & ! & ! & ! Write to Screen File & ! & ! & !-------------------------------------------------------------------- & 1135 FOR CNT% = 1% TO 3% & \ START% = (CNT% - 1%) * RECSIZ% + 1% & \ B$ = MID$ (A$, START%, RECSIZ%) IF LEN.A% >= START% & \ B$ = "" IF LEN.A% < START% & \ NULLFILL% = RECSIZ% - LEN(B$) & \ C$ = B$ + STRING$ (NULLFILL%, 0%) & ! Append nulls to short records. & 1137 MOVE TO #CH.SCR%, C$ & \ PUT #CH.SCR%, RECORD SCR.NUMBER% - 1% + CNT% & \ GO TO 1150 & ! Try to put to the record. & ! If we get an error PUTting we have to GET & update. & 1140 GET #CH.SCR%, RECORD SCR.NUMBER% - 1% + CNT% & \ MOVE TO #CH.SCR%, C$ & \ UPDATE #CH.SCR% & ! Handle overwriting. & 1150 NEXT CNT% & \ PRINT #CH.KB%, INPUT.FILESPEC$; " done" & \ SCR.NUMBER% = SCR.NUMBER% + SCREEN.INTERVAL% & ! Write the record & rejoice when done. & ! Set the record number for the next screen. & 1180 CLOSE #CH.SCI% & \ GO TO 1040 & ! Close the input file. Now ask if any more screens. & & & 9000 !*************************************************************** & ! & ! & ! E N D O F P R O C E S S I N G & ! & ! & !*************************************************************** & 9010 PRINT #CH.KB%, CR;LF; "All done ... Screen File created "; & "successfully";CR;LF;LF;LF & \ SLEEP 5% & \ CLOSE #CH.SCR%, #CH.MSF% & ! Close out the files. & 9990 GO TO 32767 & ! Jump around the junk and leave. & & 15000 !*************************************************************** & ! & ! & ! F U N C T I O N S L O C A L T O & ! & ! T H I S P R O G R A M & ! & ! & !*************************************************************** 15200 !******************************************************************** & ! & ! & ! FN.GET.DATA$ & ! & ! Gets data string from next line of Parameter file & ! & ! Variables Used & ! & ! COMMENT% Byte in input line where comment begins & ! Z9$ Input line & ! FN.GET.DATA$ Output of function (input line without & ! comment) & ! & !******************************************************************** & 15210 DEF FN.GET.DATA$ & 15215 INPUT LINE #CH.PRM%, Z9$ & \ COMMENT% = POS (Z9$, "!", 1%) & \ IF COMMENT% > 0% THEN Z9$ = SEG$ (Z9$, 1%, COMMENT% -1%) & ! Strip away the comment, if any. & 15220 Z9$ = EDIT$ (Z9$, 140%) & ! Remove leading and trailing space/tabs, remove extraneous char.s & 15230 FN.GET.DATA$ = Z9$ & \ FNEND & ! Set the string value of our function, return. & 19000 !*************************************************************** & ! & ! & ! S T A N D A R D E R R O R H A N D L I N G & ! & ! & !*************************************************************** & & 19050 IF ERR = 11 AND ERL = 1100 THEN EOF% = TRUE% & \ RESUME 1120 & ! Mark when we run out of input. & 19100 IF ERL = 1030 & THEN PRINT #CH.KB%, BEL; "Can't open screen file.";CR;LF & ! Catch trouble opening Screen File. & 19150 IF ERL = 1040 THEN & RESUME 9000 IF ERR = 11 & \ PRINT #CH.KB%, BEL;"Bad input filespec: "; INPUT.FILESPEC$; & CR;LF & \ RESUME 1040 & ! Catch trouble on input file. & 19170 IF ERL = 1137 AND ERR = 153 & THEN RESUME 1140 & ! If we try to put to an already existing record, handle differently. & 19200 IF ERL = 1137 THEN & PRINT #CH.KB%, BEL; "Trouble writing to Screen file."; & CR;LF & ! Bad things in the help file. & 19220 IF ERL = 1020 & THEN PRINT #CH.KB%, BEL;"Can't open Master Screen file: "; & MASTER.SCREEN.FILE$;CR;LF; & ! Can't find Master Screen file. & 19900 ON ERROR GO BACK & ! Resume at the end of the program. & 32767 SUBEND