This job applies a patch to a source file, compiles the source file into an executable object code file, and runs XREFANALYZER to produce cross-reference files.
?BEGIN JOB COMP (STRING PROGRAMNAME); CLASS=4; TASK PATCHTASK, % TASK VARIABLE FOR SYSTEM/PATCH COMPILETASK; % TASK VARIABLE FOR COMPILE DATA PATCHINPUT $# D O L L A R O P T I O N S $ SET MERGE SET NEW SET LINEINFO ERRLIST RESET LIST $ SET XREF NOXREFLIST $.% P A T C H E S $#PATCH 1 $.FILE PATCH/1 ? % END OF PATCHINPUT RUN SYSTEM/PATCH [PATCHTASK]; FILE SOURCE (TITLE=#PROGRAMNAME); FILE CARD (TITLE=PATCHINPUT,KIND=READER); FILE PATCH (TITLE=SYSTEMPATCH/#PROGRAMNAME,NEWFILE=TRUE); IF PATCHTASK(TASKVALUE) = 1 THEN BEGIN REMOVE ERRORFILE/#PROGRAMNAME; COMPILE OBJECT/#PROGRAMNAME WITH ALGOL [COMPILETASK] LIBRARY; COMPILER FILE SOURCE (TITLE=#PROGRAMNAME); COMPILER FILE CARD (TITLE=SYSTEMPATCH/#PROGRAMNAME, DISK); COMPILER FILE NEWSOURCE (TITLE=NEW/#PROGRAMNAME); COMPILER FILE ERRORS (TITLE=ERRORS/#PROGRAMNAME, NEWFILE, KIND=DISK, PROTECTION=PROTECTED); REMOVE SYSTEMPATCH/#PROGRAMNAME; END;
IF COMPILETASK IS COMPILEDOK THEN BEGIN DISPLAY "COMPILED OK"; IF FILE ERRORS/#PROGRAMNAME IS RESIDENT THEN DISPLAY "*** CHECK ERRORS/" & PROGRAMNAME & " FOR WARNINGS ***"; MYSELF(JOBSUMMARY=SUPPRESSED); % DON'T NEED JOBSUMMARY SECURITY OBJECT/#PROGRAMNAME PUBLIC IO; IF FILE XREF/OBJECT/#PROGRAMNAME IS RESIDENT THEN BEGIN RUN SYSTEM/XREFANALYZER (0); TASKVALUE = -1; % PRODUCE XREFFILES FILE XREFFILE(TITLE=XREF/OBJECT/#PROGRAMNAME); SECURITY XREFFILES/OBJECT/#PROGRAMNAME/DECS, XREFFILES/OBJECT/#PROGRAMNAME/REFS PUBLIC IO; END; END ELSE DISPLAY "*** SYNTAX ERRORS: LIST ERRORS/" & PROGRAMNAME & " FOR ERRORS ***"; ?END JOB.
Explanation
Each component of this sample job is explained in the following discussion.
Job Heading
The job accepts a string parameter PROGRAMNAME, which is the name of the program that is to be compiled.
The CLASS = 4 form is a job attribute specification that causes the job to be initiated from queue 4.
Declarations
The TASK declaration that follows declares two task variables for use later in the job.
PATCHINPUT Data Specification
The next section of the job is a global data specification named PATCHINPUT. This will be used as an input file by SYSTEM/PATCH in the next section of the job.
The first three lines of the global data specification provide options that modify the behavior of SYSTEM/PATCH. Refer to SYSTEM/PATCH in the System Software Utilities Operations Reference Manual, and to compiling programs in the ALGOL Reference Manual, Volume 1 for descriptions of the various compiler control options that are used in this global data specification.
The next three lines of the global data specification specify the names of any patch files that are to be used. In this case, only one is specified, PATCH/1.
SYSTEM/PATCH Run
The next section of the job runs SYSTEM/PATCH. The following file equations are used.
Equation |
Meaning |
---|---|
FILE SOURCE |
Specifies the file that is to be patched. In this case, the file whose title was passed in as the WFL job parameter is used. |
FILE CARD |
Specifies the file to be used as the input to SYSTEM/PATCH. In this case, the global data specification titled PATCHINPUT is used. |
FILE PATCH |
Specifies the title of the file that SYSTEM/PATCH creates by merging the patches and compiler control options included in the CARD file. |
Compilation
The job verifies that the SYSTEM/PATCH run was successful by checking the TASKVALUE of the task variable PATCHTASK. This attribute will have a value of 1 if the run was successful. If the run was successful, then any error file that might have been generated by an earlier compilation of the program is removed, and the program is compiled. The following file equations follow the COMPILE statement.
Equation |
Meaning |
---|---|
FILE SOURCE |
Specifies the file to be used as the secondary source input. |
FILE CARD |
Specifies the file to be used as the primary source input. In this case, the merged patch file produced by the earlier run of SYSTEM/PATCH is used |
FILE NEWSOURCE |
Specifies the title of the updated source file that is produced by merging the CARD file and the TAPE file. (This file is produced because the NEW option was included in the PATCHINPUT file.) |
FILE ERRORS |
Specifies the title of the error file that is produced if errors or warnings occur during compilation. |
Refer to compiling programs in the ALGOL Reference Manual, Volume 1 for further information about the input and output files used by the ALGOL compiler.
The merged patch file produced by SYSTEM/PATCH is then removed, as it is no longer needed.
SYSTEM/XREFANALYZER Run
Next, the job verifies that the compilation was successful by checking the task state of the task variable that was attached to the compilation.
If the compilation was successful, the message “COMPILED OK” is displayed. The job then checks to see if an error file was created by the compilation. If it was, a message is displayed stating that the error file should be checked for warnings.
At this point, the JOBSUMMARY attribute of the job is set to SUPPRESSED. This statement is located here so that it will suppress the job summary only if the compile was successful. If the compile was unsuccessful, the job summary printout might contain useful information about why it failed.
The security of the object code file is then set to PUBLIC IO, so that it will be available to users under other usercodes.
The job then runs the XREFANALYZER utility to produce an analysis of where all the identifiers in the program are declared and used. For a description of this utility, refer to XREFANALYZER in the System Software Utilities Operations Reference Manual. XREFANALYZER uses a file called XREF/OBJECT/#PROGRAMNAME, which was created during the compilation of the program because the compiler control options XREF and NOXREFLIST were included in the PATCHINPUT global data specification.
XREFANALYZER produces two output files. The next statement sets the security of these two files to PUBLIC IO, so that they will be available to users under different usercodes.
If the compilation had not been successful, the job would have skipped these last few actions and simply displayed a message about syntax errors being present in the program.