Defining Input, Log, Macro, and Output Files [ HP SYSTEM DICTIONARY XL SDMAIN ] MPE/iX 5.0 Documentation
HP SYSTEM DICTIONARY XL SDMAIN
Defining Input, Log, Macro, and Output Files
The first step in using the dictionary is to define the files that you
use.
SDMAIN uses the following formal file designators:
* SDIN = the input file
* SDLOG = the log file
* SDMACR= the macro file
* SDOUT = the output file
SDMAIN opens all the files with file equates allowed. You can,
therefore, redirect the SDMAIN files to your own files, if you wish, by
means of MPE file equations.
The Input File (SDIN)
SDMAIN accepts input from the file SDIN. The default for SDIN is $STDINX,
or your terminal (for sessions). This means that input is accepted from
the terminal unless otherwise specified. You can, however, redirect the
input to another file. This causes SDMAIN to accept the input from the
specified file. The file must be an unnumbered file with a record length
of 80 bytes or less (if over 80 bytes, SDMAIN reads only the first 80 and
ignores the remainder). Note that if the specified input file does not
include an EXIT command, SDMAIN is redirected to accept input from
$STDINX when the end of file is reached.
Redirecting the Input File. If you would like input to come from a file
other than SDIN (or $STDINX, your terminal), you can redirect the input
to a file of your own choosing. In order to redirect SDIN, enter the
following MPE file equation prior to the RUN command:
:FILE SDIN = command file name
After entering this command, the next time you run SDMAIN, input is
accepted from command file name. See the examples following "Redirecting
the Log File" for an example.
The Log File (SDLOG)
When you execute SDMAIN, all valid commands are added, or logged, to a
temporary log file called SDLOG. Valid commands are those that do not
contain any syntax errors.
Examples of types of commands that are not logged are:
* Commands containing syntax errors
* Subsystem commands, such as Edit/V responses you enter through the
use of the EDIT command
* The REDO command and its editing subcommands (The resulting edited
dictionary commands, however, are logged as they are executed.)
* Certain commands you enter within a START/SAVE pair
The START/SAVE command pair is a System Dictionary pair of reporting
commands. Only executable commands within this pair are logged.
Therefore, no COMMENT, HELP or SHOW commands that can occur within
this pair are logged. As with the REDO command, once you issue the
SAVE command, the START/SAVE pair is executed and all executable
commands within that pair are logged to SDLOG.
* If you enter a [[CONTROL]] Y before you enter the full command, the
entire command is not logged.
* Macro calls and INCLUDE commands are not logged. However, the
expanded macro and the commands in the include file are logged as
they are executed.
Redirecting the Log File. To redirect SDLOG to another file, enter the
following MPE command:
:FILE SDLOG = log file name
When SDLOG is redirected to another file, the specified file saves all
input entered for that session. If the file does not exist, then SDMAIN
builds it as a temporary fixed-length ASCII file with a record size of 80
bytes. If the file already exists, then SDMAIN asks for permission to
overwrite it with the following prompt:
filename.groupname.accountname already exists. Is it okay to overwrite
(N/Y)?
If you respond NO to the above prompt, logging is disabled and no
commands are logged.
If SDLOG is not redirected (or if it is redirected to a temporary file),
it is only a temporary file and must be saved if you want SDLOG to become
a permanent file. To do this, issue the MPE SAVE command and then rename
the resulting file:
:SAVE SDLOG
:RENAME SDLOG, LOGFILE
If you fail to rename the saved file to something other than SDLOG, and
do not redirect SDLOG, SDMAIN asks you for permission to overwrite it
during the next run. If you answer NO, logging is disabled and no
commands are written to the log file. You can use the OPTIONS command to
change the log during a run.
You can disable logging in several ways, The first is to redirect SDLOG
to the file $NULL. Next, as mentioned above, a response of NO to the
overwrite prompt disables logging. Finally, the OPTIONS command can turn
logging ON and OFF during a run.
The ability to redirect the log file is a valuable feature. This
capability, in conjunction with the ability to redirect the input file,
allows you to create and save a file of commands that you can reuse at a
later date. This becomes especially helpful if, for instance, a certain
sequence of commands is executed on a regular basis. If, for example,
once a month, all data elements within a particular data set are updated,
the sequence of commands necessary to accomplish this update can be kept
in a command file and simply re-executed whenever needed.
Examples
There are several ways to combine SDLOG and SDIN. In both of the
following cases, the input file SDIN is redirected to take input from a
command file. In the first example, the log file is redirected to
another file called cmdfile, which is then saved and used as input for
the redirected input file:
:FILE SDLOG=cmdfile Redirects SDLOG to cmdfile.
:RESET SDIN Cancels any existing file equations for SDIN.
Do this if SDIN is already directed to a file.
:RUN SDMAIN.PUB.SYS Runs SDMAIN and enters the commands. The
commands that are now entered, go to the file
cmdfile.
:
:SAVE cmdfile Saves cmdfile as a permanent file.
:FILE SDIN=cmdfile SDIN now takes commands from this file.
:RESET SDLOG Cancels the previous file equation for SDLOG.
:RUN SDMAIN.PUB.SYS Commands are now taken from cmdfile.
Notice that the MPE RESET command is used here to cancel any existing
file equations for SDIN and SDLOG.
The following example saves and renames the SDLOG file. The redirected
SDIN file then uses the renamed file.
:RUN SDMAIN.PUB.SYS Commands are written to SDLOG.
:
:SAVE SDLOG Saves SDLOG file.
:RENAME SDLOG,cmdfile Renames SDLOG file to cmdfile.
:FILE SDIN=cmdfile SDIN takes commands from this file.
:RUN SDMAIN.PUB.SYS Commands are now taken from cmdfile.
Both of the above methods give you the same result.
The Macro File (SDMACRO)
SDMAIN allows you to define macros (see the discussion of macros later in
this Chapter). The definitions are placed in a file that the system
loads when SDMAIN is run. The default is for there to be no macro file
(if no file named SDMACRO exists) and so no macros available when the
system is run. The file must be an unnumbered file with a record length
of 80 bytes or less (if over 80 bytes, only the first 80 are read and the
remainder are ignored).
Redirecting the Macro File. To redirect SDMACRO to a file, use the
following MPE file equation:
:FILE SDMACRO = macro file name
Now, the next time SDMAIN is run, the macros that have been defined in
macro file name are loaded for use. If no file equate is provided and
there is no file named SDMACRO, no macros are available for the next run.
You can use the OPTIONS command to change the macro file during a run.
The Output File (SDOUT)
SDMAIN's reporting information is written to the output file called
SDOUT. The default for this file is $STDLIST, which for sessions is your
terminal. Note that only output from reporting commands is sent to the
file. All other output (that is, HELP, SHOW, and error messages) is
still sent to $STDLIST.
Redirecting the Output File. To redirect SDOUT to a file, use the
following MPE file equation:
:FILE SDOUT = output file name
If the file does not exist, then SDMAIN builds it as a permanent ASCII
file with a record size of 132 bytes. If the file already exists, then
SDMAIN asks for permission to overwrite it:
filename.groupname.accountname already exists. Is it okay to overwrite
(N/Y)?
If you respond NO to the above prompt, output is directed to $STDLIST.
You can use the CONFIGURE command to change the output file during a run.
SDMAIN's Temporary Edit File
When you run SDMAIN, it creates an edit file named EDTXTxxx (where xxx is
a number). EDTXTxxx is created as a permanent file, but deleted when you
exit the system (as long as you do not abort the program). Therefore, if
you issue an MPE LISTF command while running SDMAIN, this file is listed.
If, however, you already have a file with the same name and number as the
EDTXTxxx file, SDMAIN increments the EDTXT number and uses that number.
For example, if you already have a file named EDTXT0, then when the edit
file is created, SDMAIN finds EDTXT0, increments the number to 1, and
creates an edit file with the name EDTXT1. There is, therefore, no
conflict between the two files, and your file, EDTXT0, is not deleted.
MPE/iX 5.0 Documentation