/* [2,55]RS1IND.RPL R RHODERICK MARCH 1984 indirect file processor - executes RS1 commands from an external (FILES-11) disk file */ /* call this as " CALL PUBLIC RS1IND(filespec)" - or - " CALL PUBLIC RS1IND" where filespec is the name of the external (FILES-11) disk file which contains the RS1 commands to execute. If the second form of the procedure call is used, the default file 'RS1IND.CM' will be opened. If the specified file is not found, a message will be typed on the user's terminal and the procedure will exit. If the second form of the procedure call is used and no file with the default file name is found, the procedure exits without an error message. If this routine is called as part of RS/1's public RS1_INITIALIZATION procedure, it will effectively act as an automatic indirect command processor upon invocation of RS1. Indirect File Format: Each line of the external (FILES-11) disk file is read by this procedure, compiled as a temporary procedure and executed. Lines which have a semicolon in column 1 ( ";" ) are considered to be comments and are ignored. For this reason, each line of the indirect file which does not begin with a semicolon must be an RS1-executable command. If the line read from the indirect file does not compile, no operation will occur and the indirect file will not be deleted from the user's disk. If all the lines read from the indirect file execute properly, the indirect file is deleted from the user's disk. **NOTE** If the RS1 command LOGOUT is included in the indirect file it must be the last line of the file; if the LOGOUT command is followed by another line (for instance a comment line) execution of RS1 will be terminated before the entire file has been read, hence the indirect file will not be deleted. */ PROCEDURE(FILE_NAME); IF NARGS<1 THEN FILE_NAME='RS1IND.CM'; /* open disk file for input */ CHAN=INFILE(FILE_NAME,BLKS,SUCCESSFUL); IF NOT(SUCCESSFUL) THEN GO TO RTN; CR=' '; TYPE NOCR CR,' processing indirect file - ',FILE_NAME,CR; DELETE_LINE='PIP ' CAT FILE_NAME CAT ';0/DE/NM'; /* read in entire indirect file */ NUMREC=0; EOF = FALSE; DO WHILE NOT(EOF); NUMREC = NUMREC+1; CMD_LINE[NUMREC] = GETLINE(CHAN); EOF = TESTEND(CHAN); END; /* main processing loop */ DO IDX = 1 TO NUMREC; IF LOC('LOGOUT',CAPS(CMD_LINE[IDX])) EQ 1 THEN DO; IF SUCCESSFUL THEN CHAIN DELETE_LINE; TYPE NOCR CR,'#LOGOUT',CR; CALL EXEC('LOGOUT',TRUE); END; IF NOT(SUCCESSFUL) THEN TYPE NOCR CR,'#( ',CMD_LINE[IDX],' )',CR; IF SUCCESSFUL THEN DO; TYPE NOCR CR,'#',CMD_LINE[IDX],CR; IF EXT(1,CMD_LINE[IDX]) EQ ';' THEN DONEXT; CALL EXEC(CMD_LINE[IDX],TRUE,SUCCESSFUL); END; END; /* end main processing loop */ /* normal return */ TYPE NOCR CR,'#',CR; RETURN; /* file error return */ RTN: IF NARGS>0 THEN TYPE 'INDIRECT FILE LOOKUP ERROR - DISK FILE NOT FOUND'; RETURN; END;