QW Scripting: MPECompile
MPECompile 1.04 August 29, 2000
MPECompile is a generic script providing access to most compilers found
on MPE hosts. An MPECompile command automatically calls the corresponding
compiler on the currently active document.
The appropriate compiler is assigned
an entry point using On Command
blocks.
It is distributed in the Scripts directory of the Robelle script library
directory e.g. c:\robelle\qedit\system\
.
The script is designed to be loaded. You can load it manually using the
Manage scripts command of the Script menu. If you wish to have it loaded
automatically, you can copy it to the customer script library directory
e.g. c:\robelle\qedit\user\autoload\
.
The driver subroutine is called DoMPECompile.
Information on MPECompile is organized as follows:
The main subroutine is called DoMPECompile and accepts only 1 parameter.
- CompileCommand: This parameter is required.
It is an string indicating which compiler command to use
e.g.
COB85XL
The script is designed to be loaded. It can be invoked from the Script menu
or from any other script.
Running From the Script Menu
The script can be loaded manually. Its commands are added to
the Robelle command group of the
Script menu. The subcommand name is MPE Compile.
The subcommand offers 7 different options:
- COB85XL: invokes the Cobol85 compiler
- COB74XL: invokes the Cobol74 compiler
- FORTRAN: invokes the Fortran compiler
- PASXL: invokes the Pascal compiler
- SPL: invokes the SPL compiler
- TRANCOMP: invokes the Transact compiler
- About...: Displays a brief explanation of the script's purposes
Running From Another Script
The following sample script provides an example compiling a Cobol source file
called COBPRG1
on the connection Production MPE.
The compile uses the Cobol85 compiler.
This sample script takes advantage of the
fact that the QSLMPECompile script is distributed with Qedit
for Windows as a loadable script (in this case, already loaded):
file = open(connection: "Production MPE", filename: "cobprg1.src");
QSLMPECompile.DoMPECompile("COB85XL");
Execution Logic Overview
The script uses the same approach whether you use the menu command or invoke it from
another script.
- The script assumes the currently active document is the main source.
- The script builds the MPE command using the CompileCommand
passed as parameter e.g. COB85XL, the active document filename and the
compiler output destination (default: QSLCOMPO).
- If the output file is already opened, the script closes it.
- The script then uses the
HostCommand
application method
to build the output file in the temporary domain.
- The compiler is invoked with the output redirected to the temporary output
file.
- When the compilation is done, the script opens the output file so it is
displayed.
The DoMPECompile subroutine displays informative messages in the log window
of the Script Control dialog box. These messages include the version number,
progress messages and termination message. A typical output looks like this:
MPECompile 1.02 - Copyright 2000 Robelle
This window will close when the compile completes.
The STDLIST output will then be opened.
Compiling COB85XL COBOLSRC.SRC.DEVACCT,,QSLCOMPO
...Working....Please wait a few moments...
COB85XL compile has finished!
Compiler Output File
The compiler output file is in the temporary domain. This means there is no conflict
with other users compiling. There is no conflict with other connections from the same
PC. However, all compiles on a single connection use the same output file.
This means output results are not preserved. If you wish to save the results for
future reference, you should use the Save As command and assign a new name to it.
Also, at the start of each compile, the script closes the document window for
QSLCOMPO on the appropriate connection. This forces Qedit to refresh the
window.