Compiler Commands [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation
HP Transact Reference Manual
Compiler Commands
You can place any of the following commands between any two statements in
the source program to control the compiled output, to conditionally
compile blocks or code, or to control which data dictionary is used.
Because these commands are not language statements, do not terminate them
with a semicolon.
Compiler Output Commands
!COPYRIGHT Causes the compiler to place the specified
("text-string") text-string in the first record of the code file as a
copyright notice. The text-string can be up to 500
characters long. This command can only be specified
once; usually, it should follow the SYSTEM statement.
!INCLUDE Causes the compiler to include the Transact
(file-name) statements from a specified source file (file-name)
that is not the source file being compiled. The
file-name statements are included at the point in the
listing where !INCLUDE appears and are compiled with
the main source file. The file-name can be a fully
qualified name with file group and account. Up to 5
files can be nested with !INCLUDE commands.
!LIST Writes subsequent source statements to the list file.
If LIST is specified in response to the CONTROL>
prompt, !LIST has no effect.
!NOLIST Suppresses the listing of subsequent source
statements. If NOLIST is specified in response to
the CONTROL> prompt, !NOLIST has no effect.
!PAGE Causes the compiler to skip to the top of the next
page on the listing.
!SEGMENT Causes the compiler to segment the program and the
[("text-string")] resulting code file at this point in the source file.
The compiler displays the specified text-string on
TRANOUT when it processes the !SEGMENT command. The
text string can be up to 500 characters long. The
discussion of segmentation later in this chapter
tells why and how to segment programs.
Conditional Compilation Commands
There are 10 conditional compilation switches that can be set to ON or
OFF by the !SET compiler command. The switches can then be queried by
the !IF compiler command, and compilation of the following block of code
will depend on the value of the switch. The end of the conditional block
is marked by !ELSE or !ENDIF.
The following compiler commands are used to control conditional
compilation:
!SET Xn{ON/OFF} Sets the compilation switch to ON or OFF. The default
is OFF. Xn is any member of the set X0, X1, X2, X3,
X4, X5, X6, X7, X8, and X9.
!IF Xn={ON/OFF} Queries the named switch to determine its value. If
the condition is true, the following block of code is
compiled. If the condition is false, the following
block is not compiled and control passes to the next
!ELSE or !ENDIF.
!ELSE Marks the beginning of a block of code that will or
will not be compiled, depending on the condition of
the preceding !IF. If the condition is false, the
following code is compiled. If the condition is
true, the following code is not compiled. This
optional command allows you to define an "either-or"
situation, in which either one block of code or
another is compiled, depending on the value of a
switch.
!ENDIF Terminates the influence of an !IF. This command is
required if an !IF is used.
Other compiler commands can occur between !IF and !ELSE or !ENDIF.
For example,
!SET X1=ON
. . .
!IF X1=ON
DISPLAY "THIS LITERAL WILL BE DISPLAYED BECAUSE X1 IS ON";
!SET X2=OFF
!ELSE
DISPLAY "THIS LITERAL WILL BE DISPLAYED IF X1 IS OFF";
!ENDIF
In addition to the switches X0-X9, there is an eleventh switch, XL, which
is set automatically to OFF when code is compiled with Transact/V and to
ON when code is compiled with Transact/iX. This switch can be tested with
the !IF command to control compilation. For example:
!IF XL=ON
SYSTEM MYPROG, << Compile these lines if using Transact/iX. >>
BASE=MYBASE(,,,HP3000_16),
FILE=MYFILE((HP3000_16));
!ELSE
SYSTEM MYPROG, << Compile these lines if using Transact/V. >>
BASE=MYBASE,
FILE=MYFILE;
!ENDIF
System Dictionary Compiler Commands
The default data dictionary used by Transact is Dictionary/V. If you want
to access System Dictionary, use the following compiler commands:
!SYSDIC[(dictionary.group.Causes the compiler to use the named System
account)] Dictionary to resolve all forms files, forms,
file definitions, and data items not defined in
DEFINE statements. Defaults to SYSDIC in logon
group and account. If System Dictionary is to
be used, this command is required and it must
be the first System Dictionary command included
in the program.
!NOSYSDIC Ends access to System Dictionary and returns to
Dictionary/V.
!DOMAIN[(domain)] Names the System Dictionary domain to be used.
Defaults to common domain.
!VERSIONSTATUS[(P/T/A)] Refers to the version to be used (production,
test, or archive). Defaults to P (production
version).
!VERSION[(version)] Names the version to be used. Defaults to
production version. This parameter overrides
the VERSIONSTATUS parameter.
!SCOPE[(scope[, Names the scope and the password to be used.
"password"])] Defaults to DA scope and prompting for the
password.
You can change System Dictionary, DOMAIN, VERSIONSTATUS, VERSION, or
SCOPE in the middle of compilation by reissuing the appropriate compiler
commands in the Transact source. System Dictionary compiler commands can
go between statements and even within one statement--the SYSTEM statement
(see example below). All of the System Dictionary commands that are used
to effect a single change should appear contiguously. Comments should
precede or follow the entire group of commands.
The command !NOSYSDIC causes the compiler to end access to the System
Dictionary and return to using Dictionary/V for any following data items
not defined in the program.
For example, if you want to change domains while extracting forms-file
definitions, you can embed compiler commands in the SYSTEM statement as
follows:
!SYSDIC(SYSDIC.PUB.SYS)
!SCOPE (Transact,"password")
SYSTEM APPL1, VPLS = FORMF1,FORMF2, <--uses common domain
!DOMAIN(TEST)
FORMF3, <--uses test domain
!NOSYSDIC
FORMF4; <--uses Dictionary/V
MPE/iX 5.0 Documentation