Studio RM - Tutorial MACROS
Studio RM - Tutorial MACROS
Studio RM - Tutorial MACROS
GOTO ------------------------------------------------------------------------------------ 14
HOLD ------------------------------------------------------------------------------------ 17
IF ------------------------------------------------------------------------------------- 18
INCLUDE ------------------------------------------------------------------------------- 23
KBOFF --------------------------------------------------------------------------------- 27
KBON ---------------------------------------------------------------------------------- 28
LET ------------------------------------------------------------------------------------ 29
LOADCF -------------------------------------------------------------------------------- 37
MACEND ------------------------------------------------------------------------------- 42
MACST --------------------------------------------------------------------------------- 43
MDEBUG ------------------------------------------------------------------------------- 45
MENU ---------------------------------------------------------------------------------- 49
NOHOLD ------------------------------------------------------------------------------- 52
NOMENU ------------------------------------------------------------------------------- 53
NORUN -------------------------------------------------------------------------------- 55
NOXRUN ------------------------------------------------------------------------------- 58
ONERR --------------------------------------------------------------------------------- 62
PICDIR -------------------------------------------------------------------------------- 64
PICFLD -------------------------------------------------------------------------------- 69
PICREC -------------------------------------------------------------------------------- 72
PROMPT ------------------------------------------------------------------------------- 77
REM ----------------------------------------------------------------------------------- 86
RETURN -------------------------------------------------------------------------------- 87
RUN ----------------------------------------------------------------------------------- 88
SCROFF -------------------------------------------------------------------------------- 93
START --------------------------------------------------------------------------------- 95
STKPAR -------------------------------------------------------------------------------- 96
STKSAV -------------------------------------------------------------------------------- 97
SYSFILE ------------------------------------------------------------------------------- 98
VARINIT ------------------------------------------------------------------------------- 99
VARLOAD ---------------------------------------------------------------------------- 100
VARSAVE----------------------------------------------------------------------------- 101
XRUN -------------------------------------------------------------------------------- 102
Introduction
Unconditionally branches to the named !SCREEN command and starts
executing it. The general format is:
!BACKTO <SCREEN NAME>
where <SCREEN NAME> is a string of up to sixteen character in length which
has been defined using the NAME: command within !SCREEN. It must be
present in the current macro/menu or an error will result.
Any previously executed !SCREEN command that contained a name can be
used as the target, as long as the macro or menu that contained the named
!SCREEN is currently active.
If the name is not a known screen name in the list of screens traversed in
the current terminal session, the name is treated as a local macro label, and
a GOTO is attempted.
Process Summary
BACKTO This macro command will make the macro system jump back to
the named !SCREEN command and start executing it.
Error and Warning Messages
None
Notes
If <SCREEN NAME> does not exist as either a screen name or as a label,
then the action taken is according to the current !ONERR setting.
Introduction
Displays on the screen a single line of text from within a macro.
Process Summary
ECHO Display a single line of text from within a macro.
Echo outputs any text supplied on the current macro line to the
screen. Echo ignores any !SCRON/!SCROFF screen re-direction
that may be active. The displayed text line always begins with a
space. For a blank output line, supply no text. Substitution in
the line is permitted, variables placed in single quotes will not
be substituted.
Example
A typical macro fragment:
!LET $msg='A flavour enhancer'
!LET $time=ENV(time)
!ECHO At $time, the value of '$msg' is "$msg"
… gives screen display:
At 14:30:35, the value of '$msg' is "A flavour enhancer"
Introduction
Ends a macro or menu. When the END command is processed, execution of
the menu or macro stops. This will return control to the keyboard, unless the
macro is called from a higher macro or menu, in which case control will
revert to the higher macro. Outside a macro END is illegal.
Process Summary
END Ends a macro or menu within a macro library.
Example
!END
Introduction
Detects the existence of a database file and sets up substitution variables to
the values of fields in the file, for a particular record. Default values of fields
may also be found. The format is:-
!FIELD <var1>=<filename>,<var2>=N,<var3>=<field1>,<var4>..
where <var1> is a substitution variable.
<filename> is the name of the database file.
N is the number of the record in the
database file.
<var2> is a second substitution variable.
<var3> is a third substitution variable.
and so on.
The command may extend over more than one line by ending the previous
line with a comma.
The variable <var1> will be set to 0 if the file does not exist, or there is a file
read error, or the file has no read access, or if any of the specified fields do
not exist. If the file exists, the DD can be read, read permission is granted,
and all fields exist, <var1> becomes 1.
The variable <var2> should be set to the value of the particular record
required. A value of 0 will give field default values, while + or a value greater
than the maximum number of records in the file will give the last record in
the file.
<var2> is set to the maximum number of records in the file or 0 if the
database file does not exist.
<var3> is set to the value of <field1> in record N.
<var4> is set to the value of <field2> in record N.
and so on.
Introduction
Detects the existence of a database file from within a menu or macro, and,
optionally, the number of records in the file. The format is:-
!FILE <var1>=<filename>,<var2>=recs
where <var1> is a substitution variable.
<filename> is the name of the database file.
<var2> is a second substitution variable.
Note that the name recs is not checked; any name following the = is
permitted. The structure is defined for consistency, and to allow future
extension of the format.
The variable <var1> will be set to 0 if the file does not exist, or there is a file
read error, or the file has no read access for the current usercode. If the file
exists, the DD can be read, and read permission is granted, <var1> becomes
1.
The optional variable <var2> will be set to the number of records in the file.
This will be zero if <var1> is zero.
Process Summary
FILE Finds if database file exists, sets number of records.
Format: !file <var1>=<filename>,<var2>=recs
where <var1> and <var2> are substitution variables.
,<var2>=recs is optional.
If <filename> exists/does not exist, <var1> is set to 1/0.
<var2> is set to the maximum no. of records in the file.
Introduction
Stores the current macro position and branches to a specified command label
within a macro or menu.
Process Summary
Stores the current macro position and branches to a specified command label
within a macro or menu.
Usage: GOSUB <LABEL NAME>
A subroutine is any portion of a macro or menu that:-
1. Begins on a label line !<LABEL NAME>:
2. Ends with a !RETURN statement.
The label may consist of up to 16 characters, and must be present in the
current macro/menu or an error will result. Labels are denoted by using the
special char ":" (colon) as in the macro line below:-
!MYLABEL:REM -- this line specifies the label "MYLABEL"
When an executing macro or menu encounters a GOSUB statement, it saves
the current line number and then branches to the specified label. Execution
continues normally until a RETURN statement is executed, at which point the
macro or menu jumps back and resumes execution at the line after the
GOSUB statement.
Execution of a RETURN statement without a corresponding GOSUB will give
an error. For nested macros, the RETURN statement must be in the same
macro or menu as the corresponding GOSUB statement. Up to sixteen
RETURN's may be pending at any time within the currently executing macro
or menu.
Introduction
Branches unconditionally within a menu or macro to the given label. Outside
a menu or macro GOTO is illegal. The general format is:-
!GOTO <LABEL>
where <LABEL> is an up to sixteen character label preceding a command
within the same menu or macro in which the GOTO command appears.
Upper and lower case labels are treated separately; for example, aaaa and
AAAA are different labels. The !START command may not be the target of a
!GOTO.
Labels within the GOTO command may be modified by substitution strings;
for example:
!GOTO a$1
may be entered, where $1 is defined by the !PROMPT (or RUN) command.
Process Summary
GOTO Unconditionally branches to a specified command label within a
macro or menu.
Usage: GOTO <LABEL NAME>
The label may consist of up to 16 characters, and must be
present in the current macro/menu or an error will result.
Labels are denoted by using the special char ":" (colon) as in
the macro line below:-
!MYLABEL: REM -- this line specifies the label "MYLABEL"
@FLAG5* =-1 do not execute the GOTO statement within a macro or
menu. This is used by the NORUN, NOMENU and NOXRUN
processes.
Error and Warning Messages
>>> INCORRECT LABEL XXXX IN GOTOXXXX OR XXXX NOT FOUND <<<
>>> ERR 75 <<< (recordno) IN MACGET
<listing of command line>
Either the label was too long (>16 characters), or the label was not
present in the macro or menu.
Introduction
Prevents exit from a menu or macro if a DATAMINE fatal error occurs. Under
these circumstances the current command in the menu or macro is
terminated, and the next one executed. This also applies to processes
executed by entering them directly as a command during a prompt from the
!PROMPT command. Note however that ! entered in response to a prompt
will still terminate the macro or menu, even if !HOLD has been specified.
Such a response must be trapped by the user to prevent exit under these
circumstances.
Once the !HOLD command has been given, it remains in force until the
!NOHOLD command (q.v.) is executed. Note that !NOHOLD is the default at
entry to a macro or menu.
The flag @FLAG3 is set to 1 to indicate that the !HOLD condition is in force.
Process Summary
HOLD Stops exit from macro or menu on DATAMINE fatal error.
Example
!HOLD
Introduction
Branches conditionally within a macro or menu to the given label. Outside a
macro or menu IF is illegal.
Process Summary
IF Evaluates one or more logical expressions involving
substitution variables and constants in a macro or menu. There
are two categories of IF command - "SIMPLE" and "BLOCKED".
1. SIMPLE IF COMMAND
Format: !IF <CONDITION>,...,GOTO XXXX
or !IF <CONDITION>,...,GOSUB XXXX
or !IF <CONDITION>,...,LET <EXPR>
A series of comma separated conditions may be supplied. If
all conditions evaluate to "true", an attached GOTO, GOSUB
or LET statement is executed.
<CONDITION> can be one of either: <VAR1> <OP>
<VAR2>
or: <LVAR>
<VAR1> is a substitution variable, or one of @FLAG1 to
@FLAG5.
<VAR2> is a substitution variable or a constant.
<OP> is an operator from the set "<", "<=",
"=", ">=", ">" or "<>". The last of these
means "not equal to".
<LVAR> is a "logical" variable. The expression is "false"
if <LVAR> = 0 or 0.0, and "true" for all other
values. Note: All alpha values evaluate as
"true"
XXXX is a 16 character label in the macro or
menu.
<EXPR> is any valid expression recognised by the LET
command.
Introduction
Allows records from a database file to be included as data and/or
statement lines in a macro or menu.
Process Summary
INCLUDE The "!INCLUDE" soft command enables records from a database
file to be incorporated as normal data and/or statement lines
within a DATAMINE macro or menu. When encountered at
runtime, the !INCLUDE command is replaced with one or more
records from the nominated file.
Format: !INCLUDE &FILE(file),*TEXT(textfld),
*KEY(keyfld), @VALUE='keyval'
&FILE(file) Specifies the database file to read, and must be supplied.
*TEXT(textfld) Is optional, and specifies the name of the field within &FILE
to use.
The default is 'TEXT'.
*KEY(keyfld),@VALUE='keyval' Are also optional. Taken together they
permit selection of a subset of records
from &FILE. Keyval is specified as a
quoted ('') string.
The statement may be extended onto as many lines as necessary;
continuation is implied by ending the previous line with a comma. !INCLUDE
commands can be nested. These are expanded as encountered, and placed
in a buffer for inclusion in the macro. The !INCLUDE command is discarded if
no (matching) lines are found in &FILE. It is illegal to supply additional
data/text on the !INCLUDE statement line.
The line(s) returned from &FILE must be valid data and/or command lines for
the macro/menu being executed. Blank lines in &FILE are honoured, and
passed on for macro processing. Substitution variables are permitted, both in
the statement itself and within the lines returned from the file.
The following restrictions should be noted:
1. Records from &FILE are stored in a buffer. Each line in the buffer is
processed in turn. When all lines have been processed, normal macro
execution resumes on the next line after the !INCLUDE call.
Introduction
Causes the response to prompted information to be read from the macro file.
This is the default method of operation, in force when a macro or menu is
entered. The !KBOFF condition is set when it is required to use macros as
pseudo batch runs, in which all files, fields and parameters are satisfied in
the command line, and all data read by the process is contained in the
macro.
The !PROMPT command executes an implicit !KBOFF command whenever it is
entered; however the !PROMPT command itself always expects responses to
come from the keyboard.
The !RUN, !XRUN and !MENU processes also execute an implicit !KBOFF
command when they are entered. This is because the default condition at the
start of a menu or macro is !KBOFF. Upon return from a macro the state
(!KBOFF or !KBON) returned will be that established at the end of the called
macro.
The system flag @FLAG4 is set to 0 to indicate the !KBOFF condition. The
!KBON command (q.v) which is the opposite of !KBOFF, causing all data to
be read from the keyboard, sets @FLAG4 to 1.
Process Summary
KBOFF Take prompted information from the macro or menu file.
Example
!KBOFF
Introduction
Causes the response to prompted information to be read from the keyboard
in place of the macro file. The !KBON condition is set when it is required to
force prompting for files, fields and parameters and data required by a
process to be satisfied from the keyboard, while control is retained inside a
macro or menu.
The !KBON condition is retained in force until a !KBOFF command is
executed, or the !PROMPT command is executed, which carries out an
implicit !KBOFF. Note that the !MENU, !RUN and !XRUN processes also carry
out any implicit !KBOFF. Thus upon return from a macro the state (!KBON or
!KBOFF) returned will be that established at the end of the called macro.
The system flag @FLAG4 is set to 1 to indicate the !KBON condition. The
!KBOFF command (q.v) which is the opposite of !KBON, causing all data to
be read from the macro or menu, sets @FLAG4 to 0.
Process Summary
KBON Take prompted information from the keyboard.
Example
!KBON
Introduction
Sets the value of a substitution variable.
The form of the command is:-
!LET <var>=<constant>
!LET <var>=<expression>
!LET <var>=<var1>
!LET <var>=<var1><op><var2>
!LET <var>=<constant1><op><var2>
!LET <var>=<var1><op><constant2>
!LET <var>=<constant1><op><constant2>
!LET <var>=<func1>(<var2>)
!LET <var>=<func1>(<constant1>)
!LET <var>=<func2>(<var2>,<var3>)
!LET <var>=<func2>(<constant1>,<var3>)
!LET <var>=<func2>(<var2>,<constant2>)
!LET <var>=<func2>(<constant1>,<constant2>)
where <var> is a substitution variable.
<constant> is either a number in DATAMINE format or a
character string.
<expression> is a mathematical expression which will be
evaluated using DATAMINE's expression parser.
<var1> is a substitution variable.
<op> is an arithmetic operator from the set
+ - * or /.
<var2> is a substitution variable with a numeric
value.
<constant1> is a numeric constant.
<constant2> is a numeric constant.
Introduction
The LOADCF process loads a character format system file, as set up for
example by the editor, into a random access system file to be accessed by
the !MENU process. It is used for producing user menu systems.
The character format system file containing the menu should be up to 80
characters wide. It must follow the normal macro conventions.
If there is more than one macro in the file to be loaded, only the first macro
will be loaded.
The user may choose the name of the binary random access menu file to be
created. This may be up to 56 characters long, and may include pathnames.
It must not contain the character '.', except as part of an up to three
character extension. If an extension is given, it will be used; otherwise an
extension of form.MEN will be appended. The following are legal menu
names:-
\datamine\projects\mymenu
mymenu.men
datamine/mymenu.dat
Note that the form of file accepted is system dependent.
If the response to the menu name question is blank<return> or just
<return>, then a name MENUFILE.DAT will be assumed. This is for
compatibility with earlier releases of DATAMINE.
The menu name set up in !LOADCF is the one that must be specified in the
!menu or !nomenu commands.
Process Summary
LOADCF Load character menu file into named binary menu file.
LOADCF pre-processes macros to increase their general runtime
performance. Specific optimisation can be performed for
customised SCREEN based menu applications.
Three levels of processing are available:
LEVEL = 0 Convert the macro file into the standard.STK
and.MEN files.
Introduction
Terminates the storage of interactive input in a character format system file.
The statement !END is first written to the system file and then the file is
closed.
Once the !MACEND command has been given it remains in force until the
!MACST command (q.v.) is executed.
Process Summary
MACEND Ends storing interactive input in system macro file.
Error and Warning Messages
STORAGE OF INTERACTIVE INPUT TO MACRO IS NOT ACTIVATED
A !MACST command had not been issued before !MACEND.
Notes
If no errors are detected the message:
STORAGE OF INTERACTIVE INPUT TO MACRO ENDED
is displayed.
Example
!MACEND
Introduction
Starts the storage of all subsequent interactive input in a character format
system macro file. The macro name may be specified following the MACST
command name. The macro name supplied is then appended to the !START
command and written to the system macro file. If no macro name is
specified in this way, a message is immediately displayed and the user must
supply one interactively in response to a prompt.
Once the !MACST command has been given it remains in force until the
!MACEND command (q.v.) is executed.
A MACST command would look like:-
!MACST macro1
SYSFILE>maclib.dat
Process Summary
MACST Starts storing interactive input in system macro file.
AAAAAAAA The macro name in the system file.
>SYSFILE> Enter name of character format system macro file for storage of
all subsequent interactive input. This file name may be up to 56
characters long and may contain pathnames (if these are
supported by your operating system). A response of !<return>
exits the process.
Error and Warning Messages
>>> ERROR READING FROM MACRO SYSTEM FILE ffffffff.fff <<<
An error has been detected in reading from the specified system macro
file. Fatal; the process is exited.
>>> ERROR WRITING TO MACRO SYSTEM FILE ffffffff.fff <<<
An error has been detected in writing !START <macroname> to the
system macro file. Fatal; the process is exited.
Introduction
Interactive source-code debugger for macros and menus.
Process Summary
Provides an interactive source code debugger for the development and
testing of macros and menus.
The facility provides features similar to that found in a computer language
debugger.
MDEBUG is implemented as a soft command in DATAMINE and can be
accessed in the following ways:
1. At the PROMPT input command by typing !MDEBUG
2. From the SCREEN F3 function key by entering the command MDEBUG
3. As an inline command within a macro or menu
MDEBUG passes control to the macro debugger and displays the current line
number. MDEBUG will display the current line and the action that caused
execution to pause at that line. One of three states will be indicated:
1. A BREAKPOINT has been previously set, and control has paused at a
breakpoint.
2. The STEP command has previously been entered from MDEBUG and the
previously been executed, and control has paused at the next command
line.
3. An inline MDEBUG command has been read from the macro or menu.
MDEBUG permits the execution of the following debug commands.
Commands can be abbreviated (to one character as each command starts
with a unique letter).
ASSIGN <stack variable> <string>
Assign value of <string> to <stack variable>.
<stack variable> need not already exist.
BREAKPOINT <label>
BREAKPOINT <line>
BREAKPOINT
Introduction
Initiates the currently established menu. The menu name is requested. This
must be the name of a binary random access menu file loaded by the
!LOADCF command.
!MENU commands should not be nested. A menu may be called from a macro
(!RUN or !XRUN command) or another menu, and a menu may call a macro.
Process Summary
MENU Executes a named menu.
The menu should previously have been loaded into a named
random access menufile by LOADCF.
>NAME > Enter the name of the required menu. The name is one of the
menus loaded by the LOADCF process. The name may be up to
56 characters long and may contain pathnames. The name
should not contain the character '.', except as part of an
optional file extension (.FFF). If there is no extension.MEN will
be appended. If the response is “?”, a help message will be
displayed. If the response is just <return>, the name
MENUFILE.DAT will be used.
Error and Warning Messages
>>> MENU FILE DOES NOT EXIST <<<
>>> ERR 78 <<< (0) IN RUN
The menu file either does not exist, or is malformed. Fatal; the process
is exited.
>>> WARNING - MORE THAN 250 SUBSTITUTION VARIABLES <<<
>>> ERR 84 <<< (250) IN UPDSTV
Only 250 variables may be in use at any time. Warning; the excess is
ignored and processing continues.
>>> MACRO NAME NOT FOUND <<<
>>> ERR 72 <<< (0) IN RUN
No !START command was found to introduce the menu. Fatal; the
process is exited.
Introduction
Allows exit from a menu or macro if a DATAMINE fatal error occurs, or if ! is
entered by the user. The current command in the menu or macro is
terminated, and control returns to the keyboard with the system prompt
!>>> if @DICT is set to 0, 1 or 2 or the message
>>> PRESS RETURN TO INVOKE COMMAND PROCESSOR <<<
is displayed if @DICT is set to 3 (i.e. the user is working with the full screen
interface).
!NOHOLD is the default condition on entry to a menu or macro.
Once the !NOHOLD command has been given, it remains in force until the
!HOLD command (q.v) is executed.
The flag @FLAG3 is set to 0 to indicate that the !NOHOLD condition is in
force.
Process Summary
NOHOLD Allows exit from macro or menu on DATAMINE fatal
error.
Notes
Unlike !KBON and !KBOFF, the current !HOLD/!NOHOLD position is
unchanged by calling a lower level macro. However, if the position is
changed within the lower level macro, then this is passed back to the calling
macro.
Example
!NOHOLD
Introduction
Checks the syntax of the currently established menu. !NOMENU works in the
same way as !MENU, except that the menu is not executed.
The menu name is requested. This must be the name of a binary random
access menu file loaded by the !LOADCF command.
Process Summary
NOMENU Validates the syntax of a menu.
The menu should have been loaded previously into a named
random access menufile by LOADCF.
>NAME > Enter the name of the required menu. The name is one of the
menus loaded by the LOADFCF process. The name may be up to
56 characters long and may contain pathnames. The name
should not contain the character '.', except as part of an
optional file extension (.FFF). If there is no extension.MEN will
be appended. If the response is ?, a help message will be
displayed. If the response is just <return>, the name
MENUFILE.DAT will be used.
Error and Warning Messages
>>> MENU FILE DOES NOT EXIST <<<
>>> ERR 78 <<< (0) IN RUN
The menu file either does not exist, or is malformed. Fatal; the process
is exited.
>>> WARNING - MORE THAN 250 SUBSTITUTION VARIABLES <<<
>>> ERR 84 <<< (250) IN UPDSTV
Only 250 variables may be in use at any time. Warning; the excess is
ignored and processing continues.
>>> MACRO NAME NOT FOUND <<<
>>> ERR 72 <<< (0) IN RUN
No !START command was found to introduce the menu. Fatal; the
process is exited.
Introduction
Checks a macro for syntax. Each macro command line is validated by the
Command Processor, but execution is not passed to the individual process.
This makes NORUN fast to execute, but prevents it from carrying out process
specific checks, as for example that files exist and are in the correct format.
The format of the NORUN command exactly matches that of the RUN
command.
The macro name may be specified following the NORUN command name. It
is located in the macro library attached to &MACLIB. If no macro name has
been specified, and there is more than one macro in the library, then a list of
macro names found in the library is displayed, and the user must select one
interactively.
If the macro contains substitution variables to be substituted at run time,
these substitutions may be entered on the command line, exactly as for the
RUN command. Note that if the !PROMPT, !LET or !STKPAR commands also
supply the same substitution variables, then these values override those
entered on the command line.
A NORUN command would look like:-
!NORUN MACRO,&MACLIB(MACLIB),$1='MYFILE'
Note that NORUN cannot be used to validate nested macros. Each macro
must be individually validated.
Process Summary
NORUN Validates syntax of a macro or menu in a database file.
&MACLIB The macro library.
AAAAAAAA (Optional) The macro or menu name in the library.
If there is more then one macro or menu in the library, and no macro or
menu name was specified, then a list of macro names is given and the user
must select the one required:
>NAME> Enter required macro or menu name. If the name entered
does not appear in the list, the question is repeated. A response
of !<return> will exit the process. A response of ?<return> will
give a help message.
Substitution parameters follow as retrieval criteria.
Introduction
Checks a macro for syntax. The macro library is located in a character format
system file external to the database. Each macro command line is validated
by the Command Processor, but execution is not passed to the individual
process. This makes NOXRUN fast to execute, but prevents it from carrying
out process specific checks, as for example that files exist and are in the
correct format. The format of the NOXRUN command exactly matches that of
the XRUN command.
The macro name may be specified following the NOXRUN command name. It
is located in the macro library name supplied in response to the SYSFILE>
prompt. If no macro name has been specified, and there is more than one
macro in the library, then a list of macro names found in the library is
displayed, and the user must select one interactively.
If the macro contains substitution variables to be substituted at run time,
these variables may be entered on the command line, exactly as for the RUN
command. Note that if the !PROMPT or !LET or !STKPAR commands also
supply the same substitution variables, then these values override those
entered on the command line.
A NOXRUN command would look like:-
!NOXRUN MACRO,$1='MYFILE'
SYSFILE>MACLIB.DAT
Note that NOXRUN cannot be used to validate nested macros. Each macro
must be individually validated.
Process Summary
NOXRUN Validates the syntax of a macro or menu.
The macro or menu should be in a character-format system file.
AAAAAAAA (Optional) The macro or menu name in the library.
>SYSFILE> Character-format macro or menu file. The name may be up to
56 characters long and may contain pathnames (if these are
supported by your operating system). If the response is
?<return> then a help message is produced. A response of
!<return> exits the process. If the file does not exist, a
message is produced and the process exited.
Introduction
Transfers control to a specified label in the menu or macro if a fatal error
occurs.
!ONERR works identically to the !HOLD command, except that transfer is
made to the specified label rather than to the next command in the macro if
a fatal error is found. A fatal error is one that causes the flag NFATAL to be
set. Such errors are described in the Reference Manual as 'Fatal'. The
exception to this is that syntax errors in macro or menu commands will
cause an immediate exit from the menu or macro.
The format is:-
!ONERR GOTOXXXX
where XXXX is an up to four character label in the macro. The label may be
separated from the GOTO for ease of reading.
Once the !ONERR command has been given, it remains in force until
cancelled. This may be done by use of the !NOHOLD command.
Like the !HOLD command, !ONERR uses FLAG(3) to indicate that the
condition has been specified. In the case of !ONERR, FLAG(3) holds the alpha
label string.
Process Summary
ONERR Transfers control to label on DATAMINE fatal error.
Format: !onerr gotoXXXX
where XXXX is a label in the current menu or macro.
Error and Warning Messages
>>> INCORRECT LABEL XXXX IN GOTOXXXX OR XXXX NOT FOUND <<<
<listing of command line>
>>> ERR 75 <<< (recordno) IN MACGET
Either the label (displayed below the message) was too long (>4
characters) or was not found in the menu or macro. Fatal; the menu or
macro is abandoned. recordno is the record number in the menu or
macro (from !START).
Introduction
Writes file names to an output file (catalogue file) if the file name or field
names within the file match the given pattern expressions.
Process Summary
PICDIR selects file names from the database directory if the file name or
contained field names conform to a series of pattern matching expressions.
Expression Syntax
In the following discussion, all keywords are capitalised. When running
PICDIR, any keyword may be entered in either uppercase or lowercase and
abbreviated to its first three (or more) characters.
The syntax of a pattern matching expression is:
[FILE] [REGEXP] <pattern>
or FIELD [REGEXP] <pattern>
or FIELD <kind>
or FIELD [REGEXP] <pattern>, <kind>
The keyword "FILE" is optional. If a pattern is to be matched against field
names, the keyword "FIELD" must be included. The field "kind" will be
matched against the type (numeric or alphanumeric) and storage class
(explicit or implicit) of the fields in any file.
The keyword "REGEXP" is normally omitted, in which case "pattern" may
consist of literal characters to be matched, or one of the following elements:
? Any single character.
* A group of zero or more characters.
[...] Any one of the characters enclosed in the square brackets.
The shorthand notation "a-z" means any lowercase letter; refer
to the examples below for more details.
[^...] Any character except one of these.
The special meaning of a character (e.g. "*") is lost if the character is
preceded by "\", hence to match a literal "*", use "\*". Quotes (double or
single) may be used to enclose patterns if desired.
Introduction
Writes field names to an output file if the field names in the input file match
the given pattern expressions.
Process Summary
PICFLD selects field names from a file if they conform to a series of pattern
matching expressions.
Field Selection Syntax
In the following discussion, all keywords are capitalised. When running
PICFLD, any keyword may be entered in either uppercase or lowercase and
abbreviated to its first three (or more) characters.
The syntax of a pattern matching expression is:
[FIELD] <pattern>
or [FIELD] <kind>
or [FIELD] <pattern>, <kind>
In each case, the keyword "FIELD" is optional. The "pattern" will be matched
against the names of the fields in the &IN file. The field "kind" will be
matched against the type (numeric or alphanumeric) and storage class
(explicit or implicit) of the input file fields.
A "pattern" may consist of literal characters to be matched, or one of the
following elements:
? Any single character.
* A group of zero or more characters.
[...] Any one of the characters enclosed in the square brackets.
The shorthand notation "a-z" means any lowercase letter; refer
to the examples below for more details.
[^...] Any character except one of these.
The special meaning of a character (e.g. "*") is lost if the character is
preceded by "\", hence to match a literal "*", use "\*". Quotes (double or
single) may be used to enclose patterns if desired.
Introduction
Writes records to an output file if the records in the input file match the
given input expressions.
Process Summary
PICREC selects records from a file if they conform to a series of input
expressions.
Expression Syntax
An expression may be either a relational expression or a pattern matching
expression.
In the following discussion, all keywords are capitalised. When running
PICREC, any keyword may be entered in either uppercase or lowercase and
abbreviated to its first three (or more) characters.
Relational Expressions
The syntax of a relational expression is:
[FIELD] <fieldname> <operator> [CONSTANT] <value>
or [FIELD] <fieldname> <operator> [FIELD] <fieldname>
or [CONSTANT] <value> <operator> [FIELD] <fieldname>
The keywords FIELD and CONSTANT are optional, and need only be specified
where necessary to avoid confusion (e.g. "ROCKTYPE=FIELD T2" or
"ROCKTYPE=CONSTANT T2").
Any of the six relational operators (">", ">=", "=", "<=", "<" or "<>") may
be used. "<>" means "not equal to".
Pattern Matching
The syntax of a pattern matching expression is:
<fieldname> MATCHES [REGEXP] <pattern>
If the keyword REGEXP is missing, a "pattern" may consist of literal
characters to be matched, or one of the following elements:
? Any single character.
* A group of zero or more characters.
Introduction
Displays lines on the screen and prompts for input. The !PROMPT process
allows menu screens to be built up, and substitution variables to be defined
or redefined as often as required. In-built validation procedures are available
on the responses to prompts.
The prompt process is followed by as many data lines as required. If the first
character of the line is 0 then the line will be displayed on the screen; if the
first character is a 1 then a prompt string is being defined. If the first
character is a 2, then the screen will be cleared. A line beginning with any
other character will be ignored as a comment.
Each data line may be up to 80 characters long, including the first 0 or 1. An
example is:-
!PROMPT
0
0 File listing macro.
0 ===================
1 Enter the file name to be listed (up to 8 chars)>'$1',a,8
!LIST &IN($1)
The user's response, supplied after the > character prompt is placed in
substitution variable $1, so that all subsequent references to $1 in the macro
will be substituted by the given response.
Numeric responses
The substitution variable, defined as shown by quotes, may optionally be
followed by a number of parameters. The most simple form of prompt string
is:-
1 Enter number>'$1'
The response to $1 must be numeric (i.e. an integer or decimal number of
form 12 or 12.56, a number with an exponent such as 2.3E-6, or the absent
data (lowest system number) response -, or the highest system number +,
or 'trace' (TR) or 'detection limit' (DL)). The number must lie within the
limits - and +, i.e. effectively unlimited.
Introduction
Allows comments to be put anywhere in a macro or menu file. Anything on
the line following !REM is treated as comment.
Process Summary
REM Allows comments to be put anywhere in a macro
or menu.
Example
!REM This menu used for input of additional drillhole data
Introduction
Transfers control back to the next statement following a GOSUB statement in
a macro or menu.
Process Summary
RETURN The GOSUB statement transfers control to a
subroutine; the RETURN statement transfers control back to
the next statement following the GOSUB.
There may be a number of GOSUBs to the same subroutine,
and a RETURN occurring in that subroutine returns control
to the statement following the specific GOSUB used to get
to the subroutine.
A subroutine should only be entered by using a GOSUB. Otherwise, the RETURN
statement will cause an error when it is executed.
Error and Warning Messages
None.
Example
!RETURN
Introduction
Starts execution of a macro in a database file.
The macro name may be specified following the RUN command name. It is
located in the macro library attached to &MACLIB. If no macro name has
been specified, and there is more than one macro in the library, then a list of
macro names found in the library is displayed, and the user must select one
interactively.
If the macro contains substitution variables to be substituted at run time,
these substitutions may be entered on the command line. Note that if the
!PROMPT, !LET or !STKPAR commands also supply the same substitution
variables, then these values override those entered on the command line.
A RUN command would look like:-
!RUN macro,&MACLIB(maclib),$1='myfile'
Process Summary
RUN ` Starts execution of a macro or menu in a database file.
&MACLIB The macro library.
AAAAAAAA (Optional) The macro or menu name in the library.
If there is more than one macro or menu, and no macro or menu name was
specified:-
>NAME> Enter required macro or menu name. If the name entered does
not appear in the list, the question is repeated. A response of
!<return> will exit the process. A response of ?<return> will
give a help message.
Substitution parameters follow as retrieval criteria.
Error and Warning Messages
>>> MACRO NAME NOT FOUND <<<
>>> ERR 72 <<< (0) IN RUN
No macroname supplied. (This message is only produced if !RUN is
executed from a macro, and no macro name is supplied; in this case,
name prompting does not take place). Fatal; the process is exited.
>>> SUBSTITUTION STRING NOT IN QUOTES <<<
Introduction
Directs text to a system file rather than the screen, in a macro or menu.
Process Summary
SCROFF Diverts text screen output into a system file during macro
execution.
Only output created by interactive prompts, or created by the soft
commands !ECHO, !PROMPT or !SCREEN is seen on the display.
!SCROFF only works from within a macro or menu, and then only
after !HOLD or !ONERR has been executed. If neither !HOLD or
!ONERR are active, a warning message is displayed, and screen
output continues to be seen as macro execution proceeds.
Screen output is re-established by means of the !SCRON command,
the !NOHOLD command, or whenever the macro or menu
terminates. For nested menus, each menu maintains its own
!SCRON/SCROFF status. The default on macro entry is !SCRON.
The system file name is based on the database directory name
("XXXXXLOG.DAT"), or from the first value assigned to an
environment variable called "ScreenLog".
@CLEAR Control the action to clear the screen and/or logfile: 0 none, 1
screen, 2 logfile, 3 screen and logfile (2).
Introduction
Redirects output to the screen following previous use of the !SCROFF
command in a macro or menu.
Process Summary
SCRON In a macro or menu, restores screen output previously diverted by a
!SCROFF command.
See SCROFF for a description of screen output control.
@CLEAR Control the action to clear the screen and/or logfile:
0 none, 1 screen, 2 logfile, 3 screen and logfile (0).
Example
!scron
Introduction
Starts a macro or menu. The START <macroname> command must be the
first in a macro or menu. The <macroname> parameter defines the name of
the macro or menu, and is referenced in the !MENU, !RUN or !XRUN
processes; it must be unique within a macro library. A macro name may be
up to 8 characters long, and may not start with the characters @, &, * or !.
It should not contain embedded blanks or the characters = > < ' or,. Upper
and lower case names are considered different.
Outside a macro START is illegal.
Following the macro name, a comment may be placed, separated from the
macroname by one or more commas. For example:-
!START mac1 This is a section plotting macro.
The macroname and the comment will be shown by the RUN or XRUN
processes, if the user is invited to select the required macro from several.
The !START command may not take a label preceding it.
Process Summary
START Names a macro or menu in a library.
AAAAAAAA The macro or menu name.
Example
!START MYMAC Macro to validate data.
Introduction
Retrieves substitution variables and their values from a system character
format file. This file may be set up by the !STKSAV command from within a
macro or menu, or it may be set up with a system editor. The variables from
file totally replace any existing variables in the stack. The form of the
command is:-
!STKPAR <filename>
where <filename> is a system file name. It may be up to 56 characters in
length and may contain pathnames. The <filename> may be substituted in
whole or in part by substitution variables. The form of the system file is:-
nnn Number of substitution variables on file. Max 250.
<var1><val1>
<var2><val2>
where <var1>,<var2> are the names of the substitution variables, and
<val1>, <val2> are their values. Each <var> occupies 8 characters,
followed by the value (max 72 characters).
Process Summary
STKPAR Reads substitution variables from a file.
Format: !stkpar <filename> where <filename> is a system file
name up to 56 chars long.
Error and Warning Messages
>>> !STKSAV OR !STKPAR: ERROR IN ACCESSING SYSTEM FILE <<<
<listing of command line>
>>> ERR 90 <<< (0) IN MACGET
The file did not exist, was the wrong type, or a read error was
encountered. This message will also occur if no file was specified, or the
file name was too long. Fatal; the macro or menu is exited.
Example
!STKPAR \DATAMINE\PROJECTS\$PROJ
Introduction
Writes substitution variables and their values to a system character format
file. This file may be read by the !STKSAV command from within a macro or
menu. The form of the command is:-
!STKSAV <filename>
where <filename> is a system file name. It may be up to 56 characters in
length and may contain pathnames. The <filename> may be substituted in
whole or in part by substitution variables. The form of the system file is:-
nnn Number of substitution variables on file. Max 50.
<var1><val1>
<var2><val2>
where <var1>,<var2> are the names of the substitution variables, and
<val1>, <val2> are their values. Each <var> occupies 8 characters,
followed by the value (max 72 characters).
Process Summary
STKSAV Saves substitution variables to a file.
Format: !stksav <filename> where <filename> is a system file
name up to 56 chars long.
Error and Warning Messages
>>> !STKSAV OR !STKPAR: ERROR IN ACCESSING SYSTEM FILE <<<
<listing of command line>
>>> ERR 90 <<< (0) IN MACGET
The file already existed and was the wrong type, or a write error was
encountered. This message will also occur if no file was specified, or the
file name was too long. Fatal; the macro or menu is exited.
Example
!STKSAV \DATAMINE\PROJECTS\$PROJ
Introduction
Checks to see if a system file exists and sets the value of a substitution
variable to 1 or 0 if the file exists or does not exist respectively.
Process Summary
SYSFILE Checks if a system file exists.
The command format is similar to the !FILE command:
!sysfile <var>=<pathname>
where <var> is a substitution variable which is set to '1' if the
file indicated by <pathname> exists, otherwise <var> is set to
0. The <pathname> may optionally be specified by means of a
substitution variable. If necessary, its length will be truncated to
56 characters.
Note that the existence of a file does not imply that the file is
readable.
Example
!sysfile $exists#=COLLARS.ASC
If the file COLLARS.ASC exists, $exists# will be set to '1', otherwise,
$exists# will contain '0'.
Introduction
Initialises the number of substitution variables to zero for the current macro
level.
Example
!varinit
Introduction
Enables substitution variables to be read from a file to be used with or to
replace substitution variables already being used in a macro or menu.
Process Summary
Reads substitution variables from a file. The variables read from file are
added to the current list if the parameter @MERGE equals 1, otherwise any
current variables are erased. VARLOAD will, (by default) load all substitution
variables, but will allow a named set of variables only to be loaded or merged
from the file.
Format: !VARLOAD <file>[,@MERGE=<merge>]
[,@DESC=$dname#][,$name#...]
where <file> is a system file path name up to 56 chars long. If the
parameter "@MERGE" is not specified, or <merge> is zero,
all current variables are erased. If <merge> is 1, any
variable that already exists in memory is updated with the
file value, and new variables are added to those in memory.
Both <file> and <merge> may be substitution variables.
The description supplied when the file was created can
optionally be restored into a supplied variable <$dname>.
If the optional list of variables is given, only these variables
are considered; otherwise all variables are loaded. The list
may be extended onto as many lines as necessary;
continuation is implied by ending the previous line with a
comma.
Example
E.g. !varload \datamine\projects\$proj, @merge=1, $title1#, $title2#,
$xmin#, $xmax#, $ymin#, $ymax#
Introduction
Enables substitution variables being used in a macro or menu to be saved to
a file, either adding to or replacing substitution variables already in the file.
Process Summary
Saves or merges substitution variables into a file. VARSAVE will, (by default)
save all substitution variables, but will allow a named set of variables only to
be saved or merged into the file.
Format: !VARSAVE <file>[,@MERGE=<merge>]
[,@DESC=<description>][,$name#...]
where <file> is a system file path name up to 56 chars long. If the
parameter "@MERGE" is not specified, or <merge> is zero,
all contents of <file> are cleared first. If <merge> is 1, any
variable that already exists in the file is updated with the
current macro value, and new variables are added to the
file. Both <file> and <merge> may be substitution
variables. A description for the contents of the file can be
supplied. The description is stored on the first record of the
file with the revision number, and can be up to 68
characters long. Quotes may be used enclose the
description. If the optional list of variables is given, only
these variables are considered; otherwise all variables are
saved. The list may be extended onto as many lines as
necessary; continuation is implied by ending the previous
line with a comma.
Example
E.g. !varsave \datamine\projects\$proj, @merge=1, $title1#,
$title2#, $xmin#, $xmax#, $ymin#, $ymax#
Introduction
Starts execution of a macro in a system file outside the database. This is
conventionally set up with the system editor. The maximum length of line is
80 characters.
The macro name may be specified following the XRUN command name. It is
located in the macro library name supplied in response to the SYSFILE>
prompt. If no macro name has been specified, and there is more than one
macro in the library, then a list of macro names found in the library is
displayed, and the user must select one interactively.
If the macro contains substitution variables to be substituted at run time,
these substitutions may be entered on the command line, exactly as for the
RUN command. Note that if the !PROMPT, !LET or !STKPAR commands also
supply the same substitution variables, then these values override those
entered on the command line.
An XRUN command would look like:-
!XRUN macro,$1='myfile'
SYSFILE>maclib.dat
Process Summary
XRUN Starts execution of a macro or menu.
The macro or menu should be in a character-format system file.
AAAAAAAA (Optional) The macro or menu name in the library.
>SYSFILE> Character-format macro or menu file. The name may be up to
56 characters long and may contain pathnames (if these are
supported by your operating system). If the response is
?<return> then a help message is produced. A response of
!<return> exits the process. If the file does not exist, a
message is produced and the process exited.
If there is more then one macro or menu in the library, and no macro or
menu name was specified, then a list of macro names is given and the user
must select the one required:
>NAME> Enter required macro or menu name. If the name entered
does not appear in the list, the question is repeated. A response