:Compile Command [CO/:C]
Qedit supports many commands for compiling using MPE V or CM compilers: three for COBOL, two for FORTRAN, SPL, Pascal, and RPG. To select a default CM COBOL compiler, use Set Whichcomp. Qedit provides a generic :Compile command that uses Set Language to determine which compiler to use. Once you have compiled a program, you can also rep and :Run it from within Qedit.
The generic :Compile command does not currently apply to NM compilers. Instead, use the regular command files in Pub.Sys, which we adjust to use our special Qcompxl routines (e.g., COB85XL).
Commands for MPE V and CM Compiles
COMPILE files [ ;INFO [=] “string” ]
CO files
COBOL files {see Set Whichcomp}
COBOLI files
COBOLII files
SPL files
RPG files
FORTRAN files {see Set Whichcomp}
FTN files {FORTRAN 77}
Pascal files
The files Parameters
All of the compile commands use the same file parameters:
:COMPILE text, usl, list, master, new
The text file is the file that contains the source code. It may be a Keep file or a Qedit workfile (if the compilers have been properly “fixed”). Compiler fixing is part of the standard Qedit install jobs. But, the “copylib” file for COBOL cannot be a Qedit file; it should be KSAM. If the text file is “*”, the currently open workfile is compiled. If none is open, the one just closed is compiled.
The usl file is the file where the compiler deposits the machine code that it generates. This file must be “prepped” into a program file before you can actually :Run. The usl file defaults to $newpass (or $oldpass). You can specify a USL file created via the Segmenter (-buildusl) or by a previous compile (e.g., :save $oldpass after compile).
The list file is where the compiler sends its listing. The default is to print on $stdlist (i.e., your screen). If the list file is “LP”, it always refers to Dev=LP. To direct the listing to a device name other than “LP”, use a regular File command:
/file sp;dev=serialp /cobol x,,*sp {compile file x, list to device Serialp}
The master file is a master source file that is merged with the text file by line number at compile time. This parameter is not supported for FORTRAN 77, Pascal, or C.
The new file is an optional output disc file that can be created by merging the master file and the text file.
Examples
/cobol abc.source,,lp {output goes to dev=lp} /open def.source {open another source file} /co * {Lang of file selects compiler} /shut {close current workfile} /spl * {compile errors to terminal} /open * {resume editing}
Compiling a Range
You can specify a line range instead of a filename if you like:
/fortran 300/414.5
This option works only with the current workfile, accepts only explicit line numbers (e.g., 1.0, not FIRST), and allows only a single range (e.g., not 5/10,20/30).
Set Whichcomp Command
Qedit has the :COBOLII command to run the COBOLII program and :COBOLI to run the COBOLI program. To use COBOL-85, you need to use Set Whichcomp.
/set whichcomp cobol 85 {run COBOLII,COBOLIIX} /set whichcomp cobol 74 {run COBOLII for :COBOL} /set whichcomp cobol 68 {run COBOLI for :COBOL}
Qedit has the :FORTRAN command to compile FORTRAN 66 and :FTN to compile FORTRAN 77. Use Set Whichcomp to make FORTRAN 77 the default for :Compile:
/set whichcomp fortran 77
Interrupting with Control-Y
You can use Control-Y during a long compile to interrupt the compiler. It should print the question “Terminate program [no]?”. Answer “YES” to abort the compile, or answer “NO” to continue compiling.
Compile Priority
Normally, the compiler is run in the same priority subqueue as Qedit, but the System Manager can specify a maximum subqueue for compiles that is lower than the programmer’s logon priority. In these cases, the compiler is run in the lower subqueue (see the installation chapter). The System Manager can also specify that no on-line compiles at all are to be done in Qedit.
Include Files
The Qedit compiler interface interprets $include commands within Qedit workfiles at compile time. This is the syntax:
$INCLUDE
filename or !INCLUDE (
filename)
The HP Pascal syntax for $include is okay: $include ‘filename‘ $. For Transact systems, use !Include with the filename in parentheses. For C, use #Include <file>. The Include statement must start at the beginning of the line.
When the Include command is encountered during the compile, the Include file is opened, and the lines are returned to the compiler with their actual sequence numbers. If the file cannot be opened, Qedit returns the include line to the compiler for interpretation. If the file can be opened, the include line is returned as a comment. Include is recognized only in Qedit workfiles, not in Keep files. However, “included” files themselves can be either Qedit files or Keep files. Nesting of includes is supported to ten levels deep.
Note that the SPL compiler interprets lines that start with an exclamation mark as a comment, even !include. The Qedit compiler interface treats this as a valid !include statement, not a comment. To prevent this, use the SPL << >> comment syntax instead.
Compiling to a Disc File
If you direct your compiler error listing to a disc file, you can use Qedit to examine the errors and fix them.
First, add a line to the beginning of your workfile specifying “$control nolist”, which means “list only lines with errors”:
/add 1.1 1.10 $control nolist 1.11 //
Later, when you want a full listing, change this line to “$control list
“, or “$control source
” for COBOL.
Build a disc file, compile the listing into it, and display it:
/:build list;rec=-132,64,f,ascii;disc=4000,32 /:spl *,,list {compiler listing goes to List} /lq list {displays compiler listing on your terminal}
On subsequent compiles, you can use the same file and the compiler should erase the previous contents. With this technique, you can do your compile in a job stream and continue editing another file while you are waiting. When the stream job finishes, you can check the results from within Qedit, even if you are remotely located from the batch line printer. Using :Tell, you could have the Job send a message to your Session when it completes.
Trapping Compiler Syntax Errors
Qedit can trap compiler syntax errors and show you each line in your source code for you to correct. See the chapter “Using Qedit with MPE Programming Tools” for full details.