HP 3000 Manuals

The Transact/V Compiler [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation


HP Transact Reference Manual

The Transact/V Compiler 

This section explains how to run the Transact/V compiler under MPE V and
MPE/iX compatibility modes and describes the control options you can
choose.  It also describes a compiler listing, tells how you can control
listings, discusses program segmentation, and describes how to control
input sources to and output destinations from the compiler.

Figure 9-1 illustrates the steps used to compile and run a Transact
program under MPE V.

[]
Figure 9-1. Compiling and Executing a Transact Program under MPE V You create Transact source programs using EDIT/3000 or another text editor. The source code file can be either numbered or unnumbered. Source statements are limited to 72 characters per line and can span multiple lines. You request the Transact compiler to translate the source code into p-code with the following command: :RUN TRANCOMP.PUB.SYS When you are running interactively at a terminal and responding to prompts, the compiler prompts for the name of the file containing the Transact source code: SOURCE FILE> Enter the file name under which the source code was saved. LIST FILE> Enter a carriage return to direct the listing to your terminal ($STDLIST). You can direct the listing to a line printer by responding with LP or you can suppress the listing altogether by responding with NULL. These are the more common responses. For other possible responses, see the discussion of "Controlling Output Destinations from the Compiler." The compiler will then prompt you to specify which control options are to be applied to the translation: CONTROL> Respond to this prompt by entering one or more of the following options separated by commas. Any option can be preceded by NO to reverse its effect. LIST Generates a listing of the compiled source code. The default is LIST. DICT References a data dictionary (either Dictionary/V or System Dictionary) to resolve data item definitions. The default is DICT. When this option is in effect, Transact uses Dictionary/V by default. If you want to use System Dictionary, use the dictionary commands described later in this chapter. CODE Creates the p-code file that is executed by the Transact processor. The p-code file is created only if no errors occur during compilation. (See option XERR.) The default is CODE. ERRS Lists compilation errors on $STDLIST, even if you direct a listing elsewhere. The default is ERRS. CHCK Causes Transact to check that all items referenced have been put in the LIST register by either a LIST or PROMPT statement. A warning at the end of each segment is generated for all items that were not put in the LIST register. The default is NOCHCK. _______________________________________________ NOTE The use of the CHCK option does not guarantee that all run-time errors will be eliminated for items not in the LIST register. The compiler does not know the order of execution. This compiler option will only notify the programmer of items that are never used in a LIST or PROMPT statement within the segment the items are referenced. _______________________________________________ DEFN Produces a listing of data-item definitions as part of the compiler list output. The list covers all data items defined in your source code and in a data dictionary. If LIST(AUTO) is included in your program, the compiler listing includes the name and relative list register position of each item placed in the list register. The location of the items in the listing depends on the form of LIST(AUTO) used and on whether the program is segmented. For LIST(AUTO) filename, the items are always listed right after the verb. For LIST(AUTO)@ in single segment programs, items are listed at the end of the program listing. For LIST(AUTO)@ in a multiple segment program, items are listed at the end of each segment, except that items in the root segment are listed at the end of the program. The default is NODEFN. OBJT Produces a listing of the p-code. The default is NOOBJT. OPT@ Causes Transact not to store heading text, edit text, or entry/prompt text of data items that are defined in a data dictionary and are being used in the program to be compiled. This optimizes the tables in the p-code file so that the data segment stack is reduced at execution time. This option is the same as specifying OPTE, OPTH, and OPTP. If conflicting control options are specified, then the last control option is in effect. For example: OPT@,NOOPTH eliminates all text except the heading. In contrast, NOOPTH,OPT@ eliminates all text. See the option descriptions below for more information regarding the individual options. Appendix C, "Optimizing Transact/V Applications," provides additional information on this option in conjunction with data stack optimization. The default is NOOPT@. OPTE Causes Transact not to store edit text of data items that are defined in a data dictionary and are being used in the program to be compiled. This optimizes the tables in the p-code file so that the data segment stack is reduced at execution time. Note that the OPTE option should not be used if the edit mask from a data dictionary is needed in the program. Appendix C provides additional information on this option in conjunction with data stack optimization. The default is NOOPTE. OPTH Causes Transact not to store heading text of data items that are defined in a data dictionary and are being used in the program to be compiled. This optimizes the tables in the p-code file so that the data segment stack is reduced at execution time. Note that the OPTH option should not be used if the data item's heading text from a data dictionary is needed in the program. Appendix C provides additional information on this option in conjunction with data stack optimization. The default is NOOPTH. OPTI Causes Transact not to store the text name of the data item defined using DEFINE(ITEM) with OPT option in the program. Note that unlike OPT@, OPTE, OPTH, and OPTP options for data items defined in a data dictionary, OPTI requires OPT to be used with DEFINE(ITEM). This optimizes the tables in the p-code file so that the data segment stack is reduced at execution time. Note also that the OPTI option should not be used if the data item names are needed for prompt strings, display item headings, SET(KEY) lists, and LIST= constructs. Appendix C provides additional information on this option in conjunction with data stack optimization. The default is NOOPTI. OPTP Causes Transact not to store prompt text of data items that are defined in a data dictionary and are being used in the program to be compiled. This optimizes the tables in the p-code file so that the data segment stack is reduced at execution time. Note that the OPTP option should not be used if the data item names are needed for prompt strings and LIST= constructs. In the absence of the prompt string from a dictionary, the item name is used for prompting. Appendix C provides additional information on this option in conjunction with data stack optimization. The default is NOOPTP. OPTS Optimizes multiple segment Transact programs only. When you include this option, the processor does not check for local segment items in the list, match, and update registers when loading a new segment. Since such checks are essential for debugging programs under development, this option should only be used after a program is fully tested and ready for production. Although OPTS speeds segment transfers, the program may malfunction or terminate abnormally if a local item is left in a register. The default is NOOPTS. STAT Generates statistics on data stack usage. These values are useful in deciding how program structural and/or coding differences would improve the run-time performance of your program. Appendix C provides additional information on this option in conjunction with data stack optimization. The default is NOSTAT. XERR Creates a p-code file even if errors are encountered in the compilation. (See the CODE option.) The default is NOXERR. XREF Generates a listing to provide a cross-reference to locations of label definitions and their references. The default is NOXREF. Bypassing Transact/V Compiler Prompts Two RUN command options can be used to bypass the Transact compiler prompts. These are the PARM= and INFO= options that are specified in the compiler invocation statement. The PARM= option parameters identify your source file and/or list file: Formal Value Designator Meaning ---------------------------------------------------------------- 1 TRANTEXT Formal file designator for source file. If specified, the SOURCE FILE> prompt does not appear. 2 TRANLIST Formal file designator for list file. If specified, the LIST FILE> prompt does not appear. TRANLIST may be equated to any file. 3 TRANTEXT If used, neither the SOURCE FILE> nor the TRANLIST LIST FILE> prompt appears. The INFO= option accepts parameters identical with those used to respond to the CONTROL> prompt. As illustrated in the following example, enclose the parameter in quotation marks. If only blanks are included between the quotation marks, the default compiler options take effect. If the INFO= option is used, the CONTROL> prompt does not appear. The following invocation produces two listings at the line printer after the source statements in APPL01 are processed: FILE TRANTEXT=APPL01 FILE TRANLIST;DEV=LP,,2 RUN TRANCOMP.PUB.SYS; PARM=3; INFO="DEFN, XREF" You can direct the compiler to a file for answers to its prompts. See "Controlling Input Sources to the Compiler" later in this chapter. You can also compile a program by streaming it as a batch job. To do this, set up the stream file to contain the following MPE V commands: :STREAM >!JOB jobname,username.acctname >!RUN TRANCOMP.PUB.SYS >filename >list-destination >control-options >!EOJ Controlling Input Sources to the Transact/V Compiler TRANIN is the formal file designator that TRANCOMP uses when compiling with Transact/V for responses to prompts such as system name, options, and list. The default setting for TRANIN is $STDINX, but you can change the default using a file equation. The compiler then reads input from that file until it encounters an end-of-file condition. If it reaches end-of-file before all prompts are answered, it returns to $STDINX. (If TRANIN is an EDIT/V file, it must be unnumbered.) TRANTEXT is the formal file designator for the source code file. Like TRANIN, it can be file equated to the name of another file. Controlling Output Destinations from the Transact/V Compiler TRANLIST is the formal file designator for the destination of compiler listings when you set PARM=2 for the Transact compiler. When LP is the response to the LIST FILE> prompt, the default device for TRANLIST is LP. You can, however, use a file equation to change the device. A file equation or the destination default is activated when you respond to the LIST FILE> prompt with LP. If you simply want to redirect your compiler listing and no other compiler output, you can respond to the LIST FILE> prompt with any of the following: * A carriage return or $STDLIST directs the compiler listing to the terminal in a session or to the line printer in a batch job (TRANOUT). * LP directs the compiler listing to TRANLIST, which is the line printer unless a :FILE command has specified another device for TRANLIST. * NULL directs the compiler to display errors on the terminal in a session or to the line printer in a batch job if ERRS is specified, but other parts of the listing are suppressed. * $NULL directs the listing to a null file, in effect suppressing the listing. (The preferred response is NULL.) * A file name directs the listing to a new disk file. If a file of the same name already exists, the compiler asks if you want to purge the existing file. * A file name preceded by an "*" directs the compiler to back reference a file equation. TRANOUT is the formal file designator for output from the compiler that, by default, is sent to the standard list device. (The default setting for $STDLIST is your terminal in session mode, the line printer for a batch job.) You can use a file equation to specify a device other than $STDLIST for TRANOUT. If you do this, the compiler prompts, such as SOURCE FILE>, the compiler listing, and any requested statistics or data item definitions appear on that device. (Note that TRANOUT also controls processor output, including the SYSTEM NAME> prompt.) TRANCODE is the name of the p-code file opened and used by the compiler. The default maximum size of this file is 1023 records. If the error message "BINARY FILE FULL" is issued during compilation, use an MPE FILE command to increase the maximum TRANCODE file size. For example, to increase the size to 2000 records, use the following FILE command: :FILE TRANCODE;DISC=2000 To direct the compiled program to another group, use: :FILE TRANCODE=TRANCODE.GROUP


MPE/iX 5.0 Documentation