Suprtool
Suprtool
7 for MPE:
User Manual
Permission is granted to reprint this document (but not for profit), provided that copyright notice is given.
Qedit and Suprtool are trademarks of Robelle Solutions Technology Inc. Oracle is a trademark of Oracle Corporation,
Redwood City, California, USA. Other product and company names mentioned herein may be the trademarks of their
respective owners.
Phone: 604.501.2001
Support: 289.480.1060
E-mail: [email protected]
E-mail: [email protected]
Web: www.robelle.com
Table of Contents 3
Welcome to Suprtool 19
Introduction............................................................................................................................... 19
Suprtool Components ............................................................................................................... 19
Database Editing ........................................................................................................ 20
Speed Demon - Replacing DBGET Mode-2 .............................................................. 20
STExport - Data Export Utility .................................................................................. 20
Suprlink - Multidataset Access .................................................................................. 20
Suprtool2 - Interface Routine ..................................................................................... 21
Documentation .......................................................................................................................... 21
Notation .................................................................................................................................... 21
Highlights 23
Highlights in Suprtool 5.7......................................................................................................... 23
Highlights in Suprtool 5.6......................................................................................................... 23
Highlights in Suprtool 5.5......................................................................................................... 23
Highlights in Suprtool 5.4......................................................................................................... 23
Highlights in Suprtool 5.3......................................................................................................... 24
Highlights in Suprtool 5.2......................................................................................................... 24
Highlights in Suprtool 5.1.02.................................................................................................... 24
Installing Suprtool 26
Overview................................................................................................................................... 26
Ecometry Users ......................................................................................................................... 26
Instructions ............................................................................................................................... 26
Index 510
Introduction
Welcome to version 5.4 of Suprtool — the HP e3000 handyman for Image and
Allbase databases, MPE files, and KSAM files. Suprtool provides fast batch
reporting on your HP e3000. With Suprtool, you can select records from a file
(IMAGE, Allbase, KSAM, or MPE) to feed into your report program. Typically,
Suprtool enables you to produce the same report five times faster.
Suprtool performs best when you are selecting less than 50% of the entries. Once
selected, you can rearrange, sort, print, or total them. You need to modify your report
program to read a file instead of a dataset.
In addition, Suprtool solves dozens of other problems. The Dbedit subsystem allows
convenient, interactive editing of databases, the Suprlink subsystem allows multiple
dataset access, and the Speed Demon intrinsics allow a user program to improve the
speed of serial DBGET calls by a factor of five. Use STExport to convert fields from
a self-describing input file to an output file that can be imported into other
applications. The interface routine Suprtool2 allows your application programs to
invoke Suprtool.
The Suprtool commands are:
Add EDit ITem Q Use
BAse Exit Key REDO USERpause
Before EXPort LINk Reset Verify
Chain EXTract List SELect Xeq
Clean Form LISTREDO Set :MPE or HP-UX
command
Define Get Numrecs SOrt =expression
DELete Help OPen TAble
DO IF Output Total
Duplicate Input Put UPdate
Suprtool Components
The Suprtool package consists not only of Suprtool, but also of other programs that
perform useful database functions. These other programs are Dbedit, Speed Demon,
STExport, Suprlink, and Suprtool2.
Documentation
The user manual contains the full description of all the Suprtool suite of products
including Suprlink, STExport, Dbedit and Suprtool2, as well as usage tips and
commands for each. The manuals are up-to-date with all the latest changes. To see
only the changes in the latest version, see the "What's New" section of the manual, or
see the change notice.
You can download our manuals in PDF format or HTML format and even order
printed (hardcopy) manuals from our web site at:
http://www.robelle.com/library/manuals/.
Notation
The Suprtool documentation uses a common notation in describing all commands.
Here is a sample command definition:
EXTRACT field [(subscript)] [=value] [,...]
1. UPPERcase letters - literal symbols to be used in the command as they
appear (e.g., EXTRACT).
2. Lowercase, underlined or italic - "variables" to be filled in by the user
(example: field). Each such "variable" is defined elsewhere in terms of
Examples
The examples in this manual use the revised STORE database described in the
IMAGE/3000 Handbook.
Overview
We have two types of Installations, Tape and Download. We provide links to the
Installation instructions on our web site for each type of Install.
Ecometry Users
Users of the Ecometry application need to use the installation instructions supplied
by Ecometry Corporation. Those instructions have extra steps for updating the
Ecometry code accounts.
You will find the Ecometry version of these instructions at
http://www.robelle.com/ecometry/
Types of installations, tape, download combined qedit and suprtool tape.
Instructions
If you received a production release tape from Robelle, then you can install using the
instructions on this web page:
http://www.robelle.com/support/install/tape/stprod.html
If you downloaded the Suprtool production release from our web site then the
instructions can be found here for the ftp download method:
http://www.robelle.com/downloads/install-stprod-ftp.html
and here for the WRQ download method:
http://www.robelle.com/downloads/install-stprod-wrq.html
Suprtool prints its version number and the current time right after a banner Suprtool
then prompts with ">". Press Return after typing each command. For example, if you
type the help command:
>help
Suprtool prints some help text and a keyword list. Type a keyword or press Return to
leave Help.
To exit Suprtool, type "Exit" at the Suprtool prompt.
>exit
What is a Task?
Tasks are the building blocks with which Suprtool helps you to solve data processing
problems. In a task, Suprtool reads information from a file or database, selects and
processes some information, and writes out the result. You can visualize a Suprtool
task like this:
Copying Files
The Output command creates the file called "result", which is a copy of the input
file.
Appending to a File
To append to an existing file, use the Append option in the Output command.
>input file2
>output result,append
>xeq
Now the data file "result" has the same field names as the dataset d-sales. Suprtool
can read this data file and know about the fields automatically.
>input result
>if sales-total>20000 and product-price<5000
>output custlist
>xeq
Now you can use the field names "account", "first-name", "last-name", and "age" to
refer to the corresponding parts of the line, just as if this were a database record.
>input datafile
>define ...
>if age>65
>ext account, last-name
>output result
>xeq
>output result,link
>xeq
Repeating Commands
Repeating a Command
Use the Listredo command to see a list of your most recent commands. Use the Do
command to repeat a command, or use the Redo command to modify a command
before repeating it.
>listredo {20 most recent commands}
>listredo input {most recent Input commands}
>input result
>...
>xeq
>do input {repeat previous Input command}
>input result
>if quantity > 10000
>...
>redo if {modify previous If command, then repeat}
If you have used two commands that begin with the same letter, you have to be
careful when repeating those commands. Make sure you use enough letters to
identify each command distinctly from the other. In the following example, if you
wish to repeat the Input command instead of the If command, you need to use "do i
s" instead of just "do i".
>i somefile
>if <expression>
>...
>xeq
>do i s {repeats previous Input command}
Selecting by Criteria
Simple Criteria
To tell Suprtool to choose records based on certain criteria, use the If command.
Think of the If command as a shorthand for "Select all records that have...". In this
example Suprtool extracts all records with a sales-total value greater than 20000
from the d-sales dataset.
>get d-sales
>if sales-total > 20000 {select}
>output result
>xeq
Complex Criteria
To choose records using more complex criteria, combine several simple criteria
using AND, OR, NOT, and parentheses. In this example Suprtool extracts all records
that have a sales-total value greater than 20000 and a product-price value less than
5000 from the d-sales dataset.
String of Digits
If you have a byte-type field that consists entirely of digits, and you want to use this
field as a numeric field, you need to define a new display field on top of the existing
field. For example, suppose your data looks like the following, where the customer
account number is stored in the 8-digit byte-type field at the start of the record:
20476789...rest of customer record...
To find all customers with an account greater than 20470000, you would do the
following:
>get dataset
>define accountnum, account, 8, display
>if accountnum > 20470000
>output result
>xeq
Selecting by Date
Because IMAGE doesn't provide a built-in date type, most databases store dates as
numeric or character fields.
Before Suprtool can use a date field, it has to know the format of a particular date
field. Use the Item command to specify the format. For example, to tell Suprtool that
the item purch-date is a date field with a format of yyyymmdd (e.g., 20010319), you
would use:
>item purch-date, date, yyyymmdd {date format}
In the following date examples, we show the Item command in each example. In
practice, however, you only need to use the Item command once per date field, not
once per task.
Select by Year
Suppose we want to select all the sales transactions for 2000. Suprtool does not have
a short-hand for specifying "everything in that year". To specify an entire year, use a
date range from January 1st to December 31st.
>get d-sales
>item purch-date,date,yyyymmdd
>if purch-date >= $date(2000/01/01) and &
purch-date <= $date(2000/12/31)
>output result
>xeq
If we wanted to find orders for all customers except "1234", "9876", and "5555", we
would simply change the equal sign in the If command to a not-equal sign. A match
is made if a customer does not match any values in the list.
If you want to find all customers not on the list, just negate the If condition.
>if not $lookup(cust-table, cust-no)
You can also compare both a key value and data using the Table data feature.
>get ord-details
>table cust-table, cust-no, file, custlist,data(state-code)
>if $lookup(cust-table, cust-no, state-code) = state-code
>output orders
>xeq
What the above code does is load a table with key values and data, then as you are
reading serially thru the database, Suprtool looks up the key value in the table and
retrieves the associated data and returns it and compares against the field on the right
hand side of the equation. If no entry is found in the table then Suprtool returns
spaces for byte type fields and zero for numeric fields. This means of course that in
our example that if a cust-no did not exist in the table, the state-code returned would
be blank and if the state-code was blank in the ord-details dataset the record would
qualify.
If you don’t want to have any values returned from the table lookup, you just preface
the if with a standard lookup.
>get ord-details
>table cust-table, cust-no, file, custlist,data(state-code)
>if $lookup(cust-table,cust-no) and &
$lookup(cust-table, cust-no, state-code) = state-code
>output orders
>xeq
When using $lookup to return data, the $lookup must always be on the right side of
the equation. If not Suprtool will stop with an error:
If id-field=$lookup(mytable,char-field,id-field)
Error: $lookup in this context (data comparison) must be on left side
Now we can find information by loading a file of customer numbers into a table and
then applying the $lookup feature.
>get ord-details
>table cust-table, cust-no, file, custlist
>if status="PENDING" and $lookup(cust-table,cust-no)
>output orders
>xeq
So what Suprtool will do in this case is read a record, lookup the record in the table
and retrieve the data item in the table. If Suprtool does NOT find an entry in the
table, a zero will be returned if the data type is numeric and spaces will be returned if
it is a byte type.
So using the case above, if no entry is found in the table, zero is returned, and if int-
field is equal to zero, then the record will qualify.
If you don’t want to have any values returned from the table lookup, you just preface
the if with a standard lookup.
When using $lookup to return data, the $lookup must always be on then left side of
the expression. If not Suprtool will stop with an error:
>if id-field=$lookup(mytable,char-field,id-field)
Error: $lookup in this context (data comparison) must be on left side
Sort Records
This extracts all records from the dataset d-sales into a data file called "result". The
records are sorted by the field cust-account. Use the Sort command to do sorting.
>get d-sales
>sort cust-account {sort by cust-account}
>output result
>xeq
Deleting Records
To delete records safely from a database, you need two Suprtool tasks. The first task
backs up the data to be deleted; the second task deletes the records. You can interrupt
and restart the two-task method without harming your records. It may be faster to
combine the two tasks, but it can present problems: if you abort the task part-way
through, your database will be partially deleted, but you will not have a backup of
the deleted records.
Updating Records
To update records you can specify the fields to be updated with the Extract
command(s). The Update command must be entered before the Extract command.
You can Update part of a field by defining a portion of the field with the define
command and using the defined field in the Extract command.
You can update critical fields (IMAGE search or sort fields), by specifying the
Ciupdate option on the Update command. CIUPDATE must be turned on or Allowed
in the database. This can be turned on from within the DBUTIL utility.
You can also update using Arithmetic Expressions:
>get d-sales
>update
>extract total = price * qty + tax
>xeq
Duplicate Records
In the following examples, the key field is in the first four bytes of the record.
"Duplicate-ness" is based on records having the same key value. In any group of
records with the same key value, the first record is considered to be the "original",
and the rest are considered to be the "duplicates".
>get dataset
>table dup-table, keyfield, sorted, dupfile
>if not $lookup(dup-table, keyfield)
>output result
>xeq
>get dataset
>table dup-table, keyfield, sorted, dupfile
>if $lookup(dup-table, keyfield)
>output result
>xeq
Loading a Dataset
To load records into an IMAGE dataset from a disc file, use these commands:
>base store.data {specify which database}
>input transfile {input is from a disc file}
>put d-sales {add each record to the D-SALES dataset}
>xeq {execute the current task}
The layout of the input file must have the exact same format as the target.
Decimal Places
Data in files and databases often have an implied number of decimal places. For
example, dollar amounts usually have two implied decimal places for the cents. In
this case, the number stored is scaled by a factor of one hundred (e.g., you would
enter 10000 to represent $100.00).
>get d-sales
>if total-sales > 99900 {find sales > $999}
>out result
>xeq
You can use Suprtool's Item command to identify defined fields or database items
that have an implied number of decimal places.
You can use Suprtool's Item command to identify defined fields or database items
that have an implied number of decimal places. Once you do this, you can then enter
regular, unscaled numbers. For example, to enter five cents, use 0.05; to enter
$100.00, use 100. If a field is a dollar and cents amount scaled by 100, use the
following to tell Suprtool about the decimal place:
>item total-sales, DECIMAL, 2
With the Item command, the previous example becomes more understandable:
Converting Numbers
There are several ways to convert binary numbers (e.g. I2, P8) into human-readable
ASCII form. You can use STExport's Output,ASCII or Output,DISPLAY if you
want to convert all numbers.
If you want to convert only some of your numeric fields, you can use Suprtool's
numeric conversion feature to convert the binary fields to display fields.
define mynumber,1,6,display
get dataset
ext some-fields...
ext mynumber = binary-number
output filename
xeq
Note that this technique also works for converting a number from one numeric type
to another numeric type.
You may also convert from binary to ASCII directly by using the $edit function.
define mynumber,1,6,byte
get dataset
ext some-fields...
ext mynumber = $edit(binary-number,"999999")
output filename
xeq
The output file contains three fields. The first field is the cust-account that we
extracted. Suprtool created two new fields at the end of each output record: st-count
and st-total-1. St-count contains the number of times each cust-account occurred,
while st-total-1 contains the total sales for each cust-account.
Total by Field
If you want to get a single total for a field, without caring about subtotals on sort
breaks, you can use the Total command. Total prints out the result on $stdlist. For
example, to compute the total sales value for 2000 transactions, use these commands:
>get d-sales
>if purch-date>=000101 and purch-date<=001231
>total sales-total
>output $null
>xeq
Running Totals
You can get a running total on a field using the $total function.. The target data must
be a packed field with 28 digits, in order to help avoid overflow issues. A sample use
of the total function could be:
>def mytotal,1,14,packed
>get orders
>ext mytotal = $total(sales-amount)
>xeq
Running SubTotals
Suprtool has the ability to keep a running subtotal for any numeric field based on a
given sort key. The target data must be a packed field with 28 digits, in order to help
avoid overflow issues.
A sample use of the $subtotal function could be:
>def mytotal,1,14,packed
>get orders
>sort order-number
>ext order-number
>ext part-number
>ext description
>ext sales-amount
>ext mytotal = $subtotal(sales-amount,order-number)
>out sales,link
>xeq
This would result in a file containing a running subtotal in the field mytotal for a
given order-number. You could then generate a simple report with the simple
Suprtool commands:
The basic syntax for the $subtotal function in the extract command is:
extract targetfield = $subtotal(field,sort-field)
You must specify the sort command before referencing the sort-field in the $subtotal
function. You can subtotal up to ten fields per task.
Listing Records
You can print selected input records either formatted or with the Octal, Hex,
Decimal, or Character representations. To dump all sales records with a negative
amount, use these commands:
>get d-sales
>if sales-total < 0
>list lp
>xeq
This finds the entries that meet the selection criteria and prints them to the default
line printer, showing field names and field-values converted to ASCII. If you suspect
that your data is bad, you can dump the records in Octal/Char format instead:
>get d-sales
>if sales-total < 0
>list octal,char
>xeq
You can easily insert data into the middle of a record, again using the Extract
command. Define the first and second halves of the record as two big chunks. Now
Extract the first part, note the constant you wish to insert, then Extract the second
part.
Simple Reports
You can produce simple reports with Suprtool's List command. You select the
records for the report with the If command and the fields for the report with the
Extract command. Reports can include running headings with the date, title, and
page number and an optional line of column headings. Suprtool can produce default
titles and headings.
>get m-customer
>item credit-rating,decimal,2
>extract cust-account
>extract credit-rating
>list standard
>xeq
4598921 5000.00
44657844 20000.00
98753198 3000.00
These commands produce a report with four columns. The title consists of the Store
database and the m-customer dataset. The column headings are the name of each
field that we extracted.
Printing a Report
By default, the List command writes output to $stdlist, where lines are folded as
necessary to fit within 78 columns (to prevent line overflow).
To write the report to a system line printer, use the following :file command before
using the List command:
>:file suprlist;dev=lp;rec=-132
If you are writing a report to a LaserJet, we suggest that you add this command to
your task. It selects 175 column output in Landscape mode.
>set list pcl 1
Column Headings
Column headings default to uppercase field names. The names are truncated if they
are longer than the field itself. One space is inserted between fields.
Suprtool does not automatically align user-specified headings with the data columns.
We suggest specifying heading strings with the same length as the fields they
represent, while taking into account the space between the data columns.
In our example, we enter one column heading per line (using Suprtool's continuation
character "&"):
>list standard,heading &
{----+----1----+----2}
"City " & {field is X12}
"Account " & {field is Z8}
"First Name " & {field is X10}
"Last Name" {field is X16}
We included one space between fields. Note that an extra space was needed for the
Account heading (it is an 8-digit field, but we used 10 characters). Because cust-
account is a zoned-decimal field, an extra space is required for the sign.
The extract " " line creates a single field that consists of a blank space. Each of these
blank fields results in a blank line on our mailing labels, since the List command puts
one field on each output line.
If you want to combine two fields on one line, you would first have to create an
output file with the combined fields and use this file as input to List Oneperline.
Suprtool prints its version number and the current time right after a banner. It also
prints the name of the company that has licensed this copy of Suprtool.
Suprtool then prompts with ">". Press Return after typing each command. For
example, if you type the help command:
>help
Suprtool prints some help text and a keyword list. Type a keyword or press Return to
leave Help.
The user can enter the If command and an Exit command, all of the other options
could be in the Supruse file. An advantage of this method over using :RUN
SUPRTOOL;STDIN=XXX, is that the input file Supruse can be a Qedit file. With
the STDIN= option, the file must be an unnumbered /Keep file.
Son Process
If you run Suprtool within Qedit or SELECT, you can retain the Suprtool process
and re-activate quickly later.
:run qedit.pub.robelle
/:r suprtool.pub.robelle
>... {suprtool commands}
>exit
SUPRTOOL.PUB.ROBELLE is still alive. Okay to HOLD ? Y
/... {qedit commands}
/:activate
SUPRTOOL.PUB.ROBELLE
>... {more suprtool commands}
>exit
Program Held. Use :ACTIVATE/:RUN;HOLD to re-run.
/... {more qedit commands}
You can also use the I/O redirection capabilities of MPE/iX to achieve the same
goal.
:run suprtool.pub.robelle<kcommand
This file must not be numbered; use /Keep xxx,unn in EDIT/3000 or use /KQ in
Qedit. The maximum record width of this input file is 256 characters. Note: the Stdin
file must not be a Qedit workfile.
Suprtool prints all ASCII output messages to $stdlist, the MPE predefined name for
the standard job listing file. This is usually the terminal or the line printer, but it can
be re-directed with the :Run command. For example:
Using CREATEPROCESS
Since both command input and message output are under user control, it is possible
to run Suprtool as a "son process" from within an application program (see the MPE
Manual for CREATEPROCESS). You can check the Job Control Word to see if
Suprtool called Quit and terminated in an error state. See the Suprcall user manual
for a complete description of a working interface that is available to all Suprtool
users.
Duplicating Files
One of the most common reasons for using Suprtool in a SESSION is to duplicate a
disc file quickly. Accordingly, Suprtool has a special option to facilitate this
function. If you :RUN the Suprtool program with Parm=16, a file copy is implied
from Input to Output and no commands are needed. :File commands are used to
specify the names of the files. For example:
:file input = xxx
:file output = xxxnew
:run suprtool.pub.robelle;parm=16
:reset input
:reset output
With the User Defined Command facility (UDC) of MPE, you can reduce all of this
to a single command,
:dup xxx,xxxnew.
SuprtoolOutCount JCW
When Suprtool closes the output file, it sets a JCW named SuprtoolOutCount with
the number of output records. This is the same number reported in the total line (i.e.,
OUT=). You can use this JCW to control job stream execution by checking if the
SuprtoolOutCount JCW is non-zero. If there are more than 65,535 output records,
Suprtool sets SuprtoolOutCount to 65,535.
You can use the :Showjcw command to see the value of a JCW. For values greater
than 16K, Showjcw displays either the word WARN, FATAL or SYSTEM followed
by some digits. These words correspond to the following values:
Word Value
WARN 16384
Add the value of the word to the number that appears with it for the true value of
SuprtoolOutCount. For example,
:showjcw suprtooloutcount
SUPRTOOLOUTCOUNT = WARN8616
SuprtoolFullCount Variable
On MPE/iX, when Suprtool closes the output file, it also sets a variable named
SuprtoolFullCount with the number of output records. This is the same number
reported in the total line (i.e., OUT=). The advantage of the variable is that if more
than 65,535 records are written to the output file, the value of the SuprtoolFullCount
variable is not truncated.
Values may be combined by adding them together. For example, Parm = 96 means
"check with me before exiting, then when I do actually exit, terminate Suprtool
completely instead of suspending".
A Suprtool Task
Suprtool's primary function is to extract data quickly; its focus is batch extraction.
The key principle is: the bigger the input data source and the smaller the subset of
data selected, the more performance improves.
Your aim is to replace serial reads and selection with Suprtool. To do this, break
your task into components: an input choice, some processing selections, and the
output choice.
Input Choices
Suprtool can read input from an MPE or KSAM file, an IMAGE dataset, or a tape
file. Using :File commands, any MPE file with fixed-length records can be read by
Suprtool. Your first action is usually to select a database with the Base command.
Then, use the Chain or Get command for input from a dataset, and the Input
command for all other input choices.
Often you select a subset of the input records using the If command. Only selected
records are passed to the processing stage and the output choice.
Processing Selections
If you do not specify any processing, the input records are quickly copied to the
output choice. Some of your processing choices are
1. Sort the records into ascending or descending sequence (Sort or Key).
No records are output until all of the selected input records have been
sorted.
2. Total one or more input record fields (Total).
3. Remove or select duplicate records (Duplicate).
4. Delete the records from an IMAGE dataset (Delete).
Output Choices
Usually you wish to extract a subset of your records to feed into a report program, so
the default output file is a data file. The default output file format matches the input
file format, unless you use the Extract command. The output choice can be an MPE
Data-Types
When you specify a Select command, Suprtool figures out how to translate the
Allbase internal data-types into ones that Suprtool can process. Not all Allbase data-
types can be processed by Suprtool. The following table lists the Suprtool data-type
that corresponds to the Allbase data-type:
Data-Type Length
Date 10
Time 8
Datetime 23
Interval 8
Restrictions
Suprtool cannot currently handle all Allbase database concepts. The current
restrictions are:
1. Suprtool requires that the ownername be specified when selecting a
particular table in the following manner:
Reading Datasets
For Suprtool to read a dataset, it must have read-access to every field in the dataset.
If you have a database with item-level security, you must be careful to choose a
go to 10-read-and-report-exit.
10-10-get-d-sales.
*Use DBGET to read a d-sales record into buffer-d-sales.*
10-read-and-report-exit. exit.
Assuming that only a small percentage of the d-sales dataset have a sales-total
greater than $10,000.00, you would replace this scan with the following:
You would modify your application program to read the dsales MPE file:
10-read-and-report section.
read sales-file into buffer-d-sales at end
move true to end-of-sales-flag.
10-read-and-report. exit.
TurboIMAGE Compatibility
Suprtool is compatible with TurboIMAGE and TurboIMAGE/XL. Suprtool
automatically adjusts for a Turbo database; you do not need different versions of
Suprtool for different versions of IMAGE. Suprtool handles all of the limits
introduced with TurboIMAGE.
What happens if this "run" is aborted part way through? You must :Restore your
database and do a recovery. Any aborts will leave the database partially deleted.
If we break up this operation into two parts, archive first and delete later, we can
easily restart the job in the case of an abort.
First, we read and sort the data into the archive file:
Second, we read and delete the entries. This method takes slightly longer, but it can
always be restarted:
>get artrans
>if trans-date>=000101 and trans-date<=001231
>delete
>output $null
>exit
B-trees
HP has provided a generic search and partial key retrieval feature to IMAGE/SQL by
attaching B-trees to a master dataset key item. This feature is available in versions of
IMAGE/SQL C.07.03 and later. To determine the version number of IMAGE, run
Query (:Run Query.Pub.Sys) and enter the Version command.
:run query.pub.sys
>version
Similarly, you can also run Dbutil.Pub.Sys, type Help, and look for the Addindex
command.
B-trees are built only on the key item of a manual or automatic master dataset.
However, if the path into a given detail dataset has an attached B-tree, you can
implicitly take advantage of the B-tree by using a partial-key lookup on the
associated detail.
Suprtool can take advantage of these B-trees via the Chain command. Suprtool also
shows any B-trees that it can utilize through the Form command.
Limitations
Due to file system limitations, Suprtool can extract and sort more than 4Gb of data
only on MPE/iX 6.5 and higher. In prior versions of MPE/iX Suprtool is limited to
4Gb. Due to limitations in MPE/iX Suprtool cannot open a remote Jumbo dataset.
Notes
If Set Stat is On and Set Prefetch is greater than zero, then each time a file in a
jumbo dataset is closed, you receive a prefetch summary for each file. This could
appear in the middle of a >List, if you are listing to $stdlist.
The above Suprtool run is dangerous because it cannot be restarted if it is aborted for
any reason. The following Suprtool run can be restarted, even if the run is aborted.
KSAM/XL Files
Starting with MPE/iX 4.0, HP provided a new mechanism for tools like Suprtool to
access KSAM/XL files. This mechanism allows Suprtool to work the same for either
KSAM/V or KSAM/XL files. Some of the advantages are:
1. Suprtool is fifteen times faster than tools like FCOPY when reading a
KSAM/XL file.
2. Suprtool reads the input file in chronological order.
3. Set Recover On works for KSAM/XL. Note that if you build the
KSAM/XL file with the reuse option, the space from your deleted
records may be reused. In this case, Suprtool may not be able to recover
your records.
Suprtool will revert to slower method of reading KSAM/XL files if using selection
criteria, in other words an if command.
If your files have large block sizes or Suprtool seems to read the file incorrectly, you
may want to force Suprtool to read or write one record at a time (this is what FCOPY
does). To force Suprtool to read one record at a time, you would use:
>:file file.input;nomr;buf
>input file.input
>output file.output
>xeq
Message Files
Message files always have variable-length records. As such, they are not accepted by
Suprtool. Nor can Suprtool write them. On some releases of MPE, even opening a
message file with APPEND access in Suprtool (e.g., Output msgfile, APPEND),
erases the message file and may make your system run strangely.
Circular Files
Due to limitations in MPE, Suprtool can read circular files only one record at a time.
Suprtool automatically detects circular input files and adjusts itself accordingly.
Suprtool cannot write out to a circular file with the append option. You will need to
copy the circular file to a flat file and then append to the flat file, then write back to a
new circular file.
RIO Files
Suprtool does copy and sort RIO files, but normally Suprtool reads deleted RIO
records. Use a :File command to force Suprtool to ignore deleted records. The Input
command prints a warning about deleted records when it opens an RIO file.
You can force Suprtool to read an RIO file as FCOPY does. If you use the following
:File command on the input RIO file, all deleted records are ignored:
>:file inrio;buf;nomr
>input inrio
Suprtool must use buffered disc I/O when writing to an RIO file. This is much
slower than the standard Suprtool NOBUF/MR disc I/O, but it is the only reliable
way to produce an RIO file. A warning is printed in this case:
Warning: Writing to RIO files is slow
When the output file is an RIO file, Suprtool must open the output file with
NOBUF/MR access. This causes duplicate file errors if either of the following :File
commands are in effect for the output file:
You do not need to specify Save, since that is Suprtool's default. To create a
temporary output RIO file, use the TEMP output option:
>:file outfile;rio
>output outfile,temp
Temporary Files
Suprtool reads and writes temporary files. No special processing must be done if the
input file is temporary; just specify the file name in the Input command. By default,
Suprtool saves the Output file. You must use the TEMP option of the Output
command to save the file as a temporary file. The following sequence of Suprtool
commands causes TEMPFILE to be left as temporary:
:run suprtool.pub.robelle
>in permfile
>out tempfile,temp
>exit
Lockwords
If you do not specify a lockword as part of the file name, MPE prompts for the
lockword when Suprtool attempts to open the file. Because Suprtool must sometimes
open the input or output file more than once, you may be prompted multiple times
for the lockword. To avoid this prompt we recommend that you specify any
lockwords as part of the file name.
:run suprtool.pub.robelle
>input infile/lockword
>output outfile/lockword
>xeq
This is especially important when using the erase or append option to write to a
KSAM/V or KSAM/XL file with a lockword. In this case Suprtool must open the file
more than once (the number of fopens vary). To avoid being prompted multiple
times for the lockword, specify it as part of the output file name:
:run suprtool.pub.robelle
>input infile
>output outfile/lockword.group,erase
>xeq
SDUnix Utility
SDUnix is an MPE program that takes self-describing file information and writes it
out to an MPE flat file. This flat file can then be transferred to HP-UX together with
the data file so that Suprtool/UX can reference the self-describing information about
the fields.
To copy the SD file to the HP-UX machine, it must have an .sd extension and be in
the same directory as the data file. For example, if the data filename is
/usr/local/data/datafile, the SD file must have the name /usr/local/data /datafile.sd.
The SD file is written out to the same domain (permanent or temporary) as the input
file. The SD file contains only one record with the necessary length to store all of the
label information.
SDUnix Parameters
All SDUnix parameters are specified via Info = string. There are three parameters:
input-file sd-file LF | NOLF
The first parameter is the name of an MPE self-describing file. The second parameter
is the name of the .sd file that SDUnix created.
LF vs. NOLF
Use the third parameter to specify whether the data file has LF (line feed) as the
record separator, or whether the file does not use a file separator. If you use FTP to
copy the data file to your HP-UX machine, you should specify the NOLF option and
be sure to use a binary mode transfer. If you are using DSCOPY (with its default
options) to copy the data file, you should specify the LF option.
Examples
The following section contains examples of creating an SD file on MPE, converting
the SD information, and finally copying the two files to an HP-UX machine.
First create an SD file with:
:run suprtool.pub.robelle
>base store,5
Database password [;]?
>get d-inventory
>out dinv,link
>exit
Now you can convert the label information to an .sd file using the SDUnix utility.
Note that the data file is the first file passed in the info string.
Specify LF if you are using DSCOPY.
:run sdunix.pub.robelle;info="dinv dinvsd lf"
Now you can use DSCOPY to copy the files to the HP-UX machine.
SD Files as Input
When you specify an SD file as input to Suprtool, all the field information becomes
available. You can select, extract, and total fields without the Define command.
>input salefile {self-describing file}
>form {display the fields in the file}
>if sales-total > 10000 {select based on a field}
>extract cust-account {only extract a few fields}
>extract sales-qty
>extract sales-tax
>extract sales-total
>total sales-total {total a field from the file}
>output newfile,link {create a new SD file}
>xeq
Listing SD Files
Suprtool normally lists data files in an Octal/Char format. When listing an SD file,
Suprtool produces a formatted listing with field names and field values converted
into ASCII:
>input salefile {self-describing file}
>list {produce a formatted listing}
>xeq
Restrictions of SD Files
So far in this section, we have shown how to create self-describing files using the
Link option of the Output command. The Link option produces a special form of
self-describing file. Not all software can read this form of self-describing file. You
MPE/iX:
:build file2;rec=-80,16,f,ascii;key=(i,6,2,dup);ksamxl;ulabel=12
Like regular SD files, when you specify a KSAM SD file as input to Suprtool, all
field information becomes available. The Form command shows the structure of a
KSAM SD file.
HowMessy Loadfile
HowMessy produces a self-describing file (called Loadfile) with all of the
information from the HowMessy report. Suprtool is an ideal tool to process the
information in this file. For example, the following Suprtool commands would select
all detail datasets with a load factor greater than 85 percent:
:run suprtool.pub.robelle
>input loadfile
>if datasettype = "D" and loadfactor > 85.0
>sort database
>sort dataset
>dup none,keys
>list
>xeq
Notes on SD Files
There are two differences between regular Suprtool output files and SD files: the
filecode is not zero and there are user labels. For most applications this does not
make any difference, but some applications and tools may reject these files.
When creating an SD file, Suprtool maps J-type integer items into I-type.
Functionally, the two are equivalent.
Fast Sorting
Suprtool/iX uses a set of fast internal routines for sorting. These routines are twice as
fast as the HP sort routines supplied with MPE XL 3.0, and slightly faster than the
HP routines that come with MPE/iX 4.0 and 5.0.
By default, Suprtool/iX attempts to use the internal sort routines. If the internal sort
initialization fails for any reason, Suprtool/iX prints a warning and tries to do the sort
with HP's sort routines. If Native Language Support has been set (either
automatically via the NLDATALANG JCW or explicitly via Set NLS), HP's sort
routines are used.
The only way to tell which set of sort intrinsics are being used is to enable Set Stat
On. The statistics from Robelle's internal sort routines are more detailed than HP's
sort statistics.
Another recurring problem with MPE and tape files is odd-byte length records. We
suggest that when writing to tape, even-byte length records be used. These records
take exactly the same amount of space on tape or disc, because MPE always rounds
up the record length to the nearest full word boundary. To read data from an IBM
tape where records start on odd-byte offsets, use the DEBLOCK option of FCOPY.
Suprtool can not read or write EBCDIC tapes; use FCOPY instead.
Labelled Tapes
Specifying DEV=TAPE on a :File command causes MPE and Suprtool to create a
tape that has one file. If you need to have multiple files on one tape or if your file
takes more than one reel, you must use labeled tapes.
To use a labeled tape requires a different kind of :File command. A typical :File
command might be:
:file o;dev=tape;label="VOL1",,,next
The string "VOL1" is the name of this volume of tapes. This name appears on the
console. Note that it is possible to specify volume names in lowercase letters. Never
do this, as it becomes extremely confusing when working with the console.
Use the "NEXT" keyword when writing the first file to the tape. Be careful with the
"NEXT" keyword, because you can overwrite an existing labeled tape, even though
it has not expired.
Multiple Files
Do the following to store four files to a labeled tape:
:run suprtool.pub.robelle
>:file o;dev=tape;label="VOL1",,,next
>in a;out *o;x {first file on the volume}
>:file o;dev=tape;label="VOL1",,,addf
>in b;out *o;x {subsequent files are added to the end}
>in c;out *o;x
>in d;out *o;x
If all of these files are purged and you want to restore the file "D", you would do the
following:
:file i;dev=tape;label="VOL1",,,4
:run suprtool.pub.robelle
>in *i;out d;x
The "4" on the :File command instructs the file system to restore the fourth file on
the tape. If you forget the contents of a labeled tape, make FCOPY read it as if it
were unlabeled:
:file x;dev=tape;acc=update
:fcopy
from=*x;to=;char {displays the volume and the first file headers}
from=*x;to=;char;skipeof=+3 {displays the file header for the following file}
You will be asked for permission to scratch the label, but MPE does not scratch the
label unless you write to the tape.
Notes
There are two things to remember when working with multiple tapes in a single
volume set. The first tape reel in a volume has the same name as the entire volume
set. Subsequent tapes should have a different name. If you know that the file you
want to read is on the second reel, you can just mount the second reel.
If the files you are reading from the tape do not have any user labels, and Suprtool is
having difficulty reading the file, you can try this:
>Set Userlabels Off
See "Base Command [BA]" on page 128 for a discussion of remote database access.
User XL Files
You can add the native-mode Suprtool2 interface to your own XL file. For example,
If you forget to specify the XL file on MPE/iX, you get a similar error message.
:hello mgr.robelle,pub
:octcomp suprcm,suproct
:run suproct.pub.robelle
We consider this problem a bug in HP's native mode sort intrinsics, one unlikely to
be fixed. The solution is to use the Object Code Translated version of Suprtool to
sort files with records greater than 4096 bytes.
Example
Because Suprtool is now capable of CI variable substitution, you no longer need to
echo commands out to a file and subsequently use the newly created file.
The following example varies the sort order of an extract using a CI variable called
"order."
Setting the variables within Suprtool with variable substitution enabled, changes the
value of b.
>{different results from MPE CI}
>set varsub on
>setvar a 10
>setvar b "!!a"
>showvar [ab]
A = 10
B = 10
Suprtool does one level of variable substitution before the command is passed off to
MPE. If you are setting variables that reference other variables, we recommend you
set them before running Suprtool or temporarily disable variable substitution with the
Set Varsub Off command.
One way to ensure that Suprlink and STExport automatically get variables
substituted is to invoke Suprlink and STExport from the Suprtool command line. In
this way, variable substitution is actually done by the Suprtool command parser
before it passes the commands to Suprlink and STExport.
For example, suppose the title of the HTML report is stored in a variable named
"title." Pass commands to STExport using Suprtool's Export exportcommand syntax:
!setvar title 'Delinquent Accounts'
!run suprtool.pub.robelle
set varsub on
{execute task to create self-describing file foo}
export input foo
export html table title '!title'
export output ./delinq.html
export exit
exit
Note that the following sequence of commands would not have worked, where
STExport is invoked from Suprtool using the Export command with no parameters.
Variable substitution would not take place in this case:
!setvar title 'Delinquent Accounts'
!run suprtool.pub.robelle
set varsub on
{execute task to create self-describing file foo}
export
input foo
html table title '!title'
output ./delinq.html
exit
exit
You can then invoke the command file and subsequent prompting from within
Suprtool with the following command:
:run suprtool.pub.robelle;parm=4;info="use suprcmd.use"
You can also prompt for variables using the MPE Input command in any command
file and reference them as long as variable substitution is enabled with the command:
set varsub on
Resolving Variables
Suprtool, now has a setting called Set VarsubDebug on which will print out the line
after the variable substitution has occurred. This setting only works if Set Varsub is
on and Set VarsubDebug is on.
The output is formatted into 74 byte chunks and printed with a preceding “vd:” so
the “substituted” line is clear.
Decimal Places
Be sure to specify which fields have decimal places when creating the PRN file.
Suprtool reserves extra space for decimal points that appear in the PRN output.
When formatting numeric fields, Suprtool inserts the decimal point at the correct
place. When you import your file into your PC application, numeric fields are
automatically formatted correctly.
Spreadsheets
The following procedure allows you to include literal headings in your spreadsheet
using only one file, the size and shape of which is computed by STExport. We have
tested this method with MS Excel; it should work with any spreadsheet that supports
the importing of delimited files.
There are two steps. First, build a self-describing file with Suprtool, then use
STExport to convert it to PRN and add the headings.
1. In Suprtool build a self-describing file:
>input ...
>define items...
>item items...
>extract fields...
>output sdfile,link
>xeq
The file Pcdata is a variable-length PRN file with both headings and data.
Replace the Numrecs parameter with the number of records that will be extracted by
the Suprtool run. The default Numrecs is 1 when the report limit is set to 1.
Remove the Keep parameter to create a temporary file instead of a permanent one.
Suprtool can write to temporary files as easily as to permanent files. Temporary files
have the advantage that when multiple batch jobs are running at the same time and
trying to use the same file names, the files won't interfere with each other. Permanent
files, on the other hand, may not have to be rebuilt every time. The same permanent
subfile can be used repeatedly, as long as the record structure doesn't change. The
entire first step of running Quiz or QTP to create the subfile may be omitted.
The Set Subfile statement in Quiz creates a PowerHouse subfile. Subfiles are regular
MPE files (or KSAM/XL files, in the case of indexed subfiles) which have user
labels containing their record descriptions, in Cognos' proprietary format. The data
portion of the files is standard, however, and can be read by other (non-Cognos)
products. It is important to ensure that when you read a subfile with Suprtool, you
define the fields correctly so that Suprtool's view of the data structure exactly
matches the PowerHouse description of the records.
There are a number of reasons to use QTP instead of Quiz to create subfiles:
Quiz subfiles always reflect a record structure based on the lowest level of
redefinition in the dictionary. So if an item is redefined, it appears once for each
redefinition in the dictionary. For example:
Record CUSTOMERS
Item CUSTOMER-NUM character size 6
Item CUSTOMER-NAME character size 40
redefined by
Item COMPANY-NAME character size 40
end
redefined by
Item FIRST-NAME character size 20
Item SURNAME character size 20
end
The customer-name field is redefined twice in the dictionary. Although the record
size of the file is only 46 bytes, a Quiz subfile created with
>report summary all
A subfile created with QTP, on the other hand, would exactly match the record
structure of the source file. Therefore, it is always safer to use QTP to create the
subfile, as it is more likely to match the structure of Suprtool's output record.
With QTP's Include parameter, it is easy to include either specific fields from the
record or all of the fields. You can also easily include fields from other datasets. This
is handy when creating a subfile that holds the output from a Suprlink task.
The subfile is created from the single statement :makesub from within the Suprtool
task.
The preceding form of the Makesub command file achieves the goal of simplifying
the Suprtool code, but it can still be improved. A better form would incorporate a
few more features for added flexibility. The following version of Makesub provides
these advantages:
1. The capacity of the subfile can be specified.
2. The subfile can be temporary or permanent.
3. The subfile can contain either all the elements of a file, or selected
elements.
QTP is used instead of Quiz so that there are no multiple redefinitions of any item.
This helps ensure that the layout of the subfile matches the output record that
Suprtool creates.
parm subfile, dataset, temp_or_not=" ", flimit=10000
anyparm include=!dataset
if "!temp_or_not" = "TEMP"
setvar keep " "
setvar purgetemp ",temp"
else
setvar keep "keep"
setvar purgetemp " "
endif
file s=!subfile,old!temp_or_not
if finfo("*s",0)
purge !subfile !purgetemp
echo Existing subfile has been purged
endif
This listing shows you the attributes and sequence of the fields, but doesn't give any
clues as to their storage format.
QSHOW gives a much more useful listing:
Subfile: SALESUB
Type: Permanent
Organization: Direct
Format: 7
Record Size: 38 Bytes
Notice that this listing shows the offset of the fields within the record (with the first
field starting at offset 0), the length (size) of the fields, as well as the storage data-
type. In most cases, these map directly onto the IMAGE/Suprtool data-types. (See
Translation Table above.)
For example, the above subfile can be defined in Suprtool as follows:
>define cust-account,1,8,display
>define deliv-date,9,4,integer
>define product-no,13,8,display
>define product-price,21,4,integer
>define purch-date,25,4,integer
>define sales-qty,29,2,integer
>define sales-tax,31,4,integer
>define sales-total,35,4,integer
Database: STORE.DEMO.ROBELLE
Of course, if the subfile contains only some of the fields, then you'll need to define
them individually. But you can still use Suprtool's Form command to examine their
storage structure in the datasets from which they've been extracted.
will guarantee a 4-byte integer field. When in doubt, use QSHOW to examine the
structure of the subfile.
Data-Type Field
Count Integer size 4
Subtotal Float Size 8
Minimum Float Size 8 for numerics, Character size nn
for char fields
Maximum Float Size 8 for numerics, Character size nn
for char fields
Average Float size 8 subtotal, Integer size 4 count,
and an Integer size 4 filler of binary zeros.
Percent two Float Size 8 subtotals
Ratio two Float Size 8 subtotals
Sysname Character size 40
Sysdate Phdate integer size 2 or 4 (if century
included)
Systime Integer size 2 (HHMM format)
Once inside QSHOW, you must Set Report Device Printer so that QSHOW uses the
QSHOLIST file. The advantage of using QSHOLIST is that only the actual file
report is put in the file, not any of the other information printed by QSHOW (such as
the program banner).
PowerHouse subfiles can be processed in the same way as files defined in the
PowerHouse dictionary (QSCHEMA). There is a QSHOW command called Show
Subfile, which works identically to Show File and produces a report with the same
information. Some of the columns are off horizontally, but our Quiz example
program fixes that.
Use the QSHOW command Set Compressed to suppress the page numbers and other
heading information in the QSHOW report.
A sample output from QSHOW would look like this:
Subfile: F184A.PC (Permanent)
Format: 3
Record Size: 138 Bytes
Item Type Offset Size Occurs
PRONUM CHARACTER 0 18
INSHP FLOAT 18 4
REFNUM CHARACTER 22 10
SONUM CHARACTER 32 10
ARFSC CHARACTER 42 4
TYPNUM INTEGER 46 2
SOES1 CHARACTER 48 30
SOES5 CHARACTER 78 30
BILNAM CHARACTER 108 30
Record Qshow-Subfile
Item Filler1 character size 1
Item Name character size 23
Item Type character size 18
Item Offset freeform size 10
Item ItemSize freeform size 10
Item Occurs freeform size 18
Record Qshow-File
Item Key character size 6
Item Name character size 35
Item Type character size 18
Item Offset freeform size 4
Item ItemSize freeform size 5
Item Occurs freeform size 12
Note that we have two definitions, one for the Show Subfile output and one for the
Show File output. We use the same names for the columns and adjust the Size to
accommodate the differences in horizontal positioning. Note that Freeform is a
number stored in a character field; Quiz automatically converts it to a number.
The output from the above example would look like this:
This represents a simple use of definition processing from the data dictionary. There
are many other uses for this technique. These are some other examples: to create
record definitions for FORTRAN programs (define variables for each field, and
EQUIVALENCE them to the proper element of a buffer array), for tape file transfers
to other machines (create a new file with all numeric fields converted to type Zoned),
and to create PC database structure definitions for receiving downloaded data (also
see "Format Options" on page 231).
Quiz edits the user's input for a valid date. Note that there is no ACCESS statement,
but Quiz still writes one record to the output file. Execute the resulting commands as
a Suprtool usefile:
:run suprtool.pub.robelle;parm=4;info="use stcode"
This doesn't require any special dictionary declarations, as it uses MPE "echo"
commands to create the file.
Third-Party Indexing
Omnidex is a product from Dynamic Information Systems Corporation (DISC).
Superdex is a product from Bradmark Technologies, Inc. Each product provides
generic and keyword search capabilities for IMAGE data. It is necessary to keep
their index information up-to-date when any program, including Suprtool, adds or
deletes records from the indexed database.
In MPE/iX 4.0, Hewlett Packard has provided an interface that ensures that the
Omnidex and Superdex indexes remain up-to-date. You only need to enable third-
party indexing (TPI) using DBUTIL. Once this is enabled, MPE automatically calls
the TPI intrinsics to maintain the indexes as records are added, delete and modified.
:run dbutil.pub.sys
>>enable mybase for indexing
>>exit
Z-type TPI-keys
Suprtool supports stand-alone “Z” type keys. Suprtools form command will show the
keys that it can support via the chain command.
form d-inventory
If you use the Suprtool2 interface to invoke Suprtool, you need the following MPE
commands to force Suprtool2 to run the call-converted copy of Suprtool:
:setjcw suprtool2filecommand = 2
:setjcw suprtool2lib = 2
:file suprtool = suprtool.cc.disc
For Omnidex versions starting with 3.00 you can use call conversion by running
Suprtool in the following manner:
:run suprtool.pub.robelle;xl="xl.pub.disc"
If you encounter any difficulties running Suprtool with call conversion, please call us
for assistance.
Due to a conflict between the Robelle sort and the OmniQuest product, Suprtool's
fast sort algorithms must be turned off. This may be done with the following Set
command:
>set sortfast off
If you encounter any difficulties running Suprtool with OmniQuest, please call us for
assistance. If you do not turn off Set sortfast off, you will likely receive the error
Data Memory Protection Trap.
move (cust-out)="YES";
set(match) list(cust-out);
find(serial) customer-detail,
list=(cust-name,cust-addr,cust-nbr,cust-out),
sort=(cust-nbr),
perform=p100-process-customer;
end cust;
find(serial) *suprfile,
list=(cust-name,cust-addr,cust-nbr,cust-out),
perform=p100-process-customer;
end cust;
If this program is a batch program, you would insert the following MPE and Suprtool
commands before you invoke the TRANSACT program:
!run suprtool.pub.robelle
>base cust.database,5,read
>get customer-detail
>if cust-out="YES"
>extract cust-name,cust-addr,cust-nbr,cust-out
>sort cust-nbr
>output suprfile
>exit
!run tranprog.pub
If this program is used on-line, you would invoke Suprtool using the Suprtool2
interface (see the Calling Suprtool user manual). To avoid file name conflicts, on-
line programs should use a job temporary Suprtool output file. For TRANSACT to
read a temporary file, the asterisk in the file name is required.
If you use the LIST= statement, you have to use the Suprtool Extract command to
specify the desired fields. The order of the fields in the Extract command must match
the order of the fields in the LIST= statement. The Extract may be omitted if the
TRANSACT program reads all of the fields in the dataset, but the program must be
recompiled if the dataset is changed.
The Suprtool If command replaces the MATCH register of the TRANSACT
program. You can still use the MATCH register to do further selection (e.g., from
other datasets).
A FIND(Chain) can be modified to use Suprtool, but you must verify that your
program actually runs faster (in many cases it will not). To change a FIND(Chain) to
use Suprtool, use the same steps as FIND(SERIAL).
QUERY Program
QUERY can't produce a report from an MPE file. Because the output from Suprtool
is an MPE file, it is not usually feasible to use Suprtool to improve the speed of
Previously the $date function would convert the user specified $date to 1940/12/26
in order for it to be compared to the date-field format of CCYYMMDD. Now with
Set Date Cutoff xx, Suprtool assumes 20 for the century if the two-digit year
specified in the $date function is less than the value of Set Date Cutoff. For example:
>set date cutoff 50
>item date-field,date,ccyymmdd
>if date-field <= $date(40/12/26)
Suprtool in this case assumes the full $date to be 2040/12/26, because the 40 in $date
is less than the 50 in Set Date Cutoff.
The default value of Set Date Cutoff is 10.
In this example, if any ship-date has a year of 14 or less, then the century applied to
the new-ship-date field will be 20. Ship-dates with a year of 15 or more will have a
century of 19 applied.
Error: You must specify the century or Set Date ForceCentury off
will not find the date of December 10, 2000. You will need to use the $stddate
function to make this task work correctly.
>if $stddate(date-field) >= $date(98/12/10)
Suprtool does record selection on the numeric value of the field and not on the
implied date value. If we move the calendar ahead to January 1, 2000 and do the
same commands as above, the result would the same as if you had typed:
>if invoice-date < 000101 {on 1st January, 2000}
If you have some invoice dates from the previous century (e.g., 990101 for
December 1st, 1999), they will not be selected.
Suprtool returns this error by default, but you can override it with the following set
command:
>set date ifyy2000error off
This tells Suprtool to allow the previously described relative operations and suppress
the error message. While you can override the error checking, the behavior of $today
and $date is not changed.
YY of AAMMDD CCYY
A0 - A9 2000 - 2009
B0 - B9 2010 - 2019
C0 - C9 2020 - 2029
Because letters are greater than numbers in the collating sequence we can ensure that
aammdd dates beyond 1999 will order correctly.
Suprtool also supports other date formats with this two-digit year representation.
These formats are aamm, mmddaa and ddmmaa.
Invalid Dates
The If command has a $invalid function to find all invalid dates for a particular field.
An invalid date is any number of a particular date format whose date equivalent
cannot be found on the calendar. For example, a date with a month of 99 will be
considered invalid.
>base store.demo
Database password [;]?
>get d-sales
>item deliv-date,date,ccyymmdd
>if $invalid(deliv-date)
>out baddates,link
>xeq
First, we need to know and understand our data. Are there any invalid dates? If so,
does the value have some other logical meaning?
>get d-sales
>item deliv-date,date,yymmdd
>item purch-date,date,yymmdd
>if $invalid(deliv-date) or $invalid(purch-date)
>list
>xeq
>GET D-SALES (9) >OUT $NULL (0)
CUST-ACCOUNT = 10010 DELIV-DATE = 999999
PRODUCT-NO = 50513001 PRODUCT-PRICE = 19220
PURCH-DATE = 999999 SALES-QTY = 2
SALES-TAX = 2691 SALES-TOTAL = 21910
In this example, we see two records that do not contain proper dates. The first record
contains all 9s, which is probably used as some sort of flag. We may need to add 99
in front of these dates.
But the second record is obviously wrong. We can use Dbedit to correct this before
converting the other dates. We need to know our data to properly convert to a new
date format.
Once all the incorrect dates are fixed, we can start converting. We can add a prefix of
19 or 20 to all the appropriate dates by using the following Extract statement. Please
note that we are updating this directly. In case we need to redo this task, we only
convert those dates that have not yet been converted. In this example we set the
cutoff year to 30 so any dates before 30 will have 20 as the century and the others
will have 19.
>get d-sales
>set date cutoff 30
>item purch-date,date,yymmdd
>item deliv-date,date,yymmdd
>if not $invalid(purch-date) and not $invalid(deliv-date)
>update
>ext purch-date = $stddate(purch-date)
>ext deliv-date = $stddate(deliv-date)
>xeq
We have now converted all the J2 yymmdd dates to a ccyymmdd format and added
the correct century to the date.
You want to convert to a date format with room for a cc at the beginning of the
deliv-date and purch-date:
Database: STORE.DB.ACCOUNT
D-SALES Detail Set 5
Entry: Offset
CUST-ACCOUNT Z8 1 (!M-CUSTOMER)
DELIV-DATE X8 9
PRODUCT-NO Z8 17 (M-PRODUCT)
PRODUCT-PRICE J2 25
PURCH-DATE X8 29
SALES-QTY J1 37
SALES-TAX J2 39
SALES-TOTAL J2 43
Capacity: 608 (16) Entries: 0 Highwater: 0 Bytes: 46
In order to convert these dates you need to be able to put either a 19 or 20 in front of
the yymmdd date, depending on the value of the year. Before you can do either of
these you must confirm, once again, that you have no invalid dates.
>base store.dbold
>get d-sales
>item deliv-date,date,yymmdd
>item purch-date,date,yymmdd
>if $invalid(deliv-date) or $invalid(purch-date)
>list
>xeq
Once you have confirmed that there are no invalid dates you can start converting the
dates that you have. Because there are two date fields in this dataset you must be
careful to add the appropriate century for the proper field. For this example, assume
that if a year is less than 1950 then the century should be 20.
You can easily convert each date by processing each field separately by using an
intermediate self-describing file:
>get d-sales
>set squeeze off
>item deliv-date,date,yymmdd
>if deliv-date >= $date(1950/01/01)
>out sales01,link
>ext cust-account
>ext "19"
>ext deliv-date / sales-total
>xeq
IN=15, OUT=14. CPU-Sec=1. Wall-Sec=5.
Now you can convert the other field from the flat file, (sales01) and add a century to
the purch-date field:
>reset
>base {close the open database}
>in sales01
>item purch-date,date,yymmdd
>if purch-date >= $date(1950/01/01)
>set squeeze off
>out sales02,link
>ext cust-account / product-price
>ext "19"
>ext purch-date / sales-total
>xeq
IN=15, OUT=15. CPU-Sec=1. Wall-Sec=1.
Because you extracted all 15 records you know you do not have any records with the
purch-date field that need to be updated with a "20".
Now you can insert the records into the new database:
>base store.db
>in sales02
>put d-sales
>xeq
You want to convert these two dates to a data format of yymmdd before adding a
century in front of the year. This can be easily accomplished by defining each sub
part of the date and extracting those parts in the new order. You can use string
addition to re-order the field in one pass.
>in sales04
>def new-deliv,1,6
>item new-deliv,date,yymmdd
>def deliv-date-mm,deliv-date[1],2
>def deliv-date-dd,deliv-date[3],2
>def deliv-date-yy,deliv-date[5],2
>def new-purch,1,6
>item new-purch,date,yymmdd
>def purch-date-mm,purch-date[1],2
>def purch-date-dd,purch-date[3],2
>def purch-date-yy,purch-date[5],2
>ext cust-account
>ext new-deliv = deliv-date-yy + deliv-date-mm + deliv-date-dd
>ext product-no / product-price
>ext new-purch = ext purch-date-yy + purch-date-mm + purch-date-dd
>ext sales-qty / sales-total
>out sales05,link
>xeq
Performance Issues
HP e3000 sites use Suprtool because it provides access to their data many times
faster than they are used to, and because Suprtool enables them to perform time-
consuming DP functions easily, with a few simple commands. The typical Suprtool
task consists of extracting some data for a report, then feeding the Suprtool output
file into the final report program. For example, you might fill a Quiz subfile with the
subset of data needed, then report that subfile with Quiz.
CPU-Bound?
Suprtool uses the technology of multirecord access (NOBUF/MR) to achieve large
reductions in CPU overhead, 1/8th that of serial DBGET in many cases. On a CPU-
Sort Speed
Suprtool/V uses the HP sort intrinsics, so sort times should not show much change.
Suprtool/iX uses its own set of high-speed sort intrinsics, unless one of the following
is true:
• Set Sortfast is Off (the default is On).
• Native Language Support is enabled (either automatically via the
NLDATALANG JCW or explicitly via Set NLS).
• Any of the sort fields are defined as type CHAR.
Generally, Suprtool's internal sort algorithm is faster than HP's sort algorithm.
Performance Summary
Suprtool is a performance tool. Not because every Suprtool command is always fast,
but because performance is one of our first concerns when adding new features to
Suprtool. We always look for the fastest way to do any task, even if that means it
can't be quite as flexible as other software tools.
Suprtool Functions
Suprtool supports environment variable substitution. To use this enhancement you
must do a:
>set varsub on
Over the years we've grown the if/extract function list, to the point where it needs it's
own documentation for both the if and extract commands. Functions can be used in
both the if and extract commands, however, some functions were sometimes written
to either be specifically used in either if or extract, but typically have an application
in both.
>if $lookup(mytable,key)
becomes:
>if (mytable,key)
In order to rectify this all that needs to happen is you "Escape Out" the Environment
Variable from being resolved by changing the script to be:
>if \$lookup(mytable,key)
When you do this UC4, (and HP-UX for that matter), now knows that the $lookup is
not a token that needs to be resolved as an environment variable but the $lookup is a
literal.
String/Byte Functions
Suprtool has a number of functions that work on String/Byte type fields. In all cases
the target and source of these functions are byte type fields and are treated as strings
internally to Suprtool.
If Usage:
>if $trim(last_name) = “ARMSTRONG”
This means that Suprtool will qualify "ARMSTRONG", " ARMSTRONG", "
ARMSTRONG" etc.
Example:
If Usage:
if $ltrim(first_name) = "NEIL "
Example:
DEF lastname,1,16,byte
EXT lastname=$ltrim(last_name)
Example:
def lastname,1,16,byte
ext lastname=$rtrim(last_name)
Data Examples:
>IN STRINGS.NEIL.GREEN (0) >OUT $NULL (0)
LASTNAME = ARMSTRONGbb
>IN STRINGS.NEIL.GREEN (0) >OUT $NULL (0)
LASTNAME = ARMSTRONG
Data Result
Neil Armstrong
If Usage:
if $upper(first_name) = "NEIL"
Example:
def lastname,1,16,byte
ext lastname=$upper(last_name)
Data Examples:
>ext lastname=$upper(lastname)
>IN STRINGS.NEIL.GREEN (0) >OUT $NULL (0)
LASTNAME = ARMSTRONG
If Usage:
if $lower(first_name) = "neil"
Extract Usage:
ext byte_target=$lower(byte_source)
Example:
def newfirstname,1,16,byte
ext newfirstname=$lower(first_name)
Data Examples:
>ext lastname=$lower(lastname)
>IN STRINGS.NEIL.GREEN (0) >OUT $NULL (0)
LASTNAME = armstrong
If Usage:
if $proper(first_name) = "Neil"
Extract Usage:
ext byte_target=$proper(byte_source)
Example:
def fullname,1,30,byte
ext fullname=$proper(first_name)
Data Examples:
>ext fullname=$proper(fullname)
>IN STRINGS.NEIL.GREEN (0) >OUT $NULL (0)
FULLNAME = Neil Armstrong
If Usage:
Not that commonly used.
Extract Usage:
extract field=$split(field_from,start_pos,instance,end_pos,instance)
define acct-x,1,12,byte
define fullname,1,30
ext acct-x=$split(record,first,",")
ext fullname=$split(record,",",",")
Data Examples:
Source Data of record acct-x result
123456789,"Neil Armstrong",435 123456789
Data Examples:
>IN STRINGS.NEIL.GREEN (0) >OUT $NULL (0)
ACCT-X = 123456789
>IN STRINGS.NEIL.GREEN (0) >OUT $NULL (0)
FULLNAME = "Neil Armstrong"
If Usage:
clean "^10"
if $findclean(e-mail)
Extract Usage:
extract byte_target=$target(byte_source)
Example:
clean "N"
set cleanchar " "
extract byte_target=$clean(byte_source)
Data Examples:
Source: Neil
Target: eil
Example, remove Line Feed from E-mail Address field and shift data to the left:
Clean "^10"
set cleanchar "<null>"
ext e-mail=$clean(e-mail)
If Usage:
translate "A:C"
if $translate(Full_Name)="Neil Crmstrong" { not commonly used }
Extract Usage:
translate "A:C"
translate "B:D"
translate "a:f"
extract New-byte-field=$translate(byte-field)
$ETOA
Purpose is to convert Ebcidic to Ascii, for a byte type field.
$ATOE
Purpose is to convert Ascii to Ebcidic, for a byte type field.
Extract Usage:
Extract $atoe(char-field)
$etoa and $atoe cannot be used in if command, nor do they put a result in a field,
they just extract the converted byte-type field.
String Addition
Suprtool is capable of doing string addition, again this is with byte type fields, you
can do add various byte type fields together and even the results of various functions
from above.
Extract Usage:
extract target_byte_field = byte-field1 + " " + byte-field2
extract FullName = $trim(first_name) + ' ' + $trim(last_name)
Example:
extract FullName = $trim(first_name) + ' ' + $trim(last_name)
Data Result:
>IN STRINGS.NEIL.GREEN (0) >OUT $NULL (0)
FULLNAME = "Neil Armstrong"
Numeric Functions
There are a number of functions that are used to assist and help perform some
arithmetic operations.
$TRUNCATE
Purpose is to not round a given result or arithmetic expression or number. Suprtools
default behaviour is to round a result, the $truncate function will change that
behaviour.
Extract Usage:
extract new_price=$truncate((qty * price) / 100)
$ABS
Purpose is to return the absolute value of a given number.
IF Usage:
if $abs(credit-field)=5000
Extract Usage:
extract newnum=$abs(credit-amt)
$TOTAL
Purpose is to provide a running total for any numeric field and deposit the result into
a packed-decimal field.
IF Usage:
Not commonly used in if
Extract Usage:
define mytotal,1,18,packed
ext mytotal=$total(sales-amount)
$SUBTOTAL
Purpose is to provide a running total for any numeric field and deposit the result into
a packed-decimal field. The target packed-decimal field is reset to 0 on a control
break on the specified sort field.
IF Usage:
Not commonly used.
$COUNTER
Purpose is to provide a running counter starting from 1, and the target/result field is a
double integer.
IF Usage:
Not commonly used.
$SUBCOUNT
Purpose is to provide a running counter starting from 1, and the target/result field is a
double integer. The counter is reset when the control-break occurs on the specified
sort field.
IF Usage:
Not commonly used
Extract Usage:
define mysubcount,1,4,double
sort customer-no
ext mysubcount=$subcount(customer-no)
IF Usage:
Not commonly used:
Extract Usage:
extract packed-field=$signed(int-field)
extract display_field=$signed(dbl-field / 10)
Arithmetic Operations
+ - * / mod
Suprtool has the ability to perform any and all Arithmetic functions on numeric
fields.
If Usage:
if sales-total <> (sales_qty * unit_price) + sales_tax
Extract Usage:
ext sales-total=(sales_qty * unit_price) + sales_tax
Conversion/Formatting
$NUMBER
Purpose is to convert a freeform number, to a number that can be put into an actual
numeric field. The target must be numeric and the source field must be a display type
field, even though it can have non numeric characters in it.
Extract Usage:
define disp-field,byte-field,display {define byte as display with same
length}
define newdouble,1,4,double
ext newdouble=$number(disp-field)
Data Examples:
$5.00 ---> 500
Notes: Suprtool will try and match the decimal places of the defined by the item
command of the numeric target to the decimal places in the actual data and handle
the data properly. For example if the target field has an item command definition of
two decimal places, Suprtool will handle the data Raw data accordingly:
Raw Data Result of $number
5.1 5.10
5.123 5.12
5.139 5.14
$EDIT
Purpose is to format a number or byte-string field to a particular format using an
editmask similar to the syntax found in Cobol into a target byte-type field. Primarily
designed to help format data for list and/or reports.
If Usage:
if $edit(somefield,"$$$$.99-")="$5.00" {Not commonly used}
Extract Usage:
ext byte-field=$edit(dbl-field,"$$$$.99-")
ext byte-field=$trim($edit(dbl-field,"$$$$.99-"))
Data Examples:
500 $5.00
Other Functions
$LOOKUP
Purpose is to determine if a key value has been loaded into memory with options to
reference associated data.
Extract Usage:
table tablename,key,file,filename,data(data-field)
extract target-field=$lookup(tablename,key,data-field)
$READ
Purpose is to expand the command line limit for an if command beyond 256
characters.
If Usage:
if $read
-number=1 and
-number=3 and
-//
Date Functions
$TODAY
Purpose is to determine the current date.
If Usage:
If date-field=$today(-1)
if date-field=$today
Extract Usage:
ext target-date=$today
The date-field and target-date must be defined as having a particular date format
(item command) and in a proper container for that particular date type.
If Usage:
if date-field=$date(*/*/*)
Extract Usage:
ext date-field=$date(*/*/*)
Date-field must be defined as having a particular date format (item command) and in
a proper container
$INVALID
Purpose is to determine if a given date is valid or not.
If Usage:
item check-date,date,ccyymmdd
if $invalid(check-date)
Extract Usage:
Not typically used in extract.
$STDDATE
Purpose is to convert from any supported Suprtool date in any container to
CCYYMMDD in a double integer container. For date formats with only two digit
years Suprtool will look at the value of Set Date Cutoff in order to determine what
century to convert it to, whether it be 19 or 20.
If Usage:
item my-yymmdd-date,date,yymmdd
if $stddate(my-yymmdd-date) = 20141213
Extract Usage:
item my-yymmdd-date,date,yymmdd
define new-ccyymmdd-date,1,4,double
ext new-ccyymmdd-date=$stddate(my-yymmdd-date)
If Usage:
if ($days(entry-date) - $days(order-fulfill-date)) >=30
Extract Usage:
extract new-date=$stddate($days(entry-date) + 10)
General Notes
Do not enter the > sign when When you run Suprtool, it prompts for commands with a ">" character and reads
typing commands. command lines from the standard input device. Suprtool commands contain a
command name which may include one or more optional parameters that are each
separated by commas.
In this chapter, we describe the Suprtool commands in alphabetic order. Each
command name is followed by its minimal abbreviation in brackets. For example:
[D] for Define and [DU] for Duplicate.
Most Suprtool commands work within the context of the input file. In general, the
Base, Chain, Get, and Input commands must be entered before other commands.
Once the input source has been specified, commands can be entered in any order.
Abbreviating
You may shorten the command name to any substring that uniquely defines the
command. For example, Form can be abbreviated as FO or F, since there are no
other commands that start with "F". Duplicate, however, can be abbreviated only to
DU, since there is also a Define command in Suprtool.
>i sdfile {Input command}
>l {List command}
>x {Xeq command}
Uppercase or Lowercase
You can enter the letters in either uppercase or lowercase because Suprtool upshifts
everything in the command line except literal strings within quotes (e.g., "abc").
These two commands are identical:
>EXTRACT QTY
>extract qty
Caution: Suprtool cannot distinguish between several commands on one line and
several commands entered on several lines. This is not a problem when using
Suprtool in batch, as Suprtool stops executing when an error occurs. But when using
Suprtool interactively, specifying multiple commands separated by a semicolon,
Suprtool keeps on parsing the rest of the line after it finds an error. For example, if
you misspell the "fldname" when you type the following,
>get dsetname; if fldname="value";del;out filename;xeq
Suprtool sends you an error message with the typo, but continues with the rest of the
command line. This has the effect of deleting all the entries in the dataset. It is risky
to type Xeq on the same command line as any other command unless:
1. You are not concerned with the consequences if you make a mistake
(e.g., any "extract" task should be safe).
2. You don't make any mistakes.
The usual reason for putting all the commands on one line, including the Xeq, is to
permit repetition of the task by using the Before command. It is not necessary to type
everything on one line because with the Listredo command, Suprtool allows you to
pick and choose any of your last 1000 commands.
Continuation
The maximum command that The maximum physical command line is 256 characters. You may enter commands
may be specified in the Info= on multiple input lines by putting an "&" continuation character at the end of the
parameter of the Run line. The maximum total command length is 256 characters. The separating comma
command is 80 characters. in commands is not optional. Should your If command exceed 256 characters, use
the Table command, or $read.
>in sdfile
>if status="20" and & {continue the If command}
state="AZ","CA","OR" {select several states}
>output outfile
STREAMX
STREAMX is a product from VESOFT that permits you to build flexible job
streams. STREAMX contains a complete programming language with loops,
prompts, and parameter substitution. A problem arises when trying to enter
MPE Commands
If Suprtool doesn't recognize the command you have entered, it tries to interpret it as
an MPE command. Suprtool also interprets any command line beginning with a
colon (:) as an MPE command. Only the commands that MPE allows in "break" are
allowed in Suprtool/V. This feature can be used to establish :File commands for the
input or output files, to :PURGE the output file to avoid a duplicate file name error,
and to include :COMMENT lines. For example:
>:comment sort custfile by custnum
>input custfile
>key 1,10 {no colon on the next command}
>purge sortcust {make sure that no duplicate file error occurs}
>output sortcust
>exit
MPE/iX Commands
Suprtool/iX executes any MPE command (e.g., Run), UDCs, and command files.
Caution: programs that suspend, instead of terminating, are not killed by the
HPCICOMMAND intrinsic.
Calculator
Any command line beginning with an equal sign (=) is treated as a calculator
expression. This feature can be used to compute blocking factors and do other
calculations without the need of an electronic calculator. For help, type =?.
Control-Y Interrupt
You can interrupt a Suprtool task with the Control-Y key (hold down Control while
striking Y). Suprtool responds by telling you how much work it has done
(IN=,OUT=,etc.) and asks if you wish to stop. Hit the Return key to continue or type
YES to stop the task. Even though you abort the task, your output file is saved
(although it may be empty if you stop before the sort phase is over).
Error Recovery
There are several errors that can occur during a Suprtool "task":
1. The output file fills up.
2. There are invalid packed-decimal or zoned-decimal digits in the input
record.
3. There is a duplicate key when writing to a KSAM file.
4. An attempt is made to delete a master dataset entry which still has
associated detail entries.
5. Suprtool tries to Put a record to a detail dataset that does not have an
associated master entry.
6. An attempt is made to add a master dataset entry which already exists.
7. An attempt is made to delete a dataset record that has changed.
For errors 4 through 7:
If Set Ignore is Off (default), Suprtool prints an error message and stops processing
the input file. For KSAM errors, the standard file information display is printed. For
IMAGE errors, Suprtool prints whatever information is available on the record that
caused the DBDELETE, DBPUT, or DBUPDATE error (when Set Dumponerror
On).
The information from IMAGE errors may include the input record number, the
output record number and the data values of the record. Suprtool uses the current
options of the List command to print the data values. If no List command was
specified, Suprtool uses the List defaults.
To only see a summary of IMAGE errors that occurred, turn Set Dumponerror Off.
To continue processing, even when errors occur, turn Set Ignore On.
Examples
The first example shows a typical Suprtool task. A dataset in the Store database is
read and a subset of the entries are sorted into a disc file:
>base store,5,READER {open for read access only}
>get d-sales {select an input dataset}
>if sales-total>10000 {choose a subset of all entries}
>sort cust-account {sort by account number}
>output salesout {output has same structure}
>exit { as the d-sales dataset}
Our next example opens the database with the Creator password (which is the
default). No output file is produced; instead, we produce a formatted listing of the
input dataset:
>base store {use the Creator password}
>form sets {you cannot remember the names}
>get d-inventory { of the datasets in Store}
>list {print the dataset fields formatted.}
>exit { no output file is created}
In session mode, this command would prompt for the database password. If none is
entered, or Suprtool is not running interactively, the Creator password is used by
default (;). Because the open mode was not specified, the database is opened in
mode-1.
File Commands
You can use a :File command to re-direct a database name to another group and
account in Suprtool. For example:
:run suprtool
>:file dbx=db23.data.test
>base dbx
>get cust-master
Because the remote database feature generates a :File command, you cannot combine
these two features. If you specify a remote system in the Base command, the
specified basename must be precise. Any existing :File command will have been
overruled. When Suprtool closes a remote database, any :File command for the
database is reset.
You must have already done the necessary :DSLINE and :REMOTE HELLO
commands. This is the only way to read from a remote database in Suprtool. You
cannot use the "Remote Database Access" facility of IMAGE. Suprtool does a :File
command for the base name before calling DBOPEN.
:file basename=basename; dev=system#disc.
Jumbo Datasets
Due to limitations in MPE/iX, Suprtool cannot open remote Jumbo datasets. Suprtool
will fail with an error similar to that showed as below:
Open Modes
Base does not allow mode-7 for exclusive read access, but it does allow mode-4 for
exclusive update while others read. Mode-4 disallows changes while you are
extracting from the database. Mode-3 for fully exclusive access is tolerated, but
causes Suprtool to use slow DBGETs to extract from datasets. Mode-3 should only
be used when you need to do a Delete or Put command with Set Defer On.
Suprtool allows you to open a second database in the Put command when you are
copying from one database to another.
Examples
>listf @.soruce {"source" is not spelled right}
NON-EXISTENT GROUP. (CIERR 908)
>Before {redo most recent command}
listf @.soruce {last command is printed}
our {you enter changes to it}
listf @.source {the edited command is shown}
{you press Return}
>listredo -10/
>before 5 {redo 5th command in stack}
>bef 8/10 {redo 8th through 10th}
>b listf {redo last Listf command}
>b listf temp {redo "listf temp" command}
>b @temp {redo last containing "temp"}
>before -2 {redo command before previous one}
>before -5/-2 {redo by relative lines}
Modify Operators
If you wish to change any characters within the line, the modify operators are the
regular Control Codes used in Qedit:
Characters Action
Any printing characters replace the ones above
Control-D plus spaces deletes columns above.
Control-B puts you into "insert before" mode.
Control-A starts appending characters at the end of line.
Control-A, Control-D, plus spaces deletes from the end.
Control-T ends Insert Mode, allowing movement to a
new column.
Control-G recovers the original line.
Control-O specifies "overwrite" mode (needed for
Persistent Redo
Redo commands can be saved in a permanent file and can therefore be used from
another session. You can use the Set redo command to specify a filename to save
your redo commands. Please see "Redo" on page 262 for details.
If you want to select sales records for more than one customer, you would use:
>chain d-sales,cust-account="12345","67890","39201"
>out out2
>xeq
The Chain command allows the partial key retrieval on X- and U- type items on the
master dataset, and implicitly on any associated detail dataset. For example,
>base cd.db.data,5,reader
>chain a-songs,song-title="w@"
>list
>xeq
Warning: Using DBGET for the input records
>GET A-SONGS (289) >OUT $NULL (0)
SONG-TITLE = we only come out at night
As previously mentioned, we can search a detail dataset by using the implicit B-tree
or the search item that has a B-tree attached to the associated master.
Third-Party Indexing
If MPE/iX third-party indexing is enabled, the Chain command takes advantage of
third-party indexes in the specified dataset. The search-field parameter can be any
IMAGE index or any third-party index. Only X- and U-type fields are supported.
Use the Form command to see which index fields Chain will accept. The value you
specify is still restricted to the maximum length of the search-field. The following
example uses a third-party index to only match customer entries where the last name
starts with the letter "A":
>chain m-customer,name-last="A@"
>list standard
>xeq
Notes
The Chain command is intended to replace a Get and If combination where the
primary selection is by key value. In many cases, it is still faster to use the Get
command to read the entire dataset than it is to use the Chain command to use
search-paths or third-party indexes. Use Set Stat On to compare the performance of
the Chain and Get commands.
The dataset search field cannot be a R-type item.
The Chain command always reads the chain values in sorted order by ascending
search-value. You do not need to specify a Sort command to have the output file
sorted by the search field.
You can also specify a range of characters with the following syntax:
>base mydb,1,;
>get customer
>clean special,"^128:^255"
>update
>ext address(1) = $clean(address(1))
>ext address(2) = $clean(address(2))
>xeq
The above task would clean all byte type fields of any characters from Decimal 0
(Null) to Decimal 31 plus Decimal 128 to Decimal 255.
Suprtool will pad the field that was cleaned with the appropriate amount of
characters with a space at the end of the field.
Absolute Definitions
DEFINE field, byteposition,sublen [,type] [,subcount]
(Default: type=BYTE, subcount=1)
The byteposition is a positive integer giving the byte index where the field starts. The
first byte is always number 1, not 0. The sublen is the number of bytes in the field.
When the subcount is 1 (default), the sublen is the total number of bytes in the field.
When you specify a subcount, the sublen is the byte-length of each subfield.
See Data-Types below for the definition of type.
>input discfile {input from a disc file}
>def qty,14,4,double {double integer (PIC S9(9) COMP)}
>def name,5,6 {character string of 6 bytes}
>sort name {sort using the field "name"}
>total qty {total all the values of the field "qty"}
>exit
Relative Definitions
DEFINE field, fieldname [ (subscript) ] [ [offset] ] [,sublen] [,type]
[,subcount]
(Default: sublen/type=same as fieldname)
The fieldname is an IMAGE field from the dataset specified in Chain, Get, or
Input=dataset, or a field from a self-describing file, or another Defined field.
Relative definitions are similar to COBOL's Redefine verb.
The sublen and type are optional. They default to the total byte length and type of the
fieldname. The (subscript) parameter is an optional sub-item index for arrays such as
IMAGE compound items like 5J2 or 4X20. The first sub-item is number 1, and if no
subscript is provided, Suprtool uses the first sub-item. The [offset] parameter is
optional and specifies a byte offset from the position that would otherwise be used.
This allows you to define fields relative to other fields. The [offset] starts at 1 and
not at 0 (i.e., FIELD[1] is the first byte of the field).
To define a field that corresponds to the second street-address of m-customer, you
would use:
Data-Types
Here are the valid types:
Type Description
BYTE printable ASCII characters
INT/INTEGER two's complement
DOUBLE two's complement
REAL Classic floating-point
LONG Classic floating-point
IEEE IEEE floating-point
PACKED packed-decimal
PACKED* packed-decimal, last nibble unused
DISPLAY zoned-decimal numeric field
LOGICAL unsigned integer
CHARACTER for Native Language Support
For compatibility with Sort.Pub.Sys, the Define command also accepts Fpoint as the
data-type for IEEE numbers.
The following table shows the Suprtool definitions for the IMAGE data-types:
Packed-Decimal Fields
When defining packed-decimal fields, you must convert the number of decimal
digits into a byte count. The last digit of a decimal field is always used for the sign.
There are two data-types for decimal fields: PACKED for those that end on a byte
boundary and PACKED* for those that end in the middle of a byte. Here are some
example definitions of packed-decimal fields:
Data-Type Warning
The Define command accepts field definitions of any combination of byte-length and
data-type. However, many combinations have limited usefulness in Suprtool. In
these cases, Suprtool prints a warning. For example:
>def field,1,1,integer
Warning: Length of 1 is of limited use for the data-type INTEGER
Examples
The following examples show the various data-types and combinations that are
available with the Define command:
>define a,11,4,double {J2 or I2, S9(9) COMP}
>define b,21,2,int {J1 or I1, S9(4) COMP}
>define c,3,4,real {R2, Classic floating-point}
>define d,5,8,long {R4, Classic floating-point}
>define e,21,8 {character string}
>define f,address(5) {fifth occurrence of address}
>define g,address(5)[3],4 {relative offset}
>define h,address(5)[4],2,byte {middle of the address}
>define i,x[6],4 {starts at sixth byte of X}
>define j,invoice,6,byte {redefine field as Byte}
Absolute Example
The following example shows the most basic use of the Define command to create a
new field definition at an absolute location in the input record.
Relative Examples
Use the simplest form of relative definitions to rename existing fields.
>def quantity,qty {"quantity" is a more readable name}
>if quantity = "100 " {selection on the new field}
The Define command copies the byteposition, sublength, and type to the new field,
but it does not copy the subcount. Define assumes that you want the first subfield:
>def amount,amt {amt is 12J2}
>if amount > 1000 {amount is 1J2 and is the same as amt(1)}
Note that redefining the digits of a larger numeric field only works when the field is
a character field (type X, U, or A).
Notes
The purpose of the Define command is to tell Suprtool to look at a portion of the
input record in a certain way. For example, if the record contains ASCII digits in the
first ten bytes, Define could be used to assign a field definition to the first six bytes.
In this case, the field must be defined as data-type Byte, Char or Display.
The Extract command may be The Define command cannot be used to convert data from one format to another.
used for data conversion. See Using the same example, the Define command could not be used to treat the first six
the Data Conversion section digits of the ten digit ASCII field as Integer, Packed, Real, or any other numeric data
of the Extract command for format. If the input record contains ASCII digits, Define cannot change them to
details. another data-type.
It may be helpful to think of the Suprtool Define command as similar to a COBOL
REDEFINES clause, or a FORTRAN EQUIVALENCE statement.
Examples
>:comment Delete and sort old transactions, write to file.
>base store,1,writer {open for write access}
>get d-sales {dataset to delete from}
>if purch-date<980101 {select which records to delete}
>delete {ask for deletion}
>sort cust-account {sort by account and sort}
>sort purch-date { by date}
>output oldsales {output file with deleted and sorted records}
>exit
Losing Records
Delete can be combined with other operations, such as select, sort, write to output
file, and even a Put to another dataset. Care must be used when combining
operations, because such combinations cannot be restarted if the Suprtool "run" is
aborted for any reason (including hitting Control-Y and answering "yes"). See
"Suprtool and IMAGE" on page 57 for more details on using the Delete and Put
commands in combination.
Suprtool deletes records during the input phase. This means that records are deleted
before they are sorted. All of the selected input records are deleted before the first
output record is written when sorting the input. If you press Control-Y and answer
"yes" before a delete task has completed, there may be no way to recover your
deleted records.
Warning Message
When deleting records from the input dataset, Suprtool asks for permission to delete
all records if there is no If command to select the records to be deleted:
Delete all records from the D-SALES dataset [no]:
Notes
For IMAGE manual master datasets, a DBDELETE call fails if the entry to be
deleted is a "chain-head" with related detail entries still linked to it. When this
happens, Suprtool, by default, prints an error and stops processing the input data. If
Set Dumponerror On, the record is printed on $stdlist. If Set Ignore On has been
entered, Suprtool continues processing and prints a count of "chain-heads" at the end.
Records that cannot be deleted are not included in the output file.
Examples
>listredo {see the previous 20 commands}
>do {do previous command again}
>do 39 {do command line 39 again}
>do 5/8 {do command lines 5 to 8 again}
>do list {do most recent List command}
>do show {do last starting with "show"}
>do showjob job {do last "showjob job" command}
>do @job {do last containing "job"}
>do -2 {do command before previous one}
>do -7/-5 {do by relative line number}
>do 5/ {do command lines 5 to "last"}
Notes
The Do command can be abbreviated to ,., as in MPEX . You cannot use ";" to
combine commands on the same line.
None
The None option removes duplicate records from the output file. Suprtool compares
each output record with the previous output record. If they are not the same, the
record is added to the output file. This option corresponds to the former Nodup and
Nodupkey options of the Output command.
>key 1,4
>duplicate none keys
Input Output
1111 10 1111 10
2222 25 2222 25
2222 35 3333 48
3333 48
Only
The Only option is the exact opposite of None. Only selects all output records that
would not be written by the None option. When the Only option finds a record that
duplicates a record already in the set, it writes that duplicate to the output file. Note
that the first record is not written to the output file. Here are two examples:
>key 1,4
>duplicate only keys
Record
Suprtool has two methods for comparing output records: Record and Keys. The
Record option compares the entire output record. This option can be specified
without a sort, but in that case the input file must already be sorted. Note that there
are two data fields in the records in the following example, so that a comparison of
the entire record yields no duplicates.
1111 10 1111 10
2222 25 2222 25
2222 35 2222 35
3333 48 3333 48
Keys
The Keys option compares only the sort keys to determine whether an output record
is a duplicate. This option requires that at least one sort key be specified.
>sort agent {sort by agent}
>duplicate none keys
>output agents {create roster of agents}
The Keys Num option determines the level at which Suprtool compares sort keys.
This option controls which duplicate records get included in (or excluded from) the
output file.
In the following example we sort by agent and by bill-date (in descending order), but
only check for duplicates at the agent level.
>sort agent {sort by agent}
>sort bill-date,desc {sort by date}
>duplicate none keys 1 {only check for duplicate agents}
>output agents {create roster of agents}
Count
The Count option causes Suprtool to produce a new field in the output record with
the number of occurrences of each key value. The count field is called st-count, and
is an I2-type field. The Count option can only be used with Duplicate None Keys.
>key 1,4
>duplicate none keys count
Input Output
1111 10 1111 10 1
2222 25 2222 25 2 {two records for key value 2222}
2222 35 3333 48 1
3333 48
Total
The Total option allows up to 15 fields to be subtotaled for each duplicate key.
Separate the fields with spaces, not commas. The Total option can only be used with
Duplicate None Keys. A new field is created at the end of the output record for each
total. Each field is called st-total-n:
>sort customer-no
>extract customer-no
>duplicate none keys total sales-qty sales-amt
The above commands will create a self-describing file with the field customer-no
and the total by each customer of the sales-qty in the field st-total-1. Similarly the
field st-total-2 will contain the total sales-amt by customer number.
The following data-types are chosen for each total based on the data-type of the
field:
Please see the P28 Fields section on how to define these fields in Cobol and
PowerHouse programs.
Note that for byte fields, there can be only digits in the field. If there are other
characters such as "+", "-", or ".", then Suprtool reports an error.
You can use the Link output option to easily see the fields that Suprtool creates. For
repeated fields (e.g., 6I2), the first subfield is subtotaled if you don't provide a
subscript. You can combine the Count and Total options, but the Count option must
appear before the Total option. You cannot combine the Total command with the
Total option of the Duplicate command.
>key 1,4
>def field,5,2,integer
>duplicate none keys total field
Input Output
1111 10 1111 1 10
2222 25 2222 2 60 {25 + 35 = 60}
2222 35 3333 4 48
3333 48
Self-Describing Files
When you are using the Count or Total options, the sort information is not retained
in the output file. This means that if your output file is in LINK format, there are no
sort keys. If you are going to use this file from Suprlink, use the BY-clause of the
LINK command to manually specify the sort keys.
Non-Self-Describing Files
If the input file is not a self-describing file and you are using Count or Total, you
also need to extract all the fields from the file. You can quickly extract the fields by
defining a new field that contains the entire record. For example, if your records are
56 bytes long, then you do the following to extract all the fields:
Output Restrictions
When you are using the Count and Total options, the only Output formats that you
can use are Data, Data-Num, Query, and Link. If you want to quickly see the Count
or Total results without using a second pass, use the List Standard command.
>get dataset
>sort key-field
>duplicate none keys count total data-field
>output result,link
>list standard
>xeq
Notes
The option of Only or None must be specified before the option of Record or Keys.
Reversing the order causes a syntax error in the Duplicate command.
You cannot combine the Total command with the Total option of the Duplicate
command.
It is important to note that if the field being sorted is the result of a $function, then
you may not be sorting on the value of the field after the function has transformed
the field. For example the following task may not give you the result you expect:
>base store,5
>get d-sales
>def cust-accountx,1,6,byte
>ext cust-accountx = $edit(cust-accout,"zzzz99"
>sort cust-accountx {sorting on transformed field before it has value from function}
>dup none keys
>output dsales
>exit
In this instance you will not be sorting on cust-accountx as transformed by the $edit
function, but rather the first six bytes of d-sales. Therefore it is important to note
when you are using extract to transform a field, you will not be sorting on that
transformed value.
Therefore the way to do the transformation would be to either divide into two tasks
or if you can logically sort on the field before the transformation in order to achieve
the result, so the task could be:
Examples
>:comment Edit the STORE database.
>base store,1,writer {open for write access}
>edit {switch to Dbedit}
#list d-inventory {Dbedit prompts with "#"}
#exit {returns control to Suprtool}
> {Suprtool prompts again}
Notes
An entire user manual has been provided to describe how to use the Edit feature of
Suprtool. See the Dbedit section in the manual for all the details.
Examples
You began to specify a sort, stopped for coffee, and decided to cancel the task on
your return:
>base store
>get m-customer
>sort name-last; sort name-first
... coffee break ...
>exit abort {cancel the sort and terminate}
End Of Program
Examples
:run suprtool.pub.robelle
>exit {no input was specified}
No action taken.
End Of Program
:run suprtool.pub.robelle
>input rep23.newprog
>out rep23.program
>xeq {copy one file}
>input rep24.newprog
>out rep24.program
>exit {copy and stop}
Notes
You can use the Suprtool2 interface and the Export command to "call" STExport.
See the Suprcall User Manual for a complete example of how to use the interface to
pass commands to STExport.
Field Parameter
Each extracted field must be an IMAGE field name, an Allbase column, a field in an
SD file, or a Defined field. If the field requires an Item definition, then the Item
command must precede the Extract command. Extract specifies a rearrangement of
the Input data fields to produce the Output data record; there is no data conversion,
unless "output xxx, ascii" is specified.
The subscript parameter is valid only for compound items. The total item is extracted
if it is compound and no subscript is specified.
>extract account {extract the key value and}
>extract rating { one other field}
>output out1 {output file has two fields}
Cumulative Extracts
The Extract command is cumulative. If two Extracts are specified in one run, all
fields of the two Extract commands are used.
>extract status,balance,account,purchased
is equivalent to
>extract status,balance
>extract account,purchased
Constants
Extracting Constants
The value part of the Extract command is used to place a constant in each record of
the output file. In this case, the field defines the type and length that the value
occupies. The value portion must match the type of the field. String values will be
extended with blanks to fill the entire field. If the input data does not have a field of
the correct size and type, you can create one using the Define command.
>ext account {key value}
>ext rating=0 {place the value "0" in the "rating" field}
>output out2
The total number of bytes that you can extract for all constants is 5,100 bytes for
MPE/iX and HP-UX, and 1,275 bytes for MPE/V.
Decimal Places
If a field has implied decimal places, Suprtool scales the input values according to
the number of decimal places. For example,
>item tax ,decimal,2 {two implied decimal pts.}
>item total,decimal,2 {same}
>extract tax = 1.02 {specified decimal pts.}
>extract total = 100 {value stored as 10000}
>output out3
Blank Fill
If you want to create an output record that consists of fifty blanks followed by the
customer name, use:
>define filler,1,50
>ext filler=" "
>ext name
String Constants
You can specify a string constant without referring to a field. For example, to leave a
space between fields, you must do the following:
>extract account," ",rating
>output *,ascii
Suprtool uses the length of the string to determine the size of the field. The following
example extracts the same fields as the previous example, but each output record
identifies the field:
>extract "Customer Account=",account," "
>extract "Credit Rating=",rating
>output *,ascii
The spaces after "Credit Rating=", before the rating value, is due to the numeric field
Rating being extracted with blanks for its leading zeros. This is the result of the Ascii
option of the Output command.
Repeated Fields
If the field is an IMAGE repeated field (e.g., 10J1), the Extract command places the
value in each of the repeated fields when you do not specify the subscript. If you
specify a subscript, only that one repeated field will have the new constant value.
In the next example, we assume that the Balance field is a repeated field (12J2). We
wish to make each of the 12 repeated fields in the output record equal to 100:
>extract name
>extract balance=100
If we only wanted to extract the sixth field of BALANCE and set it to 100 we would
do the following:
>extract name
>extract balance(6)=100
Character Constants
Use the ^-character to specify any ASCII character. The number (the actual ASCII
value), or letter (^A means control A), must follow immediately after the ^-character.
Suprtool treats character constants as strings. When you extract the constant to a
field longer than one byte, Suprtool pads it with spaces.
>define field,1,1 {byte field}
>ext field = ^0 {binary zero}
>ext field = ^G {Control-G (bell)}
>ext field = ^27 {escape}
>ext field = ^252 {Roman-8 box}
>ext field = ^186 {Euro currency symbol €}
You can also extract the constant directly without referring to a defined field. This
always produces a one-byte constant with no blank padding.
>ext ^0 {binary zero}
>ext ^13,^10 {Carriage Return, Line Feed}
>ext ^M,^J {CR, LF again}
>ext ^27,"&dB" {escape sequence}
Dates
Extracting Today's Date
To extract today's date, use the following:
>item field,date,ccyymmdd {identify date format of field}
>extract field=$today {today's date}
>extract field=$today(-1) {yesterday's date}
>extract field=$today(+1) {tomorrow's date}
Use the Item command to qualify the field as a date. Suprtool uses the date format to
determine the output format of the date. The $today function accepts one optional
argument which is the number of days before or after today. The maximum number
of days in either direction is 9999.
Oracle dates include both the date and the time. If you extract an Oracle date using
$today, the time is always 00:00 (i.e., midnight).
Oracle dates include both the date and the time. If you extract an Oracle date using
$date, the time is always 00:00 (i.e., midnight).
$Stddate
Similar to the If command, the Extract command is also capable of utilizing the
$stddate function. This will allow for conversion of any of the supported Suprtool
date formats to be converted to a date in the ccyymmdd date format in a double
integer container.
For example,
>get sales-detail
>def new-ship-date,1,4,double
>item ship-date,date,mmddyyyy
>ext order-no / sales-amount
>ext new-ship-date = $stddate(ship-date)
>out salesinfo,link
>xeq
Invalid Dates
Because the $stddate must have a valid date in order to properly convert the date to
the ccyymmdd format, a value of 0 will be returned for any invalid dates. An invalid
date is any number of a particular date format whose date equivalent cannot be found
on the calendar.
This means that if you attempt to extract use the $stddate function against a value
that is not a valid date then the extracted value will be 0.
$Days
As with the $stddate function, the $days function is also available to the Extract
command. You can convert any supported date to a Julian Day number in the
following manner:
>in ordfile
>def ship-days,1,4,double
>def order-days,1,4,double
>def delay,1,4,double
>ext order-no
>ext ship-days=$days(ship-date)
>ext order-days=$days(order-date)
>ext delay=$days(ship-date)-$days(order-date)
>out neword,link
>xeq
IN=15, OUT=15. CPU-Sec=1. Wall-Sec=1.
Invalid Dates
If an invalid date is encountered, the extracted value will be zero. Therefore in the
example above, if the order has not yet been shipped (ship-date does not contain a
valid date) the resulting delay value will be negative.
Sample output:
ORIGDATE YESTERDAY
19990101 19981231
19991231 19991230
19990301 19990228
Date Limits
The $date function in Suprtool can generate dates between the years 1583 and 2583.
Some date formats have limits based on their particular format, such as 2027 for a
Calendar date and 2259 for the aammdd aamm, mmddaa, ddmmaa dates.
Range of Fields
Extracting a Range of Fields
You can specify a range of fields to extract using the following:
Extract Field1 \ Field4
Extract $first \ $last
Extract $All {means $first \ $last}
This feature only works with IMAGE fields, input files "equated" to an IMAGE
dataset and for self-describing files. If you specify a range, Suprtool extracts all 4 of
the field names between field1 and field4 inclusive. When specifying a range of a
self-describing file that has been equated to an IMAGE dataset, the IMAGE dataset
definition takes precedence.
>get d-sales {input is from a dataset}
>ext product-no\sales-qty
>out dsales
>xeq
is equivalent to:
>get d-sales {input is from a dataset}
>ext sales-amt(4) {first subscripted field}
>ext sales-amt(5) {intermediate subfield}
>ext sales-amt(6) {last subscripted field}
>out dsales
>xeq
You can also use $first, $last or all in Extracting a range. The intention is to make
your scripts more easily maintained. If you had a script that you wanted to put a
sequence number at the beginning and then extract the rest of the dataset you could
specify the starting field and the ending field. For example:
base orddb
get customers
def seq-no,1,4,double
ext seq-no=$counter
ext order-no / pst-code
out newfile,link
xeq
If you added any fields to the beginning or end of the dataset and you used the
specific fieldnames you would have to re-write the script. However, you can use the
$all feature in extract range:
You can also write the script using $first / $last as your preference, but $first and
$last are also useful if you need to add data into the middle of the fields you extract:
base orddb
get customers
def seq-no,1,4,double
ext $first / zip
ext seq-no=$counter
ext tax-code / $last
out newfile,link
xeq
Numeric Expressions
You can specify arithmetic expressions for any numeric data-type in the Extract
command. Arithmetic expressions involve the operators +, -, *, / and mod. Extract
arithmetic expressions work exactly as If command arithmetic expressions. To
extract an expression, use this syntax,
EXTRACT target-field = expression
Target-Field
The target-field determines the byte-length, data-type, and repeat-count for the
expression. The expression is extracted during the output phase and cannot be used
by other Suprtool commands that accept fields (e.g., sort). To avoid confusion, it is
best to define a new field name for the target-field instead of using an existing field
name.
Examples
>extract budget99 = actual98 + 1000
>extract total = cost * qty
>extract day = ccyymmdd-date mod 100
In the following example, the field total is used twice. In the first case, it is used
to tell Suprtool how to format the arithmetic expression. In the second case, it is used
in the sort command. Warning: In this example, the output file is sorted by the value
of total as it appears in the input record. It is not be sorted by cost * qty.
>extract total = cost * qty
>sort total {sort by input total}
Restrictions
You can only use one expression in each Extract command, and the expression must
be the last item. If you want to extract several expressions or more fields after an
expression, you need to use several Extract commands.
Incorrect
Correct
>extract name, i=sales + commission
>extract c=cost + expense
>extract dept
Correct
>extract c = (6000 - cost)
Numeric Truncation
The accuracy of arithmetic computations is limited to approximately sixteen digits.
Suprtool may truncate four-word integers (quad), or large packed-decimal numbers,
or display numbers when they are converted to floating-point. Suprtool does not
produce any error or warning in this case.
Division by Zero
Suprtool reports an error in the input record number if an arithmetic computation
results in division by zero. Use Set Ignore On to force Suprtool to ignore division by
zero errors. With Set Ignore On, the result of division by zero is zero.
The speed of a task decreases when you ask Suprtool to ignore many division by
zero errors. It is better to check for zero in the If expression before using it in
division.
>if qty <> 0 {to avoid division by zero}
>extract average = total / qty
$Abs function
Suprtool supports an $abs function, which returns the absolute value of a number.
For example, if a field called Credit contains the value -547.83, the $abs function
returns 547.83.
This function will work on a field or even on an expression such as:
>def newcredit,1,4,double
>ext newcredit = $abs(credit / 100 * 1.07)
$Truncate function
Suprtool supports a $truncate function which returns the number to the left of a
decimal place. For example if the field stddev contains the value 547.83, the
$truncate function will return 547. Note that there is no rounding.
$SubTotal Function
Suprtool has the ability to keep a running subtotal for any numeric field based on a
given sort key. The target data must be a packed field with 28 digits, in order to
avoid overflow issues.
A sample use of the $subtotal function could be:
>def mytotal,1,14,packed
>get orders
>sort order-number
>ext order-number
>ext part-number
>ext description
>ext sales-amount
>ext mytotal = $subtotal(sales-amount,order-number)
>out sales,link
>xeq
This would result in a file containing a running subtotal in the field mytotal for a
given order-number. You could then generate a simple report with the simple
Suprtool commands:
>in sales
>list standard
>xeq
The basic syntax for the $subtotal function in the extract command is:
extract targetfield = $subtotal(field,sort-field)
You must specify the sort command before referencing the sort-field in the $subtotal
function. You can subtotal up to ten fields per pass and the $subtotal function is also
available in the if command, however, by nature it is of limited use.
$Total Function
Suprtool has the ability to keep a running total for any numeric field. The target data
must be a packed field with 28 digits, in order to help avoid overflow issues. A
sample use of the total function could be:
>def mytotal,1,14,packed
>get orders
>ext mytotal = $total(sales-amount)
>xeq
You can total up to ten fields per pass and the $total function is also available in the
if command, however, is of limited use.
$Counter Function
For years Suprtool has had the ability to output a record number to an output file
with the num option of the output command:
The above could would generate an output file called myfile, however, you would
lose the SD information and you can only put the number at the beginning or the end
of the data. Suprtool now has a counter function that allows you to place a $counter
at any spot as well as preserve the SD information.
>in mysdfile
>def mycount,1,4,double
>ext field1
>ext field2
>ext mycount=$counter
>out myfile,link
>xeq
The file myfile will be self-describing and contain the fields field1, field2 and
mycount. The field mycount is defined as a double integer, since this is the only field
type that the $counter function can use. Each record will have a unique ascending
number starting with one.
String Expressions
You can combine byte-type fields together and use the built-in string functions to
create new fields out of existing ones. This can reduce the number of tasks required
to provide a solution. String expressions may involve the + operator and $upper,
$lower, $trim, $ltrim or $rtrim. To extract a string expression, use this syntax:
EXTRACT target-field = expression
Target-Field
The target-field determines the byte-length for the expression. The data-type must be
Byte or Char. The expression is extracted during the output phase and cannot be used
by other Suprtool commands that accept fields (e.g., Sort).
Examples
>extract id-no = warehouse-no + bin-no
>extract full-name = first-name + last-name
Correct
>extract name = (" " + product-desc)
String Truncation
Suprtool produces an error if the string expression is longer than the target field. You
cannot override this error with Set Ignore On. To help avoid the error, you may want
to trim the expression of trailing spaces before assigning it to the target field. For
example,
>extract new-field = $trim(a + b + c)
The $split function can extract each token into separate fields. The syntax for the
$split function is:
$split(Field,Start Character,Occurrence,End Character,Occurrence)
The following task will $split the data in the wholename into three separate fields.
The below task assumes that the file namefile is self-describing and has the field
wholename in it:
>in namefile
>define lastname,1,30
>define firstname,1,20
>define middlename,1,20
>extract lastname = $split(wholename,first,"/")
>extract firstname=$trim($split(wholename,"/","/"))
>extract middlename=$trim($split(wholename,"/",2," ",2))
>out names,link
>xeq
The first extract statement tells Suprtool extract the bytes from the field wholename,
starting at the beginning (first keyword), and stopping at the "/" character. The
second extract statement, tells Suprtool to extract the bytes between the first
occurrence of the "/" character to the next occurrence of the "/" character, and then
that string is trimmed of spaces as it is nested within the $trim function.
The third and final extract statement tells Suprtool to extract the bytes beginning
with the second occurrence of the "/" character to the second occurrence of the space
character.
If the target field is not long enough to hold the data Suprtool will abort with an
error. You can easily prevent this from happening on blank fields by nesting the
$split statement within a $trim or $rtrim function.
First/Last
The $split function also has a Last keyword, whereby you can split the field from a
given occurrence of a character to the end of the field. So in the given example from
above the extracting out of the middlename could be coded as such:
>extract middlename=$trim($split(wholename,"/",2,last))
The above means to extract out all the data from the second occurrence of the "/", to
the end of the field and trim all spaces. Naturally as noted above we also have the
First keyword, which indicates the start of the field.
Unprintables
You can specify an unprintable character for Suprtool to use as the character to $split
on, using the following syntax:
>extract middlename=$split(wholename,^9,2,last)
which means that the split would start at the second occurrence of Decimal Nine, or
the Tab character. Please note that for specifying unprintable characters you do not
put in quotes.
You can also specify a range or characters by using the following syntax:
Clean "^0:^31","^240:^255"
The Clean command is used to tell Suprtool what characters it needs to look for in a
given byte type field. For example:
clean "^9","^10","."
will tell Suprtool to replace the tab character (Decimal 9), Line Feed (Decimal 10),
and a period to whatever the Clean character is set to. The CLean command takes
both, decimal notation and the character itself, however, it is probably most
convenient to use the Decimal notation for the characters that you wish to clean. The
Decimal notation is indicated by the "^" character.
This will set the character to replace any of the qualifying "to be cleaned" characters
to be a period.
Cleaning a Field
You call the clean function, the same way you normally use other functions available
to if and extract. For example:
ext address1=$clean(address1)
shows how to clean the field address1. You do not necessarily need to have the target
field be the same as the source field.
The above task will look at the three instances of address and replace the tab,
linefeed, null and bell characters with a space.
If you want to just remove the characters all you need to do is set the CleanChar in
the following manner:
>Set CleanChar “<null>”
This means that the $clean function will remove the characters specified in the clean
command, but not replace with any character, which effectively shifts the text to the
left and pad the equivalent amount of spaces at the end.
The Table name, key-field and data-field are all defined by the Table command,
which must be input before the Extract command. A classic example: your boss
comes to you with a list of new prices for certain parts and asks you to update the
Part-Master dataset.
Just load the new prices into a Table, index by the product number (prodno), then
Extract the price field from each record and replace it with a $lookup on the table.
Here is the code:
>table newprices,prodno,file,bosslist,data(price)
>get part-master
>if $lookup(newprices,prodno)
>update
>extract price = $lookup(newprices,prodno,price)
>xeq
We do the If $lookup to select only the parts which have new prices, then do Extract
with $lookup to replace the existing price with a new one. The Update command
forces a database update on each selected record and must come before the Extract
command.
Now let's see how a Table can be used to add additional useful information to a
record. Let's say we build this table of Canadian provinces (The file prov-file is
At this point the key into the Table is the prov-code item and for each entry in the
Table there is one associated prov-name. To append prov-name to each output
record, we read the customer dataset, extracting the customer name. We also Define
prov-name as a new field and extract it for the output record, but we fill it with a
value that is based on the prov-code for each customer entry:
>get customers
>ext cust-name
>def full-prov-name,1,30
>ext full-prov-name=$lookup(provtab,cust-prov-code,prov-name)
>out somefile
>xeq
To update a dataset, you do the same commands, but you insert an Update command
prior to the Extract from a Table. Below is an example that shows how to update an
IMAGE record using data values from a Table.
Let's assume that we have new unit cost information for each product:
>form newcosts
File: NEWCOSTS.NEIL.GREEN (SD Version B.00.00)
Entry: Offset
PRODNO Z8 1
UNIT-COST P8 9
Limit: 13 EOF: 13 Entry Length: 12 Blocking: 64
We load a table with the product number key value (prod-no)and the new unit cost
data value (unit-cost):
>table prodcost-table,prodno,file,newcosts,data(unit-cost)
We can then select that unit-cost field from the prodcost-table using the Extract
command:
>extract unit-cost = $lookup(prodcost-table,prodno,unit-cost)
Here is the entire task, keeping in mind that Update must be specified before the
Extract command.
>base store.suprtpis
Database password [;]?
>get d-inventory
>table prodtable,prodno,file,newcosts,data(unit-cost)
>update
>if $lookup(prodtable,prodno)
>extract unit-cost = $lookup(prodtable,prodno,unit-cost)
>xeq
If you did not specify the If $lookup, then records that did not qualify under the
$lookup function in the extract field, will result in zeroes for any numeric field and
spaces for any byte type fields.
Data Conversion
You can convert numeric fields from one data-type to another. Any nonbyte field
type is considered to be numeric. You can also lengthen or truncate character fields.
The general syntax for doing conversions is:
EXTRACT target-field = source-field
Byte Fields
Use the Extract command to shorten or lengthen byte-type fields. This feature is
most useful when updating one field in an IMAGE/SQL dataset with another field.
>get d-sales
>define part-warehouse-no,part-no[5],4
>extract warehouse-no = part-warehouse-no
>update
>xeq
If the target-field is longer than the source-field, Suprtool fills the trailing space in
the target-field with spaces.
This field can then be converted to any of the other numeric types that Suprtool
supports.
If the field is six characters and contains blanks, decimal, currency or a sign symbol
in the data then you can utilize the $number function.
can now be accepted and converted to any other numeric data type. Consider the
following data:
Item-number New-Price
12345 +123.45
34563 + 27.5
21312 + 1.545
Suprtool can now read and convert the data in New-Price using the number function.
Let's say we want New-Price to be a double integer and currently occupies eight
bytes starting in position six. Here is the task you would use to convert the New-
Price free-format number into a double integer.
>in mynums
>def item-number,1,5,byte
>def new-price-ascii,6,8,display
>def new-price,1,4,double
>item new-price-ascii,dec,2
>item new-price,dec,2
>ext item-number
>ext new-price=$number(new-price-ascii)
>out somefile,link
>xeq
The $number function take the free-format number and make it a valid display
number. It will determine the decimal, sign and add leading zeroes. It will round the
number to the defined number of decimal places.
In the case of 1.545 number, Suprtool will round the value to be 1.55, since the given
number of decimal places is two and the following value is five or greater. If you
have a whole number such as 54, with no decimal point the value becomes 54.00.
Suprtool will not accept data that has:
More than one sign.
More than one decimal place.
Spaces in between numbers.
Signs that are in between numbers.
Characters that are not over punch characters.
Fields that when edited do not fit in the defined space for the
display field.
You can control the character that defines the currency, thousand and decimal
symbol for other currencies and formats using the following commands:
>set decimalsymbol "."
>set thousandsymbol ","
>set currencysymbol "$"
Suprtool in the above case will strip the currency and thousand symbols and use the
decimal symbol to determine the number of decimal places. You can set these
characters to any values you want but the defaults for each are used in the above set
commands. The decimal and thousand symbols are only single characters. The
currency symbol allows for four characters.
You can also use the $Edit function to format and directly convert to byte format.
$Edit Function
Suprtool can format fields using edit-mask features similar to edit-mask features of
Cobol. Suprtool employs two distinct types of edit-masks: one for byte type fields
and the other for numeric fields.
The type of mask utilized depends on the source type of the field. If the source field
is numeric, then the numeric edit-mask logic is applied, if the source field is byte
type, then the byte edit-mask logic and characters apply.
Byte-Type Formatting
For Byte type fields there are two placeholder characters. These are:
X ~ place the data in the matching column for the X in the edit-mask
Z ~ place the data in the matching column unless the data is a zero; if the data is a
zero, then replace with a space
The format characters are as follows:
B (space) / (slash) , (comma) . (period) + (plus) - (minus) * (asterisk)
and a space. Please note that you can denote a space using two methods, either by
putting a "B" in the mask or a space itself. For example, suppose you have data that
is in ccyymmdd format in an X8 field. Here is how you would use a "xxxx/xx/xx"
mask to format the data:
As you see in the example above, the placeholder character is the "x" and the "/" is
the format character. You insert a space either by specifying a "B" or by putting an
actual space character in the edit-mask. An example of inserting a space might be the
formatting of Canadian postal codes (e.g., V3R 7K1):
>in postal
>form
File: POSTAL.NEIL.GREEN
Entry: Offset
POSTAL-CODE X6 1
Limit: 10000 EOF: 2 Entry Length: 6
>def post1,1,7,byte
>def post2,1,7,byte
>ext post1=$edit(postal-code,"xxx xxx")
>ext post2=$edit(postal-code,"xxxbxxx")
>list
>xeq
The above edit mask would then edit a byte type date of 20031005, to be:
2003/10/ 5
will force Suprtool to stop if there is data left over after applying the edit-mask. With
byte-type fields, leading spaces do not cause overflow. Therefore if your data
consists of:
" L2H1L2"
It is not an overflow since there are only spaces to the left of the "L". If the data was:
" JL2H1L2"
Signs
As shown in the example above, there are also numerous format characters for
numeric edits, including four ways to specify the sign. You can specify a sign, with
+, -, or the typical accounting specification of "CR" and "DB". You will note in the
example above that the "cr" in the mask was up-shifted to be "CR". This is because
the entire mask is up-shifted as the mask is being parsed.
You can specify more than one sign in a numeric field edit, although Suprtool will
give you a warning that having two sign edit-mask characters does not really make
sense. Cobol gives a Questionable warning when compiling an edit-mask with two
sign characters. Suprtool, will apply the sign in both places.
Decimal Places
For numeric-type edits, Suprtool attempts to adjust the data according to the number
of decimal places in the edit-mask, when compared to the number of decimal places
defined in the field.
For example if the data field has one decimal place, and the edit mask has two
decimal places, then the data is adjusted:
Similarly, if the data has three decimal places and the edit-mask only has two, then
the data will be rounded appropriately with the same rules as outlined in the $number
function.
You can specify more than one decimal place in an edit-mask. However, Suprtool
will print a warning and it will utilize the right-most decimal place for data
alignment. The decimal place character is defined by a set command:
>set decimalsymbol "."
If you define another character as the decimal symbol, Suprtool will use that
character as the point to align the decimals. If you define a decimal symbol that is
not an allowed edit-mask character with Set Decimalsymbol, Suprtool will assume
that the field has zero decimal places and adjust the data accordingly.
Suprtool will not however, put the dollar sign to the right of the decimal place. If you
had the same edit mask and the data was, .09, the data would end up being formatted
as:
$.09
Similarily, the $edit function will attempt to place the dollar sign correctly in most
cases. For example Suprtool will not format data in the form of:
Suprtool, does attempt to fixup these cases and would format the data in the
following manner:
$123.50
Set CurrencySymbol
If Set CurrencySymbol is not equal to "$", then after the formatting has been applied,
whatever symbol(s) are defined within the set command, are used to replace the "$"
symbol in the data. For example, if you have the Currency symbol set as "CDN".
>set currencysymbol "CDN"
Suprtool will replace the "$" after the edit-mask has been applied with CDN,
provided there is room to the left of the dollar-sign.It is recommended that if you are
using multiple characters for the dollar symbol that you leave enough characters to
the left of the symbol.
For example if the CurrencySymbol is defined as CDN, then you should leave two
spaces to the left of a fixed dollar sign definition. If there is not enough room, to put
in the currency symbol, then the dollar symbol is blank.
will force Suprtool to stop if there is data left over to place when applying the edit-
mask. With numeric-type fields, leading zeroes do not cause overflow.
Restrictions
You can only use one expression in each Extract command, and the expression must
be the last item. If you want to extract several expressions or more fields after an
expression, you need to use several Extract commands.
Incorrect
>extract name, i=sales + tips, c=cost, dept
Correct
Extracting Bits
The Extract command can be used to define individual bits from one data item as
separate fields.
>def order-shipped,1,2,int
>def order-paid ,1,2,int
>ext order-shipped=status-field.(0:1)
>ext order-paid=status-field.(1:1)
This makes it easier to check the status of certain bits within a given field.
EBCDIC Conversions
Use the $etoa or $atoe functions to convert specific fields from EBCDIC to ASCII or
vice versa. Each of these functions accepts a single parameter that is a byte-type
field:
Extract $ETOA(char-field)
Extract $ATOE(char-field)
There are several restrictions on the $etoa and $atoe functions:
• They do not work with either the ASCII or PRN output options.
• You cannot extract an EBCDIC constant. The following example
would produce an error message:
>extract $etoa(char-field) = 'abcdef'
• You cannot extract a range of fields using $etoa or $atoe.
Notes
The Extract command is valid only with
• Output xxx,data
• Output xxx,data,num
• Output xxx,query
• Output xxx,link
• Output xxx,ascii
• Output xxx,prn
The Extract occurs logically after the sort phase, if any, but prior to the final Output,
Put, or List. An If command can refer to fields of the input record that are not
included in the extracted output record. The sort keys can be fields that are not
among those extracted.
If the extracted record length is shorter than the input record length, Suprtool
attempts to speed up sorts by doing the extract before sorting. Suprtool can only do
the extract before sorting if the output option is DATA (the default), QUERY, or
LINK, and all of the sort keys are included in the Extracted fields.
One advantage of not using the Extract command is that the output file from
Suprtool has exactly the same format as the input dataset which created the file. You
can then use the =setname option of the Input command to define all of the fields in
Example
>base store,5
>item last-ship-date, date , yymmdd
>item unit-cost , decimal, 2
>form d-inventory
Database Name
For IMAGE databases, Suprtool attempts to show the fully qualified database name.
It cannot do this with a remote database, or if the database was opened in mode-3, or
if Set Privmode was Off when the Base command was specified. If the database has
MPE/iX third-party indexing, the third-party product name and version number are
also shown.
>ba store
>fo
Suprtool shows the type of each dataset (e.g., "M" for Manual master, "A" for
Automatic master, "D" for Detail). If you have enabled dynamic dataset expansion,
Suprtool adds "DX" to the type of the dataset (e.g., "MDX", "DDX").
The current capacity (e.g., 330) is shown first followed by the blocking factor in
parentheses (e.g., 22). If dynamic dataset expansion (a feature of MPE/iX 5.0) has
been enabled, the initial capacity (e.g., 330), the increment (e.g., 66), and the
maximum capacity (e.g., 550) are shown next. On MPE/iX 5.0 or later, the highwater
mark is shown. The record length in bytes appears last.
Master Datasets
The Form Sets command indicates which datasets have MDX enabled. A Form
command on these datasets shows details of their expansion setting.
>form sets
Database: STORE.MDX.DATA
>form m-customer
Database: STORE.MDX.DATA
As you can see, the master dataset summary information for the Capacity shows the
Current Capacity (469), the Blocking Factor (7), the Initial Capacity (217), the
Increment (252) and finally the Maximum Capacity (2009). The Increment is the
number of entries by which the master dataset increases from the current capacity.
Self-Describing Files
The Link output option produces an SD file with information about how the file was
sorted, what fields are compound, and the date format or the number of implied
decimal places for any fields. The Form command shows all of this information:
>form custfile
File: custfile (SD Version B.00.00)
Entry: Offset
CHAR-FIELD X5 1 <<Sort #1 >>
REPEATED-I1 3I1 6 {compound field}
DATE-FIELD J2 12 <<YYYYMMDD>>
COST-FIELD J2 16 << .2 >>
Limit: 10000 EOF: 15 Entry Length: 20 Blocking: 64
Third-Party Indexing
If the database is enabled for MPE/iX third-party indexing, the Form command
shows any third-party index that corresponds to an IMAGE field. When doing a
Form dataset, each field is checked to see if it is a byte-type or Z-type third-party
index. If it is, the comment "<<TPI>>" is shown. Indexes that have a name other
than an Image-item name are shown at the end of the form listing. The Form
command only shows those indexes that can be referenced by the Chain command.
For example,
>form m-customer
M-CUSTOMER Master Set# 1
Entry: Offset
CITY X12 1 <<TPI>>
CREDIT-RATING J2 13
CUST-ACCOUNT Z8 17 <<Search Field>>
<<TPI>>
CUST-STATUS X2 25
NAME-FIRST X10 27 <<TPI>>
NAME-LAST X16 37 <<TPI>>
STATE-CODE X2 53 <<TPI>>
STREET-ADDRESS 2X25 55 <<TPI>>
POSTAL-CODE X6 105
Capacity: 211 (7) Entries: 20 Bytes: 110
The length shown for keys in the Additional Third-Party Indexes may vary between
versions of Superdex. This is a known situation and does not affect the operation of
Suprtool on these paths.
The length of a key is returned by dbinfo-833 and Suprtool will report in the form
command the length of a stand-alone key. (SI-PRODUCT-NO is the path that is now
supported) Superdex has a variable that impacts the length that is returned for a
given key, and that is SICOGNOS. Suprtool will account for the length difference on
the chain command but will show the unadjusted length. Normally Superdexs
dbinfo-833 would show a length of 12 for a Zoned-decimal tpi-key with a length of
8, if SICOGNOS is set to 1, then Superdex will return 8.
>form m-artist
Database: CD.DB.DATA
BtreeMode1 = ON Wildcard character : @
>form d-songs
Database: CD.DB.DATA
BtreeMode1 = ON Wildcard character : @
Formout File
The Form command writes all output to the file Formout. This file defaults to
$stdlist. You can redirect this file to a line printer or a disc drive. If you redirect the
Formout file to a disc file, Suprtool assumes a temporary file by default.
>:file formout;dev=lp
>form sets {writes to line printer}
>:file formout;dev=disc
>form d-inventory {writes to temporary disc file}
Default Form
If a Chain, Get, or Input command of a self-describing file has been entered, a Form
command without parameters shows the fields in the current input source. If a Base
command has been specified, but no input source, a Form command without
parameters does a Form Sets.
Dataset Input
The first example shows the most common use of the Get command. An input
dataset is specified as input to Suprtool. We select a subset of the entire input dataset
using the If command:
>base store,5,READER {open for read access only}
>get d-inventory {serially read dataset}
>if unit-cost<10000 {the UNIT-COST field is}
>output out1 { automatically defined by Get}
>xeq
This example gets any records that are in the first twenty IMAGE locations. This
may be fewer than twenty records, if there were deleted or unused entries in the first
twenty record numbers.
Random Selection
The #count parameter selects every "nth" record from the dataset, where "n" is equal
to count. This option is designed to allow "random" selection from the dataset. It
cannot be combined with the (startrecord/endrecord) option.
Test databases can be constructed from random samplings of production databases.
Using the #count parameter and the Put command we build a test dataset:
Using DBGET
By default, Suprtool always attempts to read the dataset using its own high-speed
routines. These are the cases where DBGET is used instead:
1. When the database is open with mode-3.
2. When you specify the Delete or Update command and the input source
is a master dataset.
3. When you specify the Delete or Update command and the input source
is a detail dataset, but no If command is specified.
4. When Set Privmode Off.
In these cases, Suprtool prints the warning:
Using DBGET for the input records
If there is a large difference between the number of entries and the highwater mark,
you may wish to repack the detail dataset. If the dataset is dynamic with many
entries being added and deleted, it is better to let Suprtool take longer (otherwise you
would be continuously repacking the dataset).
For regular monitoring of all your datasets, use HowMessy which shows both the
number of entries and the highwater mark for detail datasets.
FLIMIT Different
The Get command may print an error "FLIMIT different than calculated" or a
warning "FLIMIT greater than calculated". Suprtool verifies that the physical MPE
file that corresponds to the dataset matches the information returned by DBINFO.
Suprtool computes the number of records in the MPE file as follows:
#records = (capacity - 1) / blockfactor + 1
This error is usually caused by restoring a earlier version of the dataset from a
backup tape.
Remote Databases
When trying to access a database on a remote computer, the Get command may fail
with the error "Privileged File Violation (FSERR 45)". See the discussion under the
Base command for workarounds to this problem.
Command Help
If you specify any parameters, Help first assumes that you want help on a Suprtool
command. If you know the structure of the help file, you can additionally specify one
of the keywords under the command name.
>help ext {help on the Extract command}
>help ext,notes {Notes section of the Extract command}
Keyword Help
If Suprtool cannot find any help in the "Commands" section of the help file, it
assumes that you specified one of the outer-level keywords in the help file. To see
this list of keywords, type help with no parameters. You see a short introduction to
Suprtool and then a list of keywords. You can specify any of these keywords on the
Help command. You can also specify a subkeyword.
>help start {Quick Start section}
>help start,task {Task section of Quick Start}
Quick Help - HQ
HQ asks Suprtool to look under the keyword Quick in the help file. Quick contains
the text from the Suprtool Quick Reference Guide, offering the experienced user a
quick review of the syntax of any command.
>hq input {quick description of Input}
>hq commands {quick list of command names}
Notes
If no parameters are specified, Help allows you to browse through the "help" file.
The Help Command uses the QHELP subsystem to allow you to look at the material
in the file Suprtool.Help.Robelle (which contains most of the user manual). For "help
in help", type "?" when you see the QHELP prompt character ("?"). The help file is
organized into levels. To go back to the previous level, press Return instead of a key
name. If you press F8, you will exit the QHELP subsystem and return to Suprtool.
You can also use a second task with the same criteria negated by a NOT.
>get dataset {this task is the "If … then"}
>if expression
>output file1,link
>xeq
Expressions
An expression specifies the logical criteria that Suprtool uses to select records from
the input source.
Simple Expressions
The simplest expression is a single comparison between two fields (e.g., A=B) or a
field and a constant (e.g., A="XX"):
field relation field
field relation constant
Constants
A constant is a value that matches the data-type of field. Constants are either a string
constant in quotes, a numeric constant, or a date constant specified with $date or
$today. See the next section about Constants for more details.
Constant Type
"NATHAN ARMSTRONG" string constant
12345 numeric constant
$date(00/07/09) date constant July 9, 2000
Relations
A relation is one of the size comparison symbols (Suprtool does not use words like
"EQUALS" as in QUERY):
Complex Expressions
Complex expressions can be made by combining the AND, OR, and NOT operators,
arithmetic operators (+, -, *, / and mod), and parentheses. The order of precedence of
operators, from highest to lowest, is
Operator Precedence
( ... ) Highest.
NOT Take the opposite.
AND Both must be true.
OR One or the other must be true.
- Unary minus.
*/ Higher than addition and subtraction.
Multiple Values
You can check a data field for several test values without using the AND and OR
operators. After the equals or not-equals sign, list the alternate values separated by
commas.
The OR operator is = (equal sign). Instead of "IF A=5 OR A=6 OR A=7", use "IF
A=5,6,7". This selects a record if A is equal to 5, 6, or 7.
The AND operator is <>. Instead of "IF A<>5 AND A<>6 AND A<>7", use "IF
A<>5,6,7". This selects a record if A is anything but 5, 6, or 7.
>if field = 5,6,7
>if part = "12345","67890","39201","92308","14892"
>if delivered <> 981231,990101
This method works well if you are searching for a small number of values. Use the
$lookup function to check a data field for many test values.
IF $LOOKUP(tablename, fieldname)
The $lookup function returns TRUE, if the specified field name contains a value
from the specified table. You can also look for values that are not in a table.
IF NOT $LOOKUP(tablename,fieldname)
See the Table command for a complete description of how to combine tables and the
$lookup function.
$lookup parameter function
tablename The name of a table specified in the Table command.
fieldname A field from the input record. This field cannot be real-
type. It must be exactly the same length as the item used
in the Table command.
So what Suprtool will do in this case is read a record, lookup the record in the table
and retrieve the data item in the table. If Suprtool does NOT find an entry in the
table, a zero will be returned if the data type is numeric and spaces will be returned if
it is a byte type.
So using the case above, if no entry is found in the table, zero is returned, and if int-
field is equal to zero, then the record will qualify.
If you don’t want to have any values returned from the table lookup, you just preface
the if with a standard lookup.
When using $lookup to return data, the $lookup must always be on then left side of
the expression. If not Suprtool will stop with an error:
>if id-field=$lookup(mytable,char-field,id-field)
Error: $lookup in this context (data comparison) must be on left side
Performance of $Lookup
Short-circuit evaluation Due to the nature of the $lookup function, it can be, at times CPU intensive,
means that the If command however, since the If command uses short-circuit evaluation, $lookup should be
does not always need to specified as the last part of the If command. For example,
evaluate all the parts of the
command.
>if status = "10" and $lookup(cust-table,account)
is faster than
>if $lookup(cust-table,account) and status = "10"
because Suprtool can evaluate status = "10" faster than $lookup. When the
status is not "10" Suprtool knows the record will not be selected, therefore there is no
need to do the $lookup.
$Null(fieldname)
The If $null(fieldname) command selects any rows that have null values in them.
This feature is available only for SQL databases and only on columns that allow null
values:
>if $null(SALESTOTAL)
If you want to find only those values that are not null, you can add the NOT keyword
in front of $null:
>if not $null(SALESTOTAL)
Constants
This section describes numeric and string constants. See also Date Selection.
Numeric Constants
Numeric constants are not enclosed in quotes. Numeric constants may be just simple
whole numbers (e.g., 5, 0, -56, 10004) or they may have a decimal point (e.g., 5., 0.0,
-.56, 99.9, 1.4). Real and IEEE numbers may also have a scale factor (e.g., 5E-5,
0.01E+4). "Over-punches" for the sign are not required, or recognized, in Suprtool.
Always enter -11 as -11, not 1J for a DISPLAY field.
String Constants
String constants are delimited with double- or single-quote marks. That is, either
"VANC" or 'VANC'. Any characters within quotes are not upshifted. If the constant
is shorter than the field to which it is being compared, the constant is padded with
If you want to compare for a quote itself, you include two quotes in the string for
each quote you want.
>if field = "AB""CD" {look for AB"CD}
Character Constants
Use the ^-character to specify any ASCII character. The number (the actual ASCII
value), or letter (^A means control A), must follow immediately after the ^-character.
Suprtool treats character constants as strings. When you compare the constant to a
field longer than one byte, Suprtool pads the constant with spaces.
>define field,1,1 {byte field}
>if field = ^0 {binary zero}
>if field = ^G {Control-G (bell)}
>if field = ^27 {escape}
>if field = ^252 {Roman-8 box}
Subscripts
Use subscripts to access individual items in repeated fields, or to access substrings.
Numeric Subscripts
For repeated numeric fields only one index is allowed.
If Table has the form 10J2, it holds ten double integers.
• Table(1) is the first sub-item.
• Table is the same as Table(1).
• Table(5) is the fifth sub-item.
>if table(5) = 23
>if table(2) = 20 or table(4) = 30
>if table(8) = 31 and table(9) = 28
Character Subscripts
Character string fields may have 1, 2, or 3 subscripts after them. Character string
fields are allowed more than one subscript value.
If ADDR has the form 5X30, it consists of 5 substrings of 30 characters each.
• ADDR(1) is the first 30-character sub-item of ADDR.
• ADDR without subscript is the same as ADDR(1).
• ADDR(2) is the second 30-character sub-item of ADDR.
Numeric Expressions
Bit Selections
The If command can extract and test any series of one or more contiguous bits in a
field. Suprtool allows bit extracts only on Integer or Logical fields of two bytes in
length (one 16-bit word). To do a bit extract from another type of field, first use
Define to redefine the data as a two-byte Logical field.
Once Suprtool extracts a bit string, it always treats it as an Unsigned Integer, a
Logical, and never interprets it as negative. The format for bit extracts calls for a
starting bit number and a bit count. The 16 bits in a computer word are numbered
from the left, 0 to 15. The two bytes to extract from need not be on a "word
boundary" (i.e., they can start in any byte position). See "Define Command [D]" on
page 137 for how to define a two-byte logical field.
field . (startbit : bitcount)
>define bitfield,name,2,logical
>if bitfield.(4:2)=3
Decimal Places
Use the Item command to specify the number of implied decimal places in an item.
If you do not do this, you must scale all numbers in the If command. For example,
let's assume that you want to find all inventory records with a cost equal to $80.59. If
you do not use the Item command, your If command would look like this:
>if cost = 8059 {no decimal places}
By telling Suprtool about the number of decimal places in the cost item, your If
command looks more natural (which usually means you will make fewer mistakes):
Numeric Conversion
The If command can compare two numeric fields to each other (not just one field to
a constant). All relation operators are supported: <, <=, =, <>, >, and >=. However,
you cannot compare a byte-field to a numeric-type field.
Suprtool usually converts the field on the left side of a relational operator to floating-
point. Then the floating-point number is converted into the type of the field on the
right side of a relational operator and the comparison is done. The exceptions to this
rule are integer-to-double, packed-to-packed, and display-to-display comparisons,
which use a direct comparison algorithm.
Truncation errors can occur when Suprtool converts from one field type to floating-
point. See also Accuracy and Numeric Truncation.
Arithmetic Expressions
You can specify arithmetic expressions for any numeric data-type in the If command.
Arithmetic expressions involve the operators +, -, *, / and mod. The Mod operator
returns the remainder between a dividend and a divisor. Arithmetic expressions
cannot start with a numeric constant (e.g., if 2 + a = 10 is invalid). Arithmetic is not
allowed on byte-type fields. If you have a byte-type field that consists entirely of
numeric digits, redefine the field as display type and use the redefined field name in
the If command.
Examples
>if field + 10 = 1115 {numeric field}
>if cost * qty > 10000
>if total < qty * price + tax
>if yymmdd-date / 100 mod 100 <= 03 {first quarter}
Division by Zero
Suprtool reports an error and the input record number if an arithmetic computation
results in division by zero. Use Set Ignore On to force Suprtool to ignore division by
zero errors. With Set Ignore On, the result of division by zero is zero.
Your task executes more slowly if you have a lot of division by zero errors and you
have asked Suprtool to ignore them. A better approach is to check for zero in the If
expression before using it in division:
>if $read
- qty <> 0 and {avoid division by zero!}
- total / qty > 100
- //
Missing Features
Arithmetic overflow in computations will cause Suprtool to abort.
Accuracy
By default, Suprtool uses floating-point arithmetic to compute. In some cases, there
can be slight inaccuracies due to rounding errors. Rounding errors are more likely
with Classic floating-point arithmetic (Set Arith Classic). For example, the following
expression fails if you have a single integer field with the value 7 or -7:
This expression does not fail when using IEEE floating-point (Set Arith IEEE). If
you are developing Suprtool applications for both Classic MPE and MPE/iX, we
suggest that you enable Set Arith Classic in Suprtool/iX to ensure exactly the same
results in both applications.
Numeric Truncation
The accuracy of arithmetic computations is limited to approximately sixteen digits.
Suprtool may truncate four-word integers (quad) or large packed-decimal or display
numbers when they are converted to floating-point. Suprtool does not produce any
error or warning in this case.
$Abs function
Suprtool supports an $abs function, which returns the absolute value of a number.
For example, if a field called Credit contains the value -547.83, the $abs function
returns 547.83.
This function will work on a field or even on an expression such as:
>if $abs(credit / 100 * 1.07) > 500.00
$Truncate function
Suprtool supports a $truncate function which returns the number to the left of a
decimal place. For example if the field stddev contains the value 547.83, the
$truncate function will return 547. Note that there is no rounding.
This function will work fields and expressions:
>if $truncate(stddev / 100 * 1.07) > 200
String Expressions
You can do comparisons with byte-type fields in numerous ways using Suprtool.
These powerful features minimize the number of tasks you must execute in order to
select the data you need. The fewer the number of tasks, the faster your data is
delivered to the users and applications that need it.
You can combine byte-type fields together and use the built-in string functions to
create string expressions. String expressions involve the + operator and the other
string functions such as $lower, $upper, $trim, $ltrim and $rtrim.
Byte Fields
For historical reasons, comparing two byte-type fields to each other is a special case.
If the two fields are exactly the same length, Suprtool compares them completely. If
one field is shorter, the comparison is done for the length of the shortest field.
Suprtool does not check for spaces in the trailing characters of the longer field. For
example,
>define short, 1,10 {ten character field}
>define long ,11,15 {fifteen character field}
>if short = long
In this example, Suprtool compares the ten bytes in the short field with the first ten
bytes of the long field, but ignores the last five bytes of the long field. If the
expression on either side of the equal sign consisted of more than one field (using the
+ operator) or involved any of the string functions, ($upper, $lower, $trim, $ltrim or
$rtrim), Suprtool would have compared both sides of the equal sign by padding the
shorter field with spaces. It is only the case where you are directly comparing one
byte-type field to another that Suprtool uses the length of the shortest field for the
comparison.
You cannot compare a byte-field to a numeric-type field. If you have a byte-field that
consists entirely of numeric digits, redefine the field as a display-type and use the
redefined field name in the If command.
Character Type
Byte-type fields can also be checked to see whether they contain only Alpha,
Numeric, Alphanumeric, or Special characters. The complete field is compared
against the specified character types.
Type Characters
Alpha A-Z, a-z (52 characters)
Numeric 0-9 (10 characters)
Special anything else (194 characters, including
spaces, punctuation, Roman-8 letters, binary
junk)
Alphanumeric A-Z, a-z, 0-9 (62 characters)
For the test result to be true, all the characters in the field must be of the specified
character type. To test a substring, use the Define command to define a subfield.
>if field = alpha
>if field <> numeric
Examples:
Pattern Matching
Suprtool can also select records based on a pattern of characters, rather than an exact
string of characters. For example, use the following to select all records with
"CONNOR" anywhere in the Name field,
>if name == "@CONNOR@"
The double equals (==) is the operator for pattern matching. The at signs (@) means
anything before or after "CONNOR" is acceptable, including nothing.
For character fields, there are two comparison operators for patterns: "==" (matches),
and "><" (does not match). The pattern is specified as a quoted string, using the same
special characters as in the MPE :Listf command. Embedded spaces are allowed in
the pattern and must be matched in the target field.
These are the special characters:
Character Meaning
@ Zero, or more, characters of any type.
# A single numeric character.
? A single alphabetic or numeric character.
~ Zero, or more, blank characters.
& Escape character to match the next character
explicitly (&@ looks for the @ character).
^ Reserved for future use.
! Reserved for future use.
>in cleansd
>clean "^9","^10"
>if $findclean(nonprint)
>list
The above task will list the record if the field nonprint has a Tab (Decimal 9) or a
Line Feed (Decimal 10) anywhere in the field. You can Find and clean the "bad"
characters from a field at the same time:
>in cleansd
>clean "^9:^10"
>if $findclean(nonprint)
>extract nonprint=$clean(nonprint)
>list
Because Suprtool pads shorter strings with spaces when doing comparisons,
trimming spaces is most useful when creating a combined string with several fields.
For example, you might want to combine a person's first and last name (including a
space between the two):
>if $trim(first) + " " + $trim(last) = "Joe Smith"
Note that if you use the $upper or $lower functions, Suprtool does not upshift or
downshift any constants used in the comparison. You must explicitly specify the
constants in the correct case or you can use $upper or $lower with the constant:
>if $upper(city) = $upper("vancouver")
Use the $upper or $lower functions for caseless pattern matching. As with other
comparison operators, you must specify constants in the correct case when doing
pattern matching:
>if $upper(city) == "VAN@"
>if $lower(city) == "ed@"
You can use $upper and $lower with string expressions that combine many fields
and string functions as shown in the following example:
Date Selection
The If command has four functions to help select records based on dates: $date,
$today, $days and $stddate. The $date function works for any date. The $today
function works for the current date and dates relative to today. The $stddate and
$days functions work for almost any date. To use these date functions, you must first
identify the date format of an item by using the Item command.
The $date function makes it easier to specify a target date for certain date formats
(e.g., PHdate or ASK). To select records based on a specific date, use this feature:
>if field=$date(year/month/day)
Suprtool checks the date's validity. To select the transactions for January 1999, you
would do the following:
>item trans-date,date,phdate
>if trans-date >= $date(1999/01/01) and &
trans-date <= $date(1999/01/31)
Relative Dates
You can specify a relative date using the $date function. Then you can create job
streams that don't rely on hard-coded dates. The general syntax of the $date function
is:
$date(year/month/day)
The year can be a specific number (e.g., 2000) or an asterisk "*" for the current year.
To specify a relative year, you add or subtract years from the one you specified:
>if field=$date(2000/01/01) {January 1, 2000}
>if field=$date(2000-1/01/01) {January 1, 1999}
>if field=$date(*-1/01/01) {January 1, last year}
The month can be a specific number (e.g., 6 for June) or an asterisk "*" for the
current month. To specify a relative month, you add or subtract months from the one
you specified:
>if field=$date(2000/06-1/01) {May 1, 2000}
>if field=$date(*/*/01) {start of current year and month}
>if field=$date(*/*-1/01) {start of last month}
>if field=$date(*/*-18/*) {exactly eighteen months ago}
The day can be a specific number (e.g., 15), an asterisk "*" for the current day, the
word "first" for the first day of the month, or the word "last" for the last day of the
month. You cannot add or subtract relative days; use $today instead.
>if field=$date(2001/01/first) {January 1, 2001}
>if field=$date(*/*/*) {today's date}
>if field=$date(*/*-1/last) {last day of previous month}
Combining these features makes it possible to generate batch jobs that require no
operator input. For example, to select all of the transactions for last month you would
use:
Month End
Suprtool is always expecting a valid date. Suppose that you have a month-end job
that contains the following If command:
>if field = $date(*/*-1/*)
When you run the job on May 31, 2000, if Suprtool were to use the literal
interpretation of $date(*/*-1/*), it would use the date April 31, 2000. In fact, there is
no such date; April has only 30 days. Whenever you specify * for the day, and the
day is greater than the last day of the month you specified, Suprtool uses the actual
last day of the month instead of the current day of the month. In our example,
Suprtool would use April 30, 2000. Suprtool will take leap years into account when
calculating the last day of February.
Today's Date
To select records based on today's date, use the following:
>if field=$today {today's date}
>if field=$today(-1) {yesterday's date}
>if field=$today(+1) {tomorrow's date}
Use the Item command to qualify the field as a date. The $today function accepts one
optional argument which is the number of days before or after today. The maximum
number of days in either direction is 9999.
$Stddate Function
The $stddate function converts any date format in nearly any data-type container and
internally converts it to the ccyymmdd format in a double integer container.
This allows you to compare dates with dissimilar formats and data-types. For
example,
This feature is also available for dates that have two-digit years. The century portion
of the date will be generated by $stddate, which uses the normal cutoff rules
specified by Set Date Cutoff.
>in invdets
>set date cutoff 20
>item invoice-date,date,yymmdd
>item close-date,date,mmddyyyy
>if $stddate(close-date) <= $stddate(invoice-date)
>out badinvs,link
>xeq
In this case all invoice-date values with a yy portion between 20 and 99 will have a
19 for the century. All invoice date values with a yy portion of less than 20 will have
20 for the date generated by the $stddate function.
Invalid Dates
A date must be valid before $stddate can convert it to the ccyymmdd format.
Otherwise, a value of 0 will be returned for any invalid dates. An invalid date is a
number in a date format whose date equivalent cannot be found on a calendar. This
includes dates selected by the $invalid function. We can eliminate the invalid dates
from the above task by changinn Jue If command slightly.
>get invoice-detail
>set date cutoff 20
>item invoice-date,date,yymmdd
>item close-date,date,mmddyyyy
>if (not $invalid(close-date) &
or not $invalid(invoice-date)) &
and $stddate(close-date) <= $stddate(invoice-date)
>out badinvs,link
>xeq
In this example, if either the close-date or the invoice-date are invalid, then they will
not be evaluated by the $stddate function and will not be selected. Although your
requirements may be different, you need to remember that invalid dates evaluated by
the $stddate function will return a 0 value.
$Days Function
Suprtool supports a $days function, which converts any supported date to a Julian
Day number (the number of days since 4713 BC). This allows for Date arithmetic, in
which you can calculate the difference between two dates, even if they have
dissimilar formats.
For example you could find all orders that were not shipped within 30 days of being
ordered.
>in ordfile
>if $days(SHIP-DATE) - $days(ORDER-DATE) >=30
>list
>xeq
Invalid Dates
As with the $stddate function, if a date is not a valid date, then the result of the $days
function will be zero. In the example above, if the order has not yet been shipped,
then the SHIP-DATE will likely be blank, or zero, or some other special value.
$Days(SHIP-DATE) will be zero, and the resulting calculation will be a negative
number.
Suprtool normally does no date conversion of the actual dates. Dates that do not start
with the year do not collate correctly, so Suprtool does not allow relative
comparisons with them (<, <=, >, and >=), although you may still compare for strict
equality or inequality. The following examples will be rejected by Suprtool:
>item trans-date,date,ddmmyy
>if trans-date >= $date(*/*-1/first) and &
trans-date <= $date(*/*-1/last)
Error: Invalid date format for the comparison
>input myfile
>define mydate,1,6
>item mydate,date,ddmmyy {e.g., 301100}
>define ....
>if mydate > $date(00/11/01)
Error: Invalid date format for the comparison
>if mydate > $date(01/11/00)
Error: Invalid date: Year = 1 Month = 11 Day = 00
If the date format does not allow the specification of a certain day, such as yymm,
ccyymm, yyyymm, aamm, ccyy and mmyyyy, then you do not need to specify the
entire date format, although Suprtool will allow either format for $date.
Because dates beyond 1999 in the yymmdd and yymm date types do not collate
correctly, relative comparisons are no longer valid. Suprtool produces an error in the
following case:
>item trans-date,date,yymmdd
>if trans-date >= $date(2001/01/01)
Error: Cannot use a date beyond 1999 for this date format.
You can override this setting by entering the Set Date Ifyy2000error command:
>set date ifyy2000error Off
>item trans-date,date,yymmdd
>if trans-date >= $date(2001/01/01)
Suprtool assumes 20 for the century if the specified year is less than the Set Date
Cutoff value, and 19 if the specified two-digit year is greater than or equal to this
value.
Oracle Dates
Oracle dates contain both the date and the time. The $date and $today functions
check the date, but ignore the time.
Date Limits
The $date function in Suprtool can generate dates between the years 1583 and 2583.
Some date formats have limits based on their particular format, such as 2027 for a
Calendar date and 2259 for the aammdd aamm, mmddaa, ddmmaa dates.
Everyone has their own schedule of holidays. Here is how we cope with this problem
in our backup job, using Suprtool to compare yesterday's date to a list of holidays for
the year:
!
!comment Occasionally the backup is not run. This is
!comment usually because of holidays, when nobody is in the
!comment office. The file SKIPDAYS.STREAMS.PROD contains a
!comment list of holidays in YYMMDD ASCII format. Because
!comment the backup job runs after midnight, it checks if
!comment YESTERDAY's date is in the SKIPDAYS file. If it
!comment is, the SKIPTODAY JCW is set to 1.
!
!run suprtool.pub.robelle
input skipdays.streams.prod
define skipdate,1,6
item skipdate,date,yymmdd
if skipdate = $today(-1)
output $null
exit
!setjcw skiptoday = suprtooloutcount
!
!if skiptoday > 0 then
! tellop --- Yesterday was a holiday. No Backup today.
!else
! comment Insert the BACKUP commands here:
! comment STORE, etc.
!endif
The skipdays file is a regular text file with records in the following format:
Long Expressions
Long If commands can use an ampersand to continue the command over several
lines:
>if status = "20" and &
>> state = "AZ", &
>> "CA", &
>> "OR" {no ampersand on the last line}
This is awkward to use and, for internal reasons, the maximum length is restricted to
256 characters. The $read function makes it easier to enter long If commands. Its
maximum length is based on the complexity of the expression, not on the number of
characters.
$Read Function
The $read function reads the If expression from $stdinx, or from the usefile if the If
command is in a usefile. $Read continues to prompt for input lines until you press
Return or enter "//." You must remember to enter all the necessary parts of the If
expression, including connectors like AND and OR and commas. You do not use an
ampersand (&) to continue from one line to the next when using $read.
>if $read {prompt for the expression}
-status = "20" and {$read prompts with "-"}
-state = "AZ", {the comma is still needed}
- "CA",
- "OR" {no comma on the last line}
- {blank line to terminate $read}
Redoing $Read
When prompting for an expression, $read saves each line in the redo stack and
accepts the Before, Do, Listredo, and Redo commands. This provides an easy way to
specify all or part of a previous $read expression.
In this example, Suprtool attempted to create three 256-byte constants. There wasn't
enough room for the last constant. Solutions to this problem include:
1. If possible, define short fields. If you have long field names, you may
want to use the Define command to define shorter subfields.
2. Use tables and $lookup for many values.
3. Split the extract task into multiple passes. On the first pass, use an If
expression that results in the fewest possible number of output records.
Use the output file from the first pass as input to the second. Apply the
remainder of your If expression during the second pass.
$Read in Usefiles
When you specify $read in a usefile, Suprtool expects the If expression to appear in
the usefile. This provides a method for storing and executing complicated If
commands.
You can also manipulate Suprtool into prompting for portions of an If command.
When the If command with $read is the last command in a usefile, Suprtool satisfies
the $read from $stdinx. The $read function can appear anywhere in which a space
can appear, so you can use this to prompt the user for values.
>use prompt.use
>in sdfile {first line of usefile}
>if status=$read and & {continue the If command}
state = $read {last line of the usefile}
-"10" {prompt for status}
-// {end of prompt for status}
-"AZ", {prompt for state}
-"CA", {user must remember comma}
-"OR" {user also enters quotes}
-// {end of the second read}
Notes
Suprtool is not designed to be used by end users. We prefer that you write intelligent
front-ends that understand user applications and hide the details of Suprtool from end
users. We recommend that you use $read from usefiles only for one-time tasks, or
for tasks used by experienced Suprtool users who do not require a friendly user
interface.
$-functions
Some $-functions were originally designed for if command and some are more suited
for the extract command. Because of this some $-functions don’t work in the if
command, such as $edit, and others such as $number have interesting side effects.
Specifically with $number, when you work on byte type fields, they will be updated
internally to be treated as display:
The field byte-field will have leading zeroes and treated as a display.
Input File
The first example shows the most common use of the Input command. An input file
is specified as the input source to Suprtool. We select a subset of the input data with
the If command. Before using the If command, we must define a field within the
input record:
>input dinvent {input is from a disc file}
>define a,11,2,int {"A" is an integer that starts}
>output outfile { at the 11th byte of Dinvent}
>if a<10000 {records with field "A" less than}
>xeq { 10000 are written to Outfile}
Dataset Files
The =setname parameter notifies Suprtool that the records have the same internal
data structure as the entries in this IMAGE dataset. You can then specify sort/select
fields by field name instead of by the physical offset within the record. You must
have done a previous Base command, and setname must exist in the database. You
must have read access to all fields in the dataset entry, and the record length of the
file must match that of the dataset entry.
Using the Define command is error-prone, because it forces you to calculate offsets
and lengths of each field in your input record. If you used Suprtool to create a disc
file from an IMAGE dataset, you do not need to use the Define command:
>base store,5,READER {open for read access only}
>get d-inventory {input from a dataset}
>output dinvent {automatically defined by Get}
>xeq {process this task and continue}
>input dinvent=d-inventory {same format as d-inventory}
>if unit-cost<10000 {use the actual IMAGE field name}
>sort cust-account {again, the IMAGE field name is used}
>list {list the selected records with}
>xeq { their field names and values}
Random Selection
The (#count) parameter specifies that every "nth" record in the input file should be
selected. This option is designed for random sampling of the input file. The
(startrecord/endrecord) parameter cannot be used with this parameter. Like
(startrecord/endrecord), (#count) must come after the =setname, if present.
Test files can be constructed from random samplings of production files. We can
build a test file with the #count parameter:
>input dinvent(#15) {every 15th record is read}
>output dtest {create an output file with every}
>xeq { 15th record from Dinvent}
The Input command is processed immediately. Suprtool does not wait for an Xeq or
Exit command before opening the Input file. If the session seems to hang after the
Input command, check the console to see whether it is waiting for the =reply.
Notes
Only one Input, Chain, or Get command is allowed per extract task. The Input
command opens the specified file immediately. The file is held open until the input is
reset or the current task completes.
If at least one sort key has been specified, the Input command is optional, but you
can specify the input file by means of a :File command (:File Input=xxx).
Suprtool first attempts to open the input file as READ, SHARED, NO LOCKING. If
it cannot open the file because someone else has it open with LOCKING, Suprtool
tries again with LOCKING specified. If the input file is a KSAM/V file, Suprtool
eventually closes the KSAM/V file and reopens it with LOCKING and INOUT
access.
If you specify a self-describing input file with Oracle dates, Suprtool will
automatically recognize the Oracle date attribute.
Itemname
The itemname must be an IMAGE itemname, an SD field, or a Defined field. If the
itemname exists both as an IMAGE itemname and as a Defined field, the attribute is
associated with the IMAGE itemname and the Defined field is deleted. If the
itemname exists both as an IMAGE itemname and as an SD field, the attribute is
only associated with the IMAGE itemname and a warning is produced. The
itemname cannot be qualified with a subscript.
Date Formats
For dates, the attribute must be one of the following:
Attribute Attribute
ASK ccyymm
Calendar ccyy
ddmmyy aammdd
ddmmyyyy aamm
mmddyy mmddaa
mmddyyyy ddmmaa
Oracle SRNChronos
PHdate mmyyyy
yymm yyddd
yymmdd ccyyddd
yyyymm HPCalendar
yyymmdd JulianDay
yyyymmdd EDSDate
ccyymmdd PHDate8
Abbreviations
When specifying the Date keyword, you can use a leading subset for the date
attribute. For example, if you want to specify the Calendar date type, you can specify
only CA.
>item cal-date,date,ca
If you do not like this feature, you can turn it off by specifying the following
command in your Suprmgr file:
Date Limits
The $date function in Suprtool can generate dates between the years 1583 and 2583.
Some date formats have limits based on their particular format, such as 2027 for a
Calendar date and 2259 for the aammdd aamm, mmddaa, ddmmaa dates.
ASK
The ASK attribute is compatible with the ASK manufacturing software. ASK uses a
special date format stored as a single integer or a single logical (i.e., J1 or K1 in
IMAGE). This date is relative to January 1, 1973.
yyymmdd
The yyymmdd attribute is similar to yymmdd, except that the first digit denotes the
century. If the first digit is a 1 (one) then the century is 19, and if the first digit is a 2
(two) then the century is 20. Only data-types of P8 and J2 are supported for this date
attribute.
This date format is used by some third-party software packages such as MACS and
APS.
EDSDATE
The EDSDATE date format is similar to the yyymmdd format, in which the first
digit represents the century. The first digit in the EDSDATE is either 0 or 1: a 0
represents a century of 19 and a 1 represents a century of 20.
JulianDay
The JulianDay number is the absolute count of the days that have elapsed since
January 1, 4713 BC on the Julian calendar.
Typically "Julian Day numbers" refer to an integer number corresponding to whole
days, while the "Julian Date" may mean an integer plus a decimal value that resolves
the Julian count to precise parts of a day. Suprtool supports the "JulianDay" number
and does not attempt to support an hour or point in the day.
YY of AAMMDD CCYY
00 - 09 1900 - 1909
90 - 99 1990 - 1999
A0 - A9 2000 - 2009
B0 - B9 2010 - 2019
C0 - C9 2020 - 2029
Because letters are greater than numbers in the collating sequence you can ensure
that aammdd dates beyond 1999 will order correctly.
Suprtool also supports other date formats with this two-character year representation.
These formats are aamm, mmddaa and ddmmaa.
Oracle
Oracle dates include both the date and the time. The $date and $today functions only
apply to the date part of Oracle dates.
SRN Chronos
The Srnchronos date format is used in applications from Software Research
Northwest. Like Oracle dates, this format includes the date and time, but the time
portion is ignored by the $date and $today functions.
DDD Dates
Dates consisting of ddd in the format name use the ddd to represent the nth day in the
current year. This means that January 1 will be day 001, and Dec 31 will be day 365
on non-leap years. Some people refer to these type of dates as Julian dates.
HPCalendar
The HPCalendar date format is supported by HP's new HPCalendar intrinsic and
consists of a 32-bit integer number, whereby the first 23 bits represent the year and
the last nine bits represent the day of the year.
Decimal Places
The decimal attribute is the number of implied decimal places in an item. The
minimum number of implied decimal places is 0. The maximum is based on the data-
type of the item:
You cannot specify implied decimal places for byte-, char-, real-, long-, or IEEE-
type items.
Once you define a decimal place, almost every command in Suprtool is affected.
Suprtool accepts numeric values with decimal points or scales integers according to
the number of implied decimal places (e.g., specify two implied decimal places, then
enter 1,000 to represent 1,000.00). All formatting commands format fields with a
decimal point when appropriate.
Constant Values
When specifying numeric constants for a field with implied decimal places, there are
different formats that you can use. For example, assume that we use the Item
command to specify two implied decimal places for an amount field. The following
are examples of constant values for this item:
Constant Interpretation
0 zero value padded as necessary
1 $1.00
0.01 $0.01
.01 also acceptable for $0.01
Notes
Compound Items
When you specify a compound item, the attribute applies to all elements of the
compound item.
>item monthly-totals,decimal,2 {12 occurrences}
>if monthly-totals(5) > 1000.00
Parameters
Desc specifies that the field is to be sorted in Descending order.
The byteposition is a number between 1 and the length of the input records,
specifying where the sort field begins. The bytelen parameter is a number from 1 to
the length of the record, specifying how long the sort field is.
The type is a word that gives the desired data-type of the field for sorting purposes:
Type Description
BYTE (unsigned, straight compare)
INT/INTEGER (two's complement)
DOUBLE (two's complement)
REAL (Classic floating-point)
LONG (Classic floating-point)
IEEE (IEEE floating-point)
PACKED (packed-decimal)
PACKED* (packed-decimal, last nibble unused)
DISPLAY (zoned-decimal numeric field)
LOGICAL (unsigned, like BYTE, 2 characters)
CHARACTER (for Native Language Support)
For compatibility with Sort.Pub.Sys, the Key command also accepts FPOINT as the
data-type for IEEE numbers.
Examples
The first example sorts an integer (PIC S9(4) COMP) field which starts on the 11th
byte of the input record. We sort the entire input file based on one key:
The following examples show the various data-types and combinations that are
available with the Key command:
>key 1,10 {byte data-type}
>key 1,10,desc {descending sort sequence}
>key 11,4,double {I2 or J2, S9(9) COMP}
>key 1,6;11,4,ieee {X6 string and an E2 field at byte 11}
>key 21,6,packed {P12, S9(11) COMP-3}
>key 21,6,packed* {P12, S9(10) COMP-3, wasted byte}
Notes
The command name, Key, is optional. Any command that starts with a numeric
character is assumed to be a Key command. The Verify command shows all of the
current key fields, and the Reset command cancels them. If no sort fields are defined
prior to the Xeq or Exit command, Suprtool performs a copy, not a sort.
Notes
You can use the Suprtool2 interface and the Link command to "call" Suprlink. See
the Suprcall User Manual for a complete example of how to use the interface to pass
commands to Suprlink.
Format
You can override the defaults with a specification in the List command (e.g., List
Hex,Char). If the input source is not self-describing and no Extract command is
specified, the default output format is Octal,Char, which also shows both input and
output record numbers.
Decimal Places
The List command formats numbers using the implied number of decimal places. For
example, the following Suprtool commands format the unit cost with two decimal
points. We specify the Rightjustnum keyword, because numbers with decimal
points are hard to read if they are left justified:
>item cost,decimal,2 {two implied decimal points}
>list rightjustnum {numbers right justified}
>xeq { with decimal points}
LaserJet Listings
There are two methods to select different printing options for a LaserJet and other
PCL-compatible printers. You can permanently set the PCL option for all listings by
using Set List PCL, or you can use the List command to select the PCL option for
just one task. PCL stands for Printer Command Language, which is an HP standard
for printers. The following is a summary of the PCL values:
PCL Font Orientation Dimensions
1 Lineprinter landscape 175 cols/60 lines
2 Courier landscape 100 cols/45 lines
3 Courier "standard" portrait 80 cols/60 lines
4 Lineprinter portrait 132 cols/80 lines
5 Courier A4 "tight" portrait 80 cols/60 lines
6 Lineprinter legal landscape 223 cols/60 lines
See the Set command for a complete description of the PCL options. By default,
Suprtool assumes that the List output device is not PCL-compatible (List PCL 0).
If you use the List command to your terminal with a global Set List PCL value other
than zero, your terminal screen may be cleared. To avoid this situation, you can
explicitly specify the PCL setting along with the device:
A4-Size Paper
Most of the PCL options, with the exception of PCL 5, were designed and tested
with North American letter-size paper. This is especially true with PCL 5 for A4
paper: it reduces the horizontal spacing between characters so that 80 columns of
Courier output fits on a single line. In addition, if you add 2000 to a PCL code,
Suprtool adjusts the number of rows and columns for that option to match A4 paper.
For example, to print Landscape on A4 paper, use PCL 2001 instead of PCL 1.
In general, selecting A4 paper gives you more space along the long side of the paper
and less space along the short side. If you are happy with the way letter-size rows
and columns work on A4 paper, simply do not add 2000 to the PCL code. If for some
reason you want more columns than provided by Suprtool (e.g., you are using a
PCL-compatible system printer with wider paper), you can override the size by using
a :File command with the Rec= parameter, as in:
:file suprlist;dev=syslp;rec=-220
Headings in Listings
Specifying a Title in the List command forces Suprtool to produce a formatted
listing with page-headings, page-numbers, today's date and the current time. If you
want just the date and page numbers, use an empty string. For example,
>list title " "
Simple Reports
A Fast Method for Producing Simple Reports
For self-describing files and datasets, the Standard keyword is equivalent to List
Noname,Noskip,Norec,Rightjustnum with default column headings. For data files,
the Standard keyword is equivalent to List Octal,Char. In either case, the Standard
keyword provides a default title that describes the input source. You can override the
title, date format, time format, or any other option selected by the Standard keyword,
by specifying them in addition to the Standard keyword. For example,
>get m-customer
>list standard,date 3 {override the date format}
>xeq
>input mpefile
>list standard,char {override the format options}
>xeq
>input mpefile
>list standard,leftjustnum {left justify numbers}
>xeq
>get m-customer
>list standard,title "Customer List" {override title}
>xeq
>get m-customer
>list standard,heading " " {no column headings}
>xeq
List Device
By default, the List command lists lines to $stdlist. There are several methods that
you can use to redirect the output to a specific logical device or to a disc file. You
can also redirect output to an attached printer.
File Suprlist
Suprtool lists lines to the file Suprlist. You can use a :File command for the Suprlist
file to direct the list output to any line printer (or even to a disc file). The Suprlist file
can have widths of 56 to 256 characters. If PCL is zero, Suprlist defaults to 78
columns wide. If your line printer paper is wider, specify the width using Rec= on
the :File command.
If PCL is non-zero, there is no need for Rec= on the :File command. Suprtool
supplies the correct value.
Device LP
Use the LP option to send listings to the device "LP". If you have specified a :File
command for Suprlist, it overrides the LP option. The LP option assumes that the list
device is 132 columns wide.
>list lp
When redirecting the Suprlist file to disc, you must remember to add a disc value to
the file equation because the default disc file size for the Suprlist file is 1,023
records.
>input sales
>:file suprlist=salefile;disc=20000
>list dev disc
>xeq
Notes
The List operation occurs logically after the sort phase, if any, and after any Extract,
but before the final Output or Put operation. A Reset turns off the current List
options.
For more examples of the List command, see Suprtool Issues and Solutions.
Examples
>listredo 5
>listredo 5/10
>listredo help {print all Help commands}
>listredo -10 {print last ten commands}
>listredo ALL {print entire redo stack}
>listredo purge {print all Purge commands}
>listredo purge xx {print all "purge xx" commands}
>listredo @purge {print all with "purge" anywhere}
>listredo @;rel {print ALL, relative numbers}
>listredo 1/10;out=*lp {dump commands to printer}
>listredo @;unn;out=save {write commands to a file}
Notes
The :Listredo command can be abbreviated to BJ as in Qedit, or to ,, (comma
comma) as in MPEX. You cannot use a semi-colon (;) to combine commands on the
same line.
Persistent Redo
Redo commands can be saved in a permanent file and can therefore be used from
another session. You can use the Set redo command to specify a filename to save
your redo commands. Please see the Set Redo command ("Redo" on page 262) for
details.
Parameters
When you know that you are selecting a small subset of the entire input source, use
the Numrecs command to reduce the size of the sort scratch file and, if required, the
size of the output file. If you select more than size entries, Suprtool prints a warning
message, and ignores the rest of the input records. However, the output file will have
the records that were selected. Use a percent sign (%) to specify the Numrecs as a
percentage of the input file size. The percentage can range from 1 to 500.
Appending to Files
When you want to create a file that you can append to later, you need to use both the
Numrecs command and the Set Squeeze Off command.
Allbase Database
Use the Open command to connect to an Allbase database. You must specify your
Allbase dbename and owner. To read data from an Allbase table or view, use the
Select command. Use Set Allbase Rows to specify how many rows for Suprtool to
fetch when it is reading Allbase data.
>open allbase inventory anne
New Files
The filename is the name of a new MPE disc file to be built by Suprtool (Output
xxx). Unless you use a :File command to specify explicitly the record length and
blocking factor of the new file, Suprtool calculates the record length itself and
chooses a blocking factor to optimize batch access to the new file.
If Suprtool cannot Save the new file because of a duplicate file name, you may purge
the old file or give the new file a different name. If Suprtool is running in batch
mode, it renames the new file as Outputnn, where nn is the lowest number between
00 and 20 that makes a valid new file name. The Outputnn file is built in the same
group and account as the duplicate output file and not in your logon group and
account. This prevents problems on private volumes.
In many cases, Suprtool creates the end-of-file and the file-limit the same. If you
intend to append records to the output file, use Set Squeeze Off to force Suprtool not
to reduce the file-limit when closing the output file.
Suprtool does not create new KSAM files. Use KSAMUTIL or the MPE/iX :Build
command to create the KSAM file, then use Suprtool to load it as an existing file.
Temporary Files
By default, Suprtool saves the output file as a permanent file. Use the Temp option
to force Suprtool to save the output file as a temporary file. If the output file already
exists as a temporary file, Suprtool prompts you to purge the existing temporary file.
If you do not want to purge the old temporary file, Suprtool prompts for a new
temporary file name. In batch, Suprtool renames the output file as the temporary file
Outputnn.
Existing Files
The filename is the name of an old disc or KSAM file to erase (Output xxx,erase) or
to append to (Output xxx,append). Output xxx,erase does not purge the existing file;
it simply overwrites the contents of the file. The original attributes of the file such as
record size, blocking factor, and file limit are not changed.
$Stdlist
Specify output to $stdlist by a single asterisk (Output *). Use this filename with the
ASCII option for a quick listing of a file or dataset.
Note that typing "input" after the equal sign is optional. Any name typed after the
equal sign is ignored; it is the equal sign itself that directs Suprtool to overwrite the
input file.
>numrecs 150%
For IMAGE datasets, you can also reduce the size of the output file
using Numrecs. When the input is not an IMAGE dataset and you
select a Numrecs smaller than the number of records in the input file,
Suprtool builds the output file the same size as the input file. However,
it limits the number of records written to Numrecs.
2. You can use a :File command to override Suprtool's choice.
Format Options
The format and length of the output records is determined by which of the following
format keywords is selected:
Keyword(s) Format
DATA Default
ELSE Records not qualified by if condition
KEY Sort keys only
NUM J2 record numbers only
NUM,KEY J2 record numbers plus sort keys
NUM,DATA J2 record numbers plus data record
QUERY Self-describing file
LINK New format self-describing file
NUM,QUERY Query "numbers" format
ASK COGELOG ASK select file
ASCII Convert numeric to ASCII
DISPLAY Convert numeric to display (zoned-decimal)
PRN Personal computer format
DATA
DATA is the default; output records are the same length and format as the input
records.
ELSE
ELSE tells the output command to output any records to the temporary ELSE file
that do not qualify under a certain if command. If you have a task that looks for all
records with an amount >= 0, then the records <0 will be written to a temporary file
called ELSE. This file can be renamed with a file equation. The ELSE option cannot
be used with num or key or any duplicate option or command or the Sort command.
The ELSE file that gets created will look like the output file in terms of attributes.
KEY
KEY creates output records containing only the sort keys, concatenated from left to
right (major key to minor key).
NUM
NUM creates output records of four bytes in length, containing the double-integer
record number of each input record. The record number of the first record is 1 for
IMAGE datasets, 0 for MPE files, and either 0 or 1 for KSAM files, depending on
whether the FIRST=0 option was selected when the KSAM file was built. The NUM
NUM,KEY
NUM,KEY creates output records containing the four-byte record number, followed
by the sort key values, concatenated from left to right (major key to minor key).
NUM,DATA
QUERY
QUERY creates an MPE self-describing output file. A self-describing file has a file
code of "SD" in the :Listf command and an actual file code of 1084. Self-describing
files contain information about the structure of each record in the file. The file label
contains the name, type, length, and offset of each field in the file.
Self-describing files have no provision for repeated fields. These fields appear with
an "unknown" type in the file label. The QUERY option produces a file that is
similar to the file produced by the SAVE command of QUERY.
LINK
The QUERY output option has some major drawbacks. Compound fields are not
handled, date and decimal point information is not saved, and sort information is not
part of the file description. The LINK option produces a self-describing file that
solves all these problems. This option is the recommended way to generate files for
Suprlink. We are also encouraging third-party software vendors to accept this format.
To convert a self-describing file back into a non-SD file, see "Suprtool and Self-
Describing Files" on page 69.
NUM,QUERY
ASK
ASCII converts all binary input fields into their equivalent ASCII values. All binary
fields are right-justified in their fields with a trailing sign. The sign can be a blank,
"+", or "-". Byte fields are not affected by this option. The size of the ASCII field
depends on the format of the binary field:
Field Format Output Size
I1, J1 6 bytes
I2, J2 11 bytes
I3, J3 16 bytes
I4, J4 20 bytes
K1 5 bytes
K2 10 bytes
E2 12 bytes
E4 23 bytes
R2 12 bytes
R4 23 bytes
Zn n+1 bytes
Pn n bytes
Any fields with implied decimal places (see the Item command) are formatted with a
decimal point in the correct position. Suprtool reserves two additional positions for
each output field that has an implied decimal point.
DISPLAY
DISPLAY converts all binary input fields into their equivalent display values (also
known as zoned-decimal). The size of the display field depends on the format of the
binary field:
Field Format Output Size
I1, J1 5 bytes
I2, J2 10 bytes
I3, J3 15 bytes
I4, J4 19 bytes
K1 5 bytes
K2 10 bytes
Pn n-1 bytes
P*n n-2 bytes
The last digit of the number is replaced with a letter corresponding to positive or
negative values. See the following table.
Units Digit Positive Negative No Sign
0 { } 0
1 A J 1
2 B K 2
Positive values for I- and J-type fields are converted into neutral (i.e., no sign)
display values. The sign is preserved when converting packed fields to display.
DISPLAY is not supported for Real or IEEE fields. Byte fields are not affected by
this option. Display fields in the input record are not converted into display.
PRN
Many PC software packages import PRN files (these files are also called delimited in
some PC documentation). A PRN file has quotes around character-fields and a
comma between each field. Binary values are output in ASCII with an optional
leading sign. Not all applications accept PRN files; for more precise conversion of
data, use STExport.
PRN converts each input-field to a fixed-width output-field, filling with trailing
spaces where necessary. All binary values are converted into their equivalent ASCII
value, left-justified in their fields. The sign precedes the ASCII value for the number
and can be missing, "+", or "-". See the ASCII output-option for the field width of
each data-type.
Output fields with implied decimal places (see "Decimal Places" on page 213) are
formatted with a decimal point in the correct position. Like the ASCII option,
Suprtool reserves two extra columns for each output field with implied decimal
places.
Lotus 1-2-3 accepts records only up to 240 bytes long. Because the PRN option
leaves room for the maximum value of any field, you may need to restrict the
number of output fields using the Extract command.
While some PC software allows alternate characters to be used to delimit character
fields, Lotus 1-2-3 accepts double quotes only. Since Lotus 1-2-3 rejects character
fields that contains a double quote, Suprtool removes all double quotes from
character fields when generating the PRN format. Suprtool removes quotes by
replacing them with a space.
See STExport for a method of including header lines in the file to be down-loaded.
Examples
One reason to use $stdlist as the output file (indicated by * as the filename) is to
obtain a quick listing of the ASCII fields in the input source. The following example
lists the cust-account, name-last, and name-first fields of the m-customer dataset and
separates them by two spaces:
If you want to find out how many records are qualified by some selection criteria,
without producing an output file, send the output to $null. The Out= count on
$stdlist, and the JCW SuprtoolOutCount are both set to the number of qualifying
records.
ELSE
While Suprtool does not have traditional else logic in it's if command you can output
all of the records "discarded" for a given task out to a temporary filed named ELSE.
This way you can output multiple files for a given task as in:
Notes
The output file must be an "old", existing file if the Append or Erase option has been
specified. If you use a :File command to force Output to an old file without
specifying one of these options, Suprtool rejects the file.
If the record length of the output file is not the same as expected by Suprtool, the
records are automatically truncated or expanded with either binary zeros or blanks. If
the blocking factor is not as expected, Suprtool automatically "reblocks" the records.
Thus, Suprtool can be used to reblock disc or tape files economically into better
block sizes in order to save disc space, or to improve on-line access, or to speed
batch access.
Parameters
If database is not specified, setname must be a valid dataset of the Base previously
opened. You must have write access to the dataset selected.
If database is included, the specified database is opened. The specified database can
be redefined to reside on another system or in a different account/group via a :File
command. The default open mode is 1 and the default password is Creator. This Put
database is closed after the task is completed, unlike the database opened with Base.
It is possible to copy records from one database to another with Suprtool.
In session mode, Suprtool prompts for the password if it is not included in the
command. In batch mode, it is necessary to specify a database password without the
password being echoed on the job stream listing. A special database password is
provided to allow for this. When a question mark "?" is used as the database
password, Suprtool prompts for the password on the next physical input line without
echoing. This occurs in batch mode or in session mode.
Examples
For the first example, we assume that the D-SALES dataset is designed to contain a
week's worth of transactions. Each night, the transactions from a week ago are
moved to the monthly dataset: D-SALES-MON. The D-SALES and D-SALES-
MON datasets have exactly the same field declarations. The following Suprtool task
would move one day's transactions from D-SALES to D-SALES-MON.
>base store,1,write {requires write access to database}
>get d-sales {read the weekly dataset}
>if purge-date=000401 {select one day's transactions}
>put d-sales-mon {adding them to the monthly dataset}
>exit
For the next example, we assume that the D-SALES-MON dataset is in a different
database. We prompt for the password for both databases:
>base store,1,? {Suprtool must prompt for password}
Password > {password not echoed}
>get d-sales
>if purch-date=000401 {select one day's transactions}
>put d-sales-mon,ostore,1,? {add to OSTORE database}
Password > {password not echoed}
>exit {the output file defaults to $null}
This example shows how Suprtool can read an MPE disc file and Put each record in
a database:
Omnidex
If you are adding records to a dataset with Omnidex keys, you must have MPE/iX
third-party indexing enabled in your database, or you must run Suprtool with
Omnidex's call conversion facility.
:run suprtool.pub.robelle;xl="xl.pub.disc"
>base store
>input mpefile
>put d-sales {d-sales has Omnidex keys}
>exit
Notes
If the dataset selected for output is a master dataset, it is possible that some of the
output records may be duplicate key values. If this happens, Suprtool prints an error
message and terminates the task, unless you have enabled Set Ignore, in which case
the duplicates are counted and reported at the end of the task. Duplicate records are
not written to the output file.
To add individual entries into a dataset, specifying each field value in ASCII, use the
#Add command of Dbedit.
Examples
The Q command is often combined with the Userpause command. The example is a
usefile that provides an explanation of how long a task takes:
>q
>q "We will select all transactions over $10,000. Since"
>q "there are many transactions, this task will take"
>q "some time (usually more than fifteen minutes)."
>q
>userpause "Press any key when you are ready to start."
Examples
>listf @.soruce {"source" is not spelled right}
NON-EXISTENT GROUP. (CIERR 908)
>redo {redo most recent command}
listf @.soruce {last command is printed}
our {you enter changes to it}
listf @.source {edited command is shown}
{you press Return}
>listredo all
>redo 5 {redo 5th command in stack}
>redo {redo previous command}
>redo -2 {redo command before previous}
>redo 8/10 {redo 8th through 10th}
>redo -10/ {redo -10 through last}
>redo purge {redo last Purge command}
>redo purge temp {redo last "purge temp"}
>redo @temp {redo last containing "temp"}
Notes
The Redo command can be abbreviated to a comma, as in MPEX. You cannot use
";" to combine commands on the same line. The Suprredo file is always a temporary
file. To save more commands, use a :File command on the Suprredo file before you
run Suprtool:
:file suprredo;disc=5000
:run suprtool.pub.robelle
Hpmodify Examples
Here are examples of the MPE-style REDO sub-commands in action:
Edit Action
u First occurrence undoes the previous edits. The u must be in column
one.
u Second occurrence undoes all edits on the current line. The u must be in
column one.
rxyz Replaces the current text with xyz starting at the position of r.
xyz Replaces the current text with xyz starting at the position of x.
Persistent Redo
Redo commands can be saved in a permanent file and can therefore be used from
another session. You can use the Set redo command to specify a filename to save
your redo commands. See "Redo" on page 262 for details.
Parameters
More than one command can be Reset at once by entering several commands
separated by a space or a comma. If no parameters are specified, Suprtool cancels the
previous Sort, Key, If, Delete, and List commands. The other commands remain
unchanged.
If ALL is specified, all of the Input and Output commands are canceled and
database/files are closed. In fact, the only options that are not reset to the initial
condition are Define, Item, and Set options.
Examples
You began to specify a sort, but then you discovered that you specified the wrong
database so you decided to start all over:
>base ostore,5,READER {open for read access only}
>get d-sales
>sort cust-account
>reset all {oops, wrong database}
>base store,5,READER {now we have correct one}
This time both the If command and the Extract commands are incorrect:
>if delivered>000401 {wrong field used}
>extract delivered { in both commands}
>reset if,extract {only reset the If and Extract}
>if purchased>000401 { commands and start again}
>extract purchased,account
Notes
By resetting certain commands, other commands are also reset. For example,
resetting the Base command resets almost all other commands, except the Define and
Output commands. Resetting the Put command closes the output database when the
database for the Put command is different from the input database. Resetting the
Chain, Get, or Input command resets everything except the Base, Define and Table
commands. Resetting the Table command resets everything except the Base and
Define commands. Resetting either the Define or Item command resets both Define
and Item settings.
The select-command can contain any expression or clause that is supported by the
SQL database. Some features (e.g., ORDER BY) may be done faster by Suprtool
(e.g., the Sort command).
Some Select commands can exceed the 256-character command line limitation. The
Select command, however, can be considerably larger if you use the $read feature of
the Select command. This feature is similar to the If command $read feature and is
invoked by entering the Select command on a line by itself (unlike If, you do not
specify $read explicitly).
>select
-ename,salary,tax_paid
-from scott.employee
-order by ename
-//
>
The Suprtool prompt changes from ">" to "-" after entering the Select command by
itself on a line. The entire command gets sent to the Select command parser after
terminating with two slash marks (//) or a blank line.
You might realize greater performance gains with the Select command if you specify
only the columns that you need in your output file for either tables with many items
or when you need only a couple of items from a given table.
The following Select command
>select col1,col2,col3 from user.account@emp
or
>set squeeze off;set list pcl 1
Add system-wide Set When Suprtool starts running, all the options are set to initial "factory settings". The
commands to the Suprmgr file may contain Set commands to override the initial values. Set commands
Suprmgr.Pub.Sys remain set until the end of the Suprtool run, or until changed by another Set
configuration file. command.
Some commands have optional parameters (e.g., the numeric value of Set Lock). If
the command is specified without a value, the default that Suprtool uses may be
different from the program's initial value. When that is the case, the command
description will show the initial value and the default-when-omitted value.
Arithmetic
SET ARITHMETIC Classic | IEEE
(Initially: depends)
Specify which data-type Suprtool should use for arithmetic expressions by using Set
Arithmetic. The default is Classic for Suprtool/V, and IEEE for Suprtool/iX and
Suprtool/UX. This option is only supported in Suprtool/iX.
Baseclose
SET BASECLOSE ON | OFF
(Initially: OFF)
Use Set Baseclose On to ensure that Suprtool closes your database whenever it exits.
The default is for Suprtool to hold the database open when it suspends (e.g., when
returning to Qedit).
Blocksize
SET BLOCKSIZE [size]
(Initially & Default: <none>)
When Suprtool is copying an MPE or KSAM file, it always attempts to duplicate the
record size and blocking factor of the original file. In all other cases, Suprtool
chooses an optimal blocking factor, but restricts the total block size to 2048 words.
When Suprtool is computing the block size, it always chooses the smallest block size
divisible by 128. Specifying an explicit block size forces Suprtool to pick the largest
block size that can fit in the specified block size and still be divisible by 128.
Users may wish to add the Set Blocksize command to the Suprmgr file. Increasing
the block size has two potential problems: small files may consume more disc space,
and reading the file buffered requires more memory for the MPE file buffers. The
maximum block size allowed is 8,192 words.
Buffer
SET BUFFER [ size ]
(Initially: depends; Default: no change)
Set Buffer varies the maximum number of words that Suprtool allocates for input
and output buffers. This buffer size limits the number of data blocks that Suprtool
reads at a time.
CleanChar
SET CleanChar " "
(Default: space)
By default, Suprtool will replace any of the characters specified in the clean
command with a space. You can specify what character to use to replace any of the
characters that qualify with the following set command:
>set CleanChar "."
This will set the character to replace any of the qualifying "to be cleaned" characters
to be a period.
If you want to Clean a field and not replace with any character you just need to set
the clean character in the following manner:
>set CleanChar “<null>”
CurrencySymbol
SET CurrencySymbol "$"
(Default: Dollar Sign)
This setting is used to change the Currency character which is used to edit the data in
a field used by the $Number function. The defined currency symbol(s) is stripped
from the field prior to converting to number, in the $number function. The
CurrencySymbol can be up to four characters.
>set CurrencySymbol "$"
The default character for the Currency Symbol is the Dollar sign.
Date Cutoff
SET DATE CUTOFF [ number ]
(Initially: 10; Default: 00)
We recommend that you always provide a four-digit year when using $date.
However, for reasons of backward compatibility, we introduced Set Date Cutoff. See
"Date ForceCentury" on page 249 for more information.
In this example, if any ship-date has a year of 14 or less, then the century applied to
the new-ship-date field will be 20. Ship-dates with a year of 15 or more will have a
century of 19 applied.
Date IfYY2000Error
SET DATE IFYY2000ERROR ON | OFF
(Initially: ON)
By default Suprtool considers dates with a two-digit century component from the
$date and $today functions to be invalid when the dates resolve to be greater than
1999 and the If operation is a relative operation (e.g., greater than or equal to). You
can control whether Suprtool considers this condition an error by using the following
Set command:
>set Date Ifyy2000Error Off
We have chosen this condition to be an error by default because when the $today or
$date function in the If command resolves a date in a yymmdd format to a value
beyond 1999, the result is not always a useful value. For example, a December 10,
2000 date in a yymmdd format would have a value of 001210 and comparisons to
this value could be logically incorrect.
If you would have included a Delete command in a dataset selection task, you could
have removed all of your records.
Date MapToPHDate8
SET DATE MAPTOPHDATE8 ON | OFF
(Initially: OFF)
This set command will change any item command reference to phdate to mean
phdate8, for assistance in converting to the newer phdate format found in
PowerHouse version 8.19 and higher.
The set command:
only changes the reference to phdate8 in the item command, it does not change
references that already exist in self-describing files nor does it change the data.
With this setting turned on any Item command reference, such as:
>item mydate,date,phdate
DecimalSymbol
SET DecimalSymbol " "
(Default: period)
This setting is used to change the Decimal character which is used to edit the data in
a field used by the $Number function.
>set DecimalSymbol "."
Defer
SET DEFER ON | OFF
(Initially: OFF)
DEFER requests Suprtool to use DBCONTROL for faster "deferred-output" when
doing Puts in the output phase or Deletes in the input phase. In deferred output mode,
IMAGE writes are not posted immediately to disc. If the system crashes while you
are in deferred output mode (i.e., you have a system failure or a nonrecoverable
power failure), you must RESTORE your database from tape. If Suprtool stops due
to an error, or if you abort Suprtool (i.e., break/abort or :abortjob) while the database
is opened with deferred output, you do not have to restore the database.
Set Defer On requires that the database be opened in mode-3 (exclusive). If you do
not open the database in mode-3, Suprtool prints a warning and does the Put or
Delete task anyway (without calling DBCONTROL). The database creator can also
enable deferred output for all users of a database with DBUTIL (enable base for
autodefer).
DumpOnError
SET DUMPONERROR ON | OFF
(Initially: ON)
With DUMPONERROR, Suprtool attempts to produce a formatted listing of records
that cause an IMAGE error. The information printed may include the input record
number, the output record number and the data values of the record. Suprtool uses
current options of the List command to print the data values. If no List command is
specified, Suprtool uses the List defaults.
EditStopError
SET EDITSTOPERROR ON | OFF
(Initially: OFF)
This will force Suprtool to stop if there is data left over to place when applying the
edit-mask. With numeric-type fields, leading zeroes do not cause overflow. With
byte-type fields, spaces do not cause overflow.
Eofread
SET EOFREAD ON | OFF
(Initially: OFF)
Suprtool's Get command reads to the highwater mark for detail datasets, and to the
capacity of the dataset for master datasets.
Set Eofread On forces Suprtool to read to the capacity for both master and detail
datasets.
If Set Eofread is used, it must be specified before the Get command. Hint: Use
HowMessy to see the highwater mark of your detail datasets.
FastRead
SET FASTREAD [ ON | OFF ]
This command has no effect on Suprtool for MPE.
Filecode
SET FILECODE [ number ]
(Initially: 0; Default: no change)
When Suprtool writes to an old file (Output,Append and Output,Erase are the only
cases), it leaves the filecode of the output file unchanged. When Suprtool creates a
new file with the Output,Ask or Output,Query option, it gives the file a special
filecode (1071 and 1084 respectively). When the input file has a nonzero filecode,
Suprtool carries that filecode over to the new output file. See "Output Command
[O]" on page 229 for details on Output options such as Ask, Erase, and Query. To
convert a self-describing file into a non-SD file, see "Suprtool and Self-Describing
Files" on page 69.
In all other cases, new files created by Suprtool have a default filecode of zero. You
can specify an alternate default filecode using Set Filecode.
Specifying Set Filecode forces Suprtool to create the output file with a specific
filecode whenever it was going to use zero. To be effective, this Set command
should be added to the Suprmgr file. To configure Suprtool to use the filecode 222
on output files, you would add this line to your Suprmgr file:
set filecode 222
This feature is useful for MPEX users who wish to manage Suprtool output files. For
example, to find all of the Suprtool output files you would do the following:
Of course, you can still use a :File command explicitly to override the filecode of the
output file.
Filename
SET FILENAME Help | Link | Edit | Hint | Export | Outcount filename
You can change six of the seven built-in file names. The only filename you cannot
change is Suprmgr.Pub.Sys. We recommend that you add these Set commands to
Suprmgr.Pub.Sys. There are six options to Set Filename, one per built-in file name.
SET FILENAME Help | Link | Edit | Hint | Export | Outcount
Examples
In these examples we assume that you want to move Suprtool and all its files to the
Robelle group of the Dist account. We also assume that you wanted to rename the
suprlink program from Suprlink to Linkprog.
>Set Filename Help suprhelp.robelle.dist
>Set Filename Link linkprog.robelle.dist
>Set Filename Edit dbedhelp.robelle.dist
>Set Filename Hint suprhint.robelle.dist
>Set Filename Export stexport.robelle.dist
Firstrec
SET FIRSTREC [ 0 | 1 ]
(Initial & Default: depends on file type)
FIRSTREC forces Suprtool to choose the first record number of the input file to be
zero or one. If the input file is a KSAM file, this option overrides the setting in the
KSAM key file.
This Set option is included primarily for RPG users. Any RPG program that takes
advantage of KSAM record numbers assumes that the record numbers start at one
and not zero, even though the KSAM file itself must be built with the first record
defined as zero (RPG subtracts one before reading from the KSAM file).
Hints
SET HINTS ON | OFF
(Initially: ON)
By default, Suprtool provides all users with a "hint of the day" each time they enter
Suprtool. These hints introduce people to Suprtool features that they may be missing.
You must have the file Suprhint.Help.Robelle on your system. To disable hints, put
Set Hints Off in Suprmgr.Pub.Sys.
Ifcheck
SET IFCHECK ON | OFF
(Initially: ON)
Ignore
SET IGNORE ON | OFF
(Initially: OFF)
IGNORE tells Suprtool to continue processing if there are errors in these situations:
"duplicate-key" errors in writing to a KSAM file or IMAGE master dataset, "chain-
head" errors in deleting entries from an input dataset or putting records to a detail
dataset, a record changed before Suprtool could delete it, division by zero when
doing an If, or invalid numeric data in an input file when doing an If.
InitExtents
SET INITEXTENTS ON | OFF
(Initially: OFF)
Set InitExtents setting is an experimental setting designed to reduce the length of the
extent B-tree for the creation of output files. Turning Set InitExtents on will make
the Initial Extents equal to the maximum number of extents on the creation of an
output file. Keep in mind that that this will increase the size of the chunks that it may
need for large files. Consequently you may experience Out of Disc Space errors in
some cases if large chunks of disc are not available.
ItemAbbreviateDate
SET ITEMABBREVIATEDATE ON | OFF
(Initially: ON)
The specification of the Date format within the Item command by default expects the
entire keyword. For example for the date format of Calendar, you would have to
specify the entire token of Calendar. If you Set ItemAbbreviateDate On, you would
only have to specify CAL for the Calendar date format.
ItemLock
SET ITEMLOCK <fieldname>
(Initially: Spaces)
Suprtool supports Item Level locking thru the Set ItemLock <fieldname> command.
The set command must be specified after the Base and Get/Chain command has been
specified and is only invoked for Delete and Update operations. For example:
!run suprtool.pub.robelle
base order,1,;
get dline
set itemlock item-num
del
out save,link
exit
This field/setting is reset after each task. Item-Level locking is not invoked for PUT
operations.
Interactive
SET INTERACTIVE ON | OFF
(Initially: depends)
If you run Suprtool from a session, Set Interactive is On. If you run Suprtool from a
batch job or with Stdin or Stdlist re-directed, Set Interactive is Off. When it is On,
Suprtool waits for answers to questions and continues processing even if there are
errors. When it is Off, Suprtool aborts on any error, assumes the "correct" answer to
any question, and generally acts as if there is not an intelligent being typing in the
command. Suprtool chooses the "correct" answer, which allows the task to continue.
In most cases, this is the default answer. However, there are cases where Suprtool
picks a different answer from the default. For example, an "output filename,erase"
command has a default answer of "no," but with Interactive Off, Suprtool uses the
answer "yes."
However, if you run Suprtool on a Remote Session that was created from a batch job,
Set Interactive is On even though you are NOT interactive. If you wish to have
proper batch error processing, your first command after :Run Suprtool should be Set
Interactive Off. Set Interactive Off is also useful when automating on-line tasks with
usefiles:
:run suprtool.pub.robelle;parm=4; &
info="set interactive off;use usefile"
LabelledTapeRewind
SET LABELLEDTAPEREWIND ON | OFF
(Initially: ON)
With certain versions of MPE/iX, the rewind operation (fcontrol 5) failed on SCSI
DAT drives. Before Suprtool can read the data on a tape, it must read the labels first.
That means the tape must be returned to the BOT. If the tape does not rewind
properly, you can turn this off with Set Labelledtaperewind Off.
Limits
SET LIMITS [MPE ON|OFF] [READONLY ON|OFF] [Tablesize size]
(Initially CM: MPE ON, ReadOnly OFF, Tablesize 1 megabyte)
(Initially NM: MPE ON, ReadOnly OFF, Tablesize 2,047 megabytes)
When Set Limits MPE is Off, you cannot execute any MPE command (e.g., :Purge).
This is an irreversible option -- once disabled, it cannot be enabled again by the user.
This option also applies to MPE commands executed inside Dbedit and Suprlink.
Table Size
The Table command allows you to load large tables. Once these tables reach the size
of real memory on your machine, performance starts to degrade. Setting Tablesize
restricts the total amount of table space to the specified number of megabytes. We
suggest leaving at least one megabyte of real memory for MPE.
It is not necessary to enter both parameters in order to change one.
The ReadOnly setting, once turned on, cannot be turned off for the current run of
Suprtool. This disables all commands that potentially change data for the specified
database.
If Set Limits ReadOnly is enabled, the following commands from within Suprtool
and Dbedit will not be processed and will return an error:
Suprtool
• Delete
• Put
• Update
Dbedit
• Add
• Change
• Delete
• Modify
You can Set Limits Readonly on the command line using the Info String and Parm
option. For example the following command file can be used to restrict who has
write access to a given database. In this example only the Mgr user is allowed write
access:
IF HPUSER = "MGR" THEN
run Suprtool.pub.robelle
else
run suprtool.pub.robelle;parm=8;info='set limits readonly on'
endif
List
SET LIST option value
Use Set List to configure default values for the List command. You can configure the
default date, time, and format for LaserJet listings.
List Date
SET LIST Date number
(Initially: 0)
List PCL
SET LIST PCL [ 0|1|2|3|4|5|6 ]
(Initial & Default: 0)
Use Set List PCL to configure the default format for LaserJet listings. This option
defines the List device as a PCL device and indicates the orientation and font for the
report. Set List PCL affects only the List command; it is ignored by the Output
command. PCL stands for Printer Command Language, which is an HP standard for
printers. The LaserJet is one of the first PCL devices to be released by HP.
By default, Suprtool assumes that your List output device is not PCL-compatible
(List PCL 0).
PCL 1. To print the Suprtool List output in Landscape mode (across the wide part of
the paper) with the tiny Lineprinter font (16.66 pitch or 8 lines per inch), you should
do the following (this setting prints 175 columns per line):
>:comment Maximum of 175 columns with this font
>set list pcl 1
>:comment You will need LaserJet with proper font cartridge
>list device laser123
PCL 2. To print the listing in Courier font, Landscape mode, 6 lines per inch, and
100 columns wide, use:
>set list pcl 2
>list device laserjet
PCL 3. This option selects the "standard" Portrait orientation with the Courier font
of the LaserJet (80 columns across by 60 lines). You would use Set List PCL 3 when
you insert a Font cartridge that overrides the default font (e.g., 92286F cartridge).
PCL 4. Selects Portrait orientation and Lineprinter font of the L cartridge (and
others). This option prints 132 columns across the page by 80 lines.
PCL 5. Prints 80 columns on A4 paper by slightly narrowing the space between
columns.
PCL 6. Prints tiny letters in Landscape mode on legal-size paper. This gives you 223
columns per line.
The PCL options, with the exception of PCL 5, were designed and tested with North
American letter-size paper. Suprtool can adjust the number of rows and columns for
each option to match A4 if you add 2000 to the PCL code. You can also select the
List Time
SET LIST Time number
(Initially: 1)
When you select page headings with the List command by specifying a title, each
page includes the current time. By default, the time is in 24-hour format (e.g., 23:02).
Use Set List Time to specify a different default time format for future List
commands (e.g., Set List Time 2). The valid time formats are as follows:
Lock
SET LOCK [ number ]
(Initially: 1; Default: 1000)
There are three different locking strategies that Suprtool uses for the Delete, Put, and
Update commands. A complete discussion of locking is found in the IMAGE section
of "Suprtool Issues and Solutions".
Set Lock 0. Locks the dataset(s) at the beginning of the task and unlocks it at the
end. This option is good for middle-of-the-night tasks that are doing lots of Puts,
Deletes, or Updates.
Set Lock 1 (initial value). Lock the dataset and unlock it around every Delete, Put
and Update. This takes longer, but provides less database contention.
MakeAbsent
SET MakeAbsent [ On|Off ]
Set MakeAbsent On, tells the prefetch module to make pages that are in memory to
be released sooner.
>set makeabsent on
This feature is only relevant if prefetch is turned on with a setting of 1-5, which
controls the size of a prefetch. Set MakeAbsent On has no impact if prefetch is
turned off. For more information on this setting and its impact please read the
following article from our web site at:
http://www.robelle.com/tips/st-performance.html
NLS
SET NLS [number]
(Initially: 0 or NLDATALANG JCW)
Use Set NLS with MPE files to specify the language to be used for sorting
Character-type fields (see "Native Language Support" on page 73). The number
corresponds to an NLS language; you cannot use the NLS language name. Suprtool
uses the value of the NLDATALANG JCW to set the default NLS language. The
common language numbers are:
Number Language
00 Native-3000
01 American
02 Canadian-French
03 Danish
04 Dutch
05 English
06 Finnish
07 French
08 German
09 Italian
10 Norwegian
11 Portuguese
12 Spanish
13 Swedish
Since some users, used this work around, the fix to the $number function will then
return incorrect results. Therefore, we added the set numbug command to have
Suprtool revert from the correct behaviour to continue to have the bug.
By default, Suprtool will just convert the number and not add on the data at the end,
however, if you have used the work around then you can add the command:
>set numbug on
Openmode
SET OPENMODE [ number ]
(Initial & Default: 1)
By default, Suprtool opens databases in mode-1 when the mode is omitted from the
Base command. Using Set Openmode, you can specify an alternate mode for the
Base command. A common choice would be Set Openmode 5, so that Suprtool
would allow only read-access to the database (disabling the Delete command, for
example).
Oracle Rows
SET ORACLE ROWS number
(Not supported in MPE)
This option is not available in the MPE version.
Oracle OpenFix
SET ORACLE OPENFIX ON|OFF
(Initially: OFF)
This option is not available in the MPE version.
Oracle Integer
SET ORACLE INTEGER ON|OFF
(Initially: OFF)
This option is not available in the MPE version.
Oracle PassShift
SET ORACLE PassShift ON|OFF
Oracle ZeroNull
SET ORACLE ZERONULL ON|OFF
(Initially: OFF)
This option is not available in the MPE version.
Pattern
SET PATTERN NEW | OLD
(Initially: NEW)
Prior to Suprtool version 3.1, there was no method of checking for the "@", "#", "?",
or "~" characters in a pattern. Version 3.1 introduced a new pattern-matching
routine, adding an escape character "&", and two new reserved characters "^" and
"!". Old Suprtool tasks that look for the specific characters &, ^, or ! will not work
with the new pattern-matching routine. Users who are concerned about this can add
the following command to their Suprmgr.Pub.Sys file:
set pattern old
Prefetch
SET PREFETCH [ number ]
(Initially: 0; Default: no change)
Suprtool can read data directly from disc into memory with multirecord NOBUF
reads. However, Suprtool is often slowed down on MPE/iX while waiting for the file
system to satisfy its read requests. Suprtool can increase its throughput by using
prefetch on MPE/iX and instructing MPE/iX's memory manager to read the data
from disc to memory ahead of time. This way, Suprtool doesn't have to wait when it
needs the data because the data it is already in memory.
The Set Prefetch command tells the memory manager how far ahead of Suprtool it
should fetch data. Setting this number too low won't give the memory manager
sufficient time to get the data into memory before Suprtool needs it. Setting the
number too high may mean that on a busy system the data will be overwritten before
Suprtool gets a chance to use it.
Due to changes in MPE memory management in more recent versions of MPE,
performance improvements from prefetching data has decreased and in some cases,
such as systems with a large amount of memory, prefetching shows little or no
performance gain and may impact other users. It is for this reason that we have
changed the default value to zero, or off.
In short our advice at this stage is for you to try different values of prefetch and see if
you see performance improvements with some key tasks, however since we are not
seeing the performance gains we did 15 years ago, when prefetch was implemented
we are turning it off.
Suprtool/iX ignores the Set Prefetch value when reading from a remote file or
database, or from a KSAM/V, KSAM/XL, circular, or RIO file. Set Prefetch is
ignored by Suprtool/V.
Progress
SET PROGRESS Percent [ number ] Minimum [ number ]
(Initial & Defaults: Percent 5, Minimum 10000 (MPE/V) 50000 (MPE/iX))
The Set Progress command is used to turn the Suprtool progress report feature on or
off. The PERCENT value specified tells Suprtool by which percentage increment to
report the progress messages of any given input or output phase. The allowed range
for set progress is from 0 to 25, the default is every 5 percent. If the PERCENT
parameter is not specified, then the next parameter is considered to be the PERCENT
value. This is to remain compatible with some earlier pre-release versions of
Suprtool.
The MINIMUM value is the minimum number of records that an input file must
have in order for the progress reports to be printed out. If the MINIMUM value is set
to 15000, then the input file must have at least 15000 records or else progress
messages are not printed out for the entire task. This value allows the user to turn off
progress messages when reading smaller files. The default value for the Suprtool/V
version of Suprtool is 10000 records, and the default value for the Suprtool/iX
version of Suprtool is 50000 records. To always print progress messages, just set the
minimum value to 0.
Suprtool does not produce any progress messages under the following conditions:
1. Set Progress is zero.
2. Output is to $stdlist via the Output * or List commands.
3. Chain command has been specified.
4. The number of records from the input source is less than the minimum
value.
Suprtool checks whether or not to print a progress message at the end of each buffer
(for NOBUF/MR reads). Consequently, not all progress increments are reported for
small files or datasets.
Suprtool reports the phase that it is in: whether input phase, sort phase, output phase
or combined input/output phase (not sort).
The content of the progress messages is as follows:
• Percentage complete
• Phase and the total number of records processed
• Delta-Sec(Min) - the time elapsed from the previous message
• Wall-Sec(Min) - the total elapsed time
Prompt
SET PROMPT character
(Initially: > )
PROMPT tells Suprtool which character to use for prompting. Any special character
can be used as the prompt character. For example:
:run suprtool.pub.robelle
>set prompt %
%base store,5
RealMap
SETREALMAP ON|OFF
(Initially: ON)
This option has no effect in Suprtool for MPE.
Recover
SET RECOVER ON | OFF
(Initially: OFF)
This option can be used with an If command, which selects only records with a -1 in
the first word, to extract deleted records from a KSAM file. This is not supported for
KSAM/XL files prior to MPE/iX 4.0. On MPE/iX 4.0 and later, Suprtool can recover
deleted records if you do not build your KSAM/XL files with the reuse option. If you
use the reuse option, Suprtool can only recover deleted records where the space has
not yet been reused.
Redo
SET REDO filename
(Initially: none)
Commands that you enter at the Suprtool prompt are saved in something called the
redo stack. You can recall commands from the redo stack using other commands
such as Before, Do and Redo. By default, the redo stack is stored in a temporary file
but is discarded as soon as you exit. This means that your redo stack is not preserved
accross invocations of Suprtool.
Set Redo allows you to assign a permanent file as the redo stack. The redo stack is
then available for future Suprtool invocations. To assign MYREDO as a persistent
redo stack, enter:
>set redo myredo
If the file does not exist, Suprtool creates it. If it already exists, Suprtool uses it. All
the commands you enter from this point are written to the persistent redo stack. The
setting is valid for the duration of the Suprtool session. As soon as you exit Suprtool,
Concurrency
When Suprtool uses the default temporary stack, it is only accessible to that
particular instance of Suprtool. You can run as many Suprtool instances as you need
and each one gets its own redo stack. With temporary stacks, you will never get into
concurrency problems.
If you start using a persistent redo stack, you might start running into these type of
problems. A persistent redo stack can only be used by one Qedit instance at any one
point in time. If you try to use a persistent redo stack that is already in use, you will
get:
>set redo myredo
EXCLUSIVE VIOLATION: FILE BEING ACCESSED (FSERR 90)
Unable to open file for REDO stack
In this situation, Suprtool continues to use the redo stack active at the time so you
can continue to work as normal.
Qedit also has the ability to have permanent redo stacks. It is advisable to have
separate redo stacks for each product, as they will write commands to each others
redo stack if you supply the same filename.
For example if you use the command:
>set redo myredo
you will have a redo stack called myredo for your Suprtool commands. If you exit
Suprtool and run Qedit and supply the same command set redo command your Qedit
commands will be written to the same file that was used for your Suprtool
commands.
By default your permanent Redo stack will be built to 1000 commands. If you
require a larger redo stack you can specify the size of the redo stack using a file
equation prior to the set redo command.
>:file myredo;disc=10000
>set redo myredo
This will only be in effect the first time that the redo stack is built, subsequent file
commands will not affect the size of the redo file. You can make the file bigger using
tools such as MPEX's %altfile command, or by building a larger file and copying
your current redo stack to the file.
Sortfast
SET SORTFAST ON | OFF
(Initially: depends)
Suprtool/iX has its own internal sort routines. These routines are as fast or faster than
HP's sort routines, and do not require as much sort scratch space as HP's routines. Set
Squeeze
SET SQUEEZE [ ON | OFF ]
(Initial & Default: <neither>)
Turning Set Squeeze On forces Suprtool to always truncate the output file limit to
the end-of-file when the output file is closed. Turning Set Squeeze Off forces
Suprtool not to change the limit when closing the output file. By default or by
specifying Set Squeeze (i.e., with no option) forces Suprtool to decide when to
truncate the output limit to the end-of-file.
Suprtool will not squeeze a file limit if the input source is a file, the output file is not
a new file, the output file is KSAM (CM, NM or KSAM64), or if the Ask or Num
query output options were specified. In all other cases, Suprtool squeezes the file
limit down to the EOF.
Set Squeeze Off can be combined with the Numrecs command to automate job
streams in which data is appended to the output file. For example,
>get d-sales
>numrecs 200% {output file will have extra room}
>output dsale
>set squeeze off {reserve room between EOF and LIMIT}
>xeq
>get d-history
>output dsale,append {Dsale has room for appending}
>xeq
Statistics
SET STATISTICS ON | OFF
(Initially: OFF)
STATISTICS causes Suprtool to print statistics at the end of each task. This can be
useful for determining the effectiveness of Suprtool's Get versus Chain commands.
Subsystem
SET SUBSYSTEM ON | OFF
(Initially: OFF)
Normally, Suprtool ignores database subsystem access. Use Set Subsystem On to
instruct Suprtool to examine the subsystem option of the database in the Base and
Put commands. Subsystem access can be restricted to READ or NONE by using
DBUTIL. If subsystem access is NONE, Suprtool does not open the database. If
subsystem access is READ, the Suprtool Put and Delete commands are disallowed
and the Dbedit Add, Delete, Modify, and Change commands are also disallowed.
Once you enable Set Subsystem On, you cannot disable it. This Set option applies to
all databases; you cannot enable it for a specific database. Using the creator
Suspend
SET SUSPEND ON | OFF
(Initially: varies)
SUSPEND instructs Suprtool to suspend after an Exit command.
The default is OFF when Suprtool is :RUN from MPE, when :RUN with Parm=32,
or when invoked from the POSIX shell. Suspend is ON when Suprtool is :RUN from
within another program (e.g., Qedit). In some cases it is desirable to turn this option
OFF to prevent several invocations of Suprtool from being present at the same time.
Users who run Suprtool from within MENU systems or QUICK may want to turn
Suspend Off, or :Run Suprtool with Parm=32.
ThousandSymbol
SET ThousandSymbol " "
(Default: comma)
This setting is used to change the Thousand character which is used to edit the data
in a field used by the $Number function.
>set ThousandSymbol ","
Userlabels
SET USERLABELS ON | OFF
(Initially: ON)
By default, Suprtool always copies user labels from the input file to the output file.
User Labels are ignored when no Extract command has been issued and Set
Userlabels is Off. However, if an Extract command is issued and Set Userlabels is
Off, Suprtool still writes the Userlabels. If List Labels is requested, Suprtool prints
the contents of the user labels before listing the data. If Userlabels is Off, Suprtool
does no processing of user labels. To convert a self-describing file into a non-SD
file, see "Suprtool and Self-Describing Files" on page 69.
VarsubCompat
SET VarsubCompat [ ON | OFF ]
(Initially:OFF)
This command has no effect on Suprtool for MPE.
VarsubDebug
SET VARSUBDEBUG ON | OFF
(Initially: OFF)
Set VarsubDebug on will print out the line after the variable substitution has
occurred. This setting only works if Set Varsub is on and Set varsubdebug is on.
The output is formatted into 74 byte chunks and printed with a preceding “vd:” so
the “substituted” line is clear.
Warnings
SET WARNINGS ON | OFF
(Initially: ON)
Suprtool normally prints warning messages out to $stdlist. You can turn off these
messages when you are running from batch by issuing a Set Warnings off command.
If you are simulating batch mode with the Set Interactive Off command, you must do
the Set Warnings off after the Set Interactive Off.
The default for this setting is On.
Field
The field specified must be an IMAGE data item that is a field of the input source, or
a defined field, or a field from a self-describing file.
Subscript
If the field is a compound item (e.g., 2X25), the first sub-item is the default if no
subscript is specified. You can sort on any sub-item by specifying the subscript. For
example,
>sort address(2) {sorts on 2nd sub-item}
Examples
The most common use of the Sort command is to specify a sort field of a database
field. You may use the Key command to specify all sorts. We recommend that the
Sort command be used wherever possible. If the structure of your database changes,
your Suprtool tasks still work if sort fields are specified with the Sort command:
>base store,5
>get d-sales {input from an IMAGE dataset}
>sort cust-account {primary sort field}
>sort purch-date,desc {newest transactions first}
>output dsales {write the sorted records to an MPE disc file}
>exit
In the next example we sort an MPE file. We create a field using the Define
command. Rather than using the Key command, we use the Sort command to specify
the sort field. If the MPE file changes, only the Define command must be changed:
>input dinvent {input is from an MPE file}
>define a,11,2,int {"A" is an integer that starts}
>output outfile { at the 11th byte of Dinvent}
>sort a {sort the input records by the "A" field}
>exit
With the =dataset form of the Input command, we can have even greater flexibility
to use the Sort command. We assume that the MPE file Mcust has the same structure
as the m-customer dataset. We sort the file using the first of the two street addresses
in m-customer:
Notes
The Verify command shows all of the current Sort command values and the Reset
command cancels them. If you have not defined any sort fields before the Xeq or
Exit command, Suprtool performs a copy only, no sort.
It is important to note that if the field being sorted is the result of a $function, then
you may not be sorting on the value of the field after the function has transformed
the field. For example the following task may not give you the result you expect:
>base store,5
>get d-sales
>def cust-accountx,1,6,byte
>ext cust-accountx = $edit(cust-accout,"zzzz99"
>sort cust-accountx {sorting on transformed field before it has value from function}
>dup none keys
>output dsales
>exit
In this instance you will not be sorting on cust-accountx as transformed by the $edit
function, but rather the first six bytes of d-sales. Therefore it is important to note
when you are using extract to transform a field, you will not be sorting on that
transformed value.
Therefore the way to do the transformation would be to either divide into two tasks
or if you can logically sort on the field before the transformation in order to achieve
the result, so the task could be:
>base store,5
>get d-sales
>def cust-accountx,1,6,byte
>ext cust-accountx = $edit(cust-accout,"zzzz99"
>sort cust-account {Note sorting on source field}
>dup none keys
>output dsales
>exit
Parameters
tablename
Any identifier name up to sixteen characters long. This name can be the same as the
name of a Define field or database itemname, but we recommend that you choose a
unique name.
itemname
An item from the database specified in the Base command or a Define field. This
cannot be a real-type item.
value
A specific value that must match the type of the item. String values are extended
with blanks to the length of the item.
Examples
Suppose that you wanted to look for several part numbers. You could use the
following If command:
>if part = "12345","67890","39201","92308","14892"
Sometimes you need to look for all records that do not have any of a set of values,
>if part <> "12345","67890","39201","92308","14892"
You would use the same Table commands, but a slightly different If command,
>if not $lookup(part-table,part)
Parameters
itemname
The item determines the data-type and length of the key values in the table. By
default, you can only load a table from a file when the item is the first field in the
file. If you load a Table from a self-describing file, Suprtool first checks for the field
in the self-describing file.
FILE vs. SORTED
The File option assumes that the file of table values is not sorted. Sorting a large file
of values is slow. If the file is already sorted, use the Sorted option: Suprtool checks
the records to make sure they are in ascending order.
filename
A valid MPE file name.
Hold
By default, the Xeq command resets all tables. Use the Hold option when using the
same table in more than one extract task. When Hold is specified, the Xeq command
does not reset the table. Hold applies to individual tables, not all tables.
>table part-table,part,file,partin,hold
Data
The Table command allows for data to be loaded along with matching key values.
You can specify up to 20 data fields as long as the total size of the key fields and
data does not exceed 256 bytes. The Table file must be Self-Describing to use the
data option.
When loading data into a table, Suprtool will eliminate the duplicate entries based on
the key value, so some data values may not be loaded into the table.
For information on how to retrieve data from the table, please see the Extract
command, or the Examples section of the Table command.
Examples
If all of your part numbers are in the file Partin, you use:
>table part-table,part,file,partin
>if $lookup(part-table,part)
The following example uses Suprtool to create a file of customer numbers that are in
arrears. This file is then used to select the orders for these customers from the d-sales
dataset. Instead of serially reading the file, we use the Chain command to take
advantage of existing IMAGE search fields. The cust-account item occurs in
both datasets. When the table is loaded, Suprtool obtains the cust-account field
information from the self-describing custacct file.
>base store,5
>get m-customer
>if cust-status="30" {customers in arrears}
>out custacct,link {self-describing output for the Table command}
>xeq
>table cust-table,cust-account,file,custacct
>chain d-sales,cust-account=cust-table
>output dsales
>xeq
The next example sorts selected records from the d-inventory dataset. Because the
output file is not a self-describing file, we must use the Extract command to make
the key-field the first field in the file. We use this file to load a table and select the
records from the m-product dataset.
>get d-inventory
>if on-hand-qty<10 {select records}
>ext product-no {product-no must be first}
>ext on-hand-qty {other fields follow}
>ext last-ship-date
>sort product-no {sort by key value}
>out invent {later, use this file in the Table command}
>xeq
>get m-product {contains product description}
>table product-table,product-no,sorted,invent
>if $lookup(product-table,product-no)
>sort product-no
>output mproduct
>xeq
The next example shows how to select part numbers from flat file parts, using the
file Partin. We use the Define command to define where the part-no field is in the
record. This example assumes that the Part numbers are in the first six bytes of each
file.
Suprtool can load up to ten tables, either from separate files or the same file. The
following example assumes that the files are self-describing.
>input customer
>table cust-table,custno,file,custfile
>table zip-table,zipcode,file,custfile
>if $lookup(cust-table,custno) and $lookup(zip-table,zipcode)
>output newcust,link
>xeq
Keep in mind that using multiple tables may be more memory intensive and require
more resources.
Data Example
Your boss comes to you with a list of new prices for certain parts and asks you to
update the Part-Master dataset.
Just load the new prices into a Table, index by the product number (prodno),then
Extract the price field from each record and replace it with a $lookup on the table.
Here is the code:
>table newprices,prodno,file,bosslist,data(price)
>get part-master
>if $lookup(newprices,prodno)
>update
>extract price = $lookup(newprices,prodno,price)
>xeq
We do the If $lookup to select only the parts which have new prices, then do Extract
with $lookup to replace the existing price with a new one. The Update command
forces a database update on each selected record and must come before the Extract
command.
If you did not do the If $lookup then the price field would contain zeroes for those
fields that did not have a matching record.
Notes on CM / MPE/V
The Xeq command clears any tables that are not held. Suprtool uses extra data
segments to store the table values. You may not be able to load huge tables because
of a lack of system resources (e.g., DST entries). To reduce the number of extra data
segments Suprtool needs, you should configure the maximum extra data segment
size to 32,764 words, using SYSDUMP on MPE V or SYSGEN on MPE/iX.
Searching huge tables is CPU-intensive. If you do this on-line, it seriously affects
other users. While it is possible to load tables as large as 15 megabytes, we suggest
that you make sure that there is enough real memory to hold the table. Remember
that MPE takes at least one megabyte of real memory on Classic HP e3000s. Set
Limits Tablesize restricts the maximum size of tables, so you can limit the total
amount of table space to a specified number of megabytes.
In order to accomodate some large tables you may need to increase the value of
Maximum number of XDS per process. The maximum value of this setting is 255
and can be changed using SYSDUMP on MPE V or SYSGEN on MPE/iX.
The Translate command also has two special keywords to fill the translation
table to help scramble data in byte-fields from readable to unreadable and
back again to readable.
>in nametest;list;xeq
>IN NAMETEST.NEIL.GREEN (0) >OUT $NULL (0)
NAME = Neil Patrick Armstrong
IN=1, OUT=1. CPU-Sec=1. Wall-Sec=1.
>in nametest
>translate tounread
>ext name=$translate(name)
>list;xeq
Parameters
Each totaled field must be an IMAGE field name, or a field from a self-describing
file, or a Defined field. Total specifies that a total value for the field be printed after
processing the records. There does not have to be any output file (i.e., it can be $null)
for a total to be printed. There can be up to 15 totaled fields.
The subscript is valid only for compound items. If no subscript is specified, the first
field of a compound item is totaled. The decimal-places provides a decimal point
when the final total is printed. If the Item command specifies the number of implied
decimal places, the decimal-places parameter is not needed. The values within each
field are assumed to be aligned.
$File Options
By default, totals are written to $stdlist. Use the $file option to have the totals written
to a file or to the List device. When writing to a file, the default is to create a new
file. If Suprtool cannot save the file, it produces an error. The Append, Erase, and
Temp options are the same as in the Output command.
The file specified in $file must have a minimum record size of 48 bytes.
If you want the totals written to the end of the List device (the output of the List
command), specify $list as the $file file name. All other options are ignored when
$list is specified.
To write totals to the output file, use Total $file xxx,Append, where xxx is the name
of your output file. You also need to turn Set Squeeze Off (otherwise, there will not
be room for the totals). Appending totals to the output file only works if the output
file is a disc file.
Examples
The first example prints the totals for a single field.
>in file1
>def total-field,1,5
>total total-field
>xeq
Totals (TUE, OCT 10, 2000, 4:30 PM):
TOTAL-FIELD 611105+
The next example is identical to the previous one, except that we qualify the total
with the number of decimal places.
The previous example specified the number of decimal places by using the Total
command. The next example is the preferred way to specify decimal places because
it qualifies the cust-bal field with two decimal places for all Suprtool
commands. This example also totals two fields (note that you need two Total
commands) and shows how to total individual fields using subscripts.
>base test
>get dorder
>item cust-bal,decimal,2
>total cust-bal(1)
>total cust-bal(2)
>xeq
Totals (TUE, OCT 10, 2000, 4:32 PM):
CUST-BAL(1) 143598.16
CUST-BAL(2) 155399.73
All the examples so far have shown the totals being written to $stdlist. The next
example writes the totals to the file totfile.
>base store
>get d-sales
>total sales-tax
>total sales-total
>total $file totfile
>xeq
To write the totals to the end of a Suprtool listing, use the $file option with $list as
the file name. This example writes the totals to the end of the simple Suprtool report:
>base store
>get d-inventory
>list standard
>total unit-cost
>total $file $list
>xeq
Notes
Totals are formatted and displayed in a form that is understood by people. If you
want to return total values to a program, see the Calling Suprtool user manual.
You cannot combine the Total command with the Total option of the Duplicate
command.
The Total command prints out a date and time stamp on the title line. This is for
audit purposes.
Example
This example selects all inventory items with a unit-cost less than $10.00 and
increases the unit-cost by five percent.
>get d-inventory {input dataset}
>item unit-cost,decimal,2 {implied decimal places}
>if unit-cost < 10.00 {selection criteria}
>update {Update must come before Extract}
>extract unit-cost = & {calculate the new …}
unit-cost * 1.05 {… unit-cost value}
>xeq
This next example selects all inventory items with a part number of 12345677 and
changes it to 12345678.
>get d-inventory {input dataset}
>if product-no = 12345677 {selection criteria}
>update ciupdate
>extract product-no = 12345678 {new unit-cost value}
>xeq
You can set CIUPDATE by using the DBUTIL Utility. To set CIUPDATE on just
run Dbutil and use the Set command:
:run dbutil.pub.sys
>>set dbname ciupdate=on
>>exit
Notes
The only commands that can be combined with Update are selection commands
(e.g., the If command). The following commands are not allowed: Delete, Duplicate,
Key, List, Output, Put, Sort, or Total. You cannot update critical fields in master
datasets. Update does not work with MPE or KSAM files.
If you are updating a packed or display field, remember that Suprtool uses unsigned
values for non-negative numbers unless you add a leading plus sign to the number.
See "Packed and Display Constants" on page 155 for more details.
Quiet Execution
By default, Suprtool displays the commands in a usefile as they are executed. The
quiet option is not used in the examples above so that you could see the actual
commands inside each usefile. Suprtool can execute commands quietly using the
Useq command:
>useq store.use {no commands are listed}
You can also combine the Use command with Info=. In the following example, we
specify the store database and execute the usefile with our Item commands:
:run suprtool.pub.robelle;parm=4; &
info="base store.db.mis,1,?;useq store.suprtool.mis"
In this example we open the database in mode-1, but the user is prompted for the
database password. In a job stream, the database password would be the first line
after ":run suprtool". We then quietly execute all the Item commands for the store
database (from the file Store.Suprtool.Mis).
Care must be taken when entering Use commands with a stacked command after a
usefile reference. For example, if you enter
use usedef;def j,1,6,byte
the Define command will not be executed until after the Usedef and any other nested
Use commands are finished.
Notes
The usefile may be an Editor /KEEP file,UNN or a Qedit workfile, but no more than
256 characters per record will be processed. For compatibility with Qedit, Useq can
be abbreviated to UQ.
If a Use file ends with an ampersand, Suprtool will assume that you are continuing
the current command on the next line, outside of the use file.
Examples
In this example, we have a usefile that displays a message and then waits for the user
before starting the task.
>q
>q "We will select all transactions over $10,000. Since"
>q "there are many transactions, this task will take"
>q "some time (usually more than fifteen minutes)."
>q
>userpause "Press any key when you are ready to start."
Parameters
More than one command can be verified at once by entering several command names
separated by a comma or a space. The format of the Verify output is organized into
columns wherever possible.
For Verify All, Suprtool prints all of the information concerning the current
invocation of Suprtool, including the value of the Set options and the Suprtool
version number.
For Verify Version, Suprtool prints out the version information.
Verify with no parameters prints the current values for Chain, Get, Input, Output,
and Key or Sort commands. It also prints those Set options which are not currently at
their default setting.
Examples
>v
>verify
>verify input {current input file}
>verify if {selection criteria}
>verify all {all current options}
>verify version {version number of Suprtool}
Notes
After the Xeq, Suprtool processes the task and accepts commands to specify another
task. Compare this with the Exit command, which stops Suprtool after processing the
input. After an Xeq command, all parameters of Suprtool are reset to their initial
values, except any database that is left open, the Set options, and the Defined fields
even though their calculated offsets are not guaranteed to be correct for the next file
processed.
Examples
>base cust
>get m-customer
>output mcstfile
>xeq {copies m-customer to Mcstfile}
>get d-customer
>output dcstfile
>xeq {copies d-customer to Dcstfile}
>exit {terminate, no task to do}
{last Xeq could have been Exit}
Order of Evaluation
Unlike most programming languages, the calculator always evaluates the calculation
from left to right. This is similar to an electronic calculator, where each keystroke is
operated on immediately. You can use parentheses to force the calculator to evaluate
the expression in a different order.
=14+16+15/3 {compute an average}
Result=15.0
=14+16+(15/3) {add 14, 16, and the result of 15/3}
Result=35.0
=14+((16+15)/3) {add 16 + 15, divide by 3, then add to 14}
Result=24.3333333333
Percentages
A number in the calculator expression may be followed by a percent sign (%). The
calculator assumes that you want to qualify the number as a percentage.
=125*5% {what is 5% of 125}
Result=6.25
=125+125*5% {add 5% of 125 to 125}
Result=12.5
=125+(125*5%) {oops, we needed to change the order}
Result=131.25 {this looks like the answer we wanted}
The last two examples show the importance of the order in which calculator
evaluates the expression. We needed to use parentheses to force calculator to
evaluate our expression in the correct order.
Display Formats
A calculator expression may be followed by a comma and a display letter. The
default is decimal (#) and the options are hex ($ or H), octal (% or O), double (D),
ASCII (A) and binary (B). With these options, the result is treated as a 32-bit integer.
In Double format, calculator prints the double result as two octal numbers (the way
they appear in DEBUG). The first number represents the high-order 16-bits and the
second number represents the low-order 16-bits.
=10,d {treat result as two 16-bit octal words}
Result=%000000 %000012
=1000000000,d {high-order 16-bits are no-zero}
Result=%035632 %145000
=-10,d {note negative value, 2's complement}
Result= %177777 %177766
In ASCII format, up to four characters are printed in Hex, Decimal, and ASCII
display format.
=$2020,a
Result=$2020: 32,32 :" "
=%20161 %72145,a
Result=$2071: 32,113:" q" $7465:116,101:"te"
In binary format, the high-order 16-bits are examined. If these bits are not zero, they
are printed as two groups of eight bits. A one (1) means that the bit is on and a zero
(0) means that the bit is off. The low-order 16-bits are always printed as two groups
of eight bits.
=10,b {high-order 16-bits suppressed}
Result=%(2)00000000 00001010
=-10,b {note negative value, 2's complement}
Result=%(2)11111111 11111111 %(2)11111111 11110110
=1000000000,b {high-order 16-bits are non-zero}
Result=%(2)00111011 10011010 %(2)11001010 00000000
Input Format
The calculator supports different input formats for numbers. Octal values are
prefixed with a percent sign (%) and hex values with a dollar sign ($). An ASCII
string of up to 4 characters is entered in quotes. The result of the last calculation is
referred to using #.
=%12 {octal 12 or decimal 10}
Result=10.0
=%12,o {octal input and octal display format}
Result=%000012
=$10
Result=16.0
=%177766 {octal number that is really negative}
Result=-10.0
="abcd",h
Result=$61626364
=#,a {use result of last calculation}
Result=$6162: 97,98 :"ab" $6364: 99,100:"cd"
Programmers who make use of the MPE DEBUG software are often frustrated with
the format that Double Integer numbers are printed. DEBUG prints them as two octal
numbers. Calculator accepts two octal numbers as input and prints the result in
standard decimal format.
Calculator Help
It may be difficult to remember all of the various options that the calculator offers.
For this reason, you can obtain a short description of the calculator by entering the
following:
=? {? gives help}
{prints a summary of = functions}
Errors
Errors are defined as conditions which immediately prevent Suprtool from
continuing, or which allow it to complete a task and then stop, because continuing
would likely cause undesirable or erroneous results.
When Suprtool detects a serious error condition such as a syntax error in a command,
a file system error, or a sort error, it prints an error message. For example,
Error: Unknown command name, try HELP
Error: Unable to open >OUTPUT file
Warnings
When Suprtool detects an unusual situation that it should bring to your attention, it
prints a nonfatal warning message. For example,
Warning: No input data specified
Warning: DATABASE must be RESTORED if System Crashes
Welcome to STExport
Welcome to STExport for MPE Version 5.4. STExport converts fields in a self-
describing input file into an output file that can be imported into different
applications.
Summary of the STExport commands:
Before FLoating Quote Verif
CLean Form REDO Xeq
Columns HEAding Reset XML
DAte HElp Set Zero
DElimiter HTML Sign =expression
DO Input Spaces :OS command
Escape LISTREDO SPaces
Exit Output Use
Installing STExport
STExport is installed as part of the Suprtool installation process. See the "Installing
Suprtool" chapter of the Suprtool User Manual for more details on how to install
both Suprtool and STExport.
Account Name
The account name for all built-in files is the same as the one where STExport is
running (e.g., if you :run stexport.Pub.Dev, the help file for STExport is
stexport.Help.Dev).
Group Name
STExport examines the group name where STExport is running to determine the
group name for the built-in file names. If the group name is Pub, STExport assumes
help files are in the Help group. The same assumption is made for any group name
where the first three letters are not Pub. When STExport is run from a group that
starts with Pub (e.g., Pub), STExport assumes the help files have the same suffix
(e.g., help).
Examples
Here are a few examples of the names that STExport would use for the STExport
help file:
STExport Program File Name STExport Help File Name
stexport.Pub.Robelle stexport.Help.Robelle
stexport.Pub.Robelle stexport.Help.Robelle
stexport.Pub.Account stexport.Help.Account
stexport.PubRob.Account stexport.HelpRob.Account
stexport.Robelle.Dist stexport.Help.Dist
After a short pause, STExport takes over your terminal and prints out some
identifying information. You will notice that your command prompt has changed to
"$", telling you that you have made it into STExport. STExport expects you to type
command lines, ending each one with Return.
If you entered the Xeq command, STExport finishes the current task, then prompts
you for another task. This continues until you enter the Exit command. If you wish to
terminate STExport immediately (perhaps you are confused), enter Exit Abort. This
terminates the STExport program immediately, without attempting any task.
Son Process
If you run STExport within Qedit or Select, you can retain the STExport process and
quickly re-activate it later.
Refer to the Export command in the Suprtool Commands chapter of the Suprtool user
manual for more information.
Values may be combined by adding them together. For example, Parm = 96 means
"check with me before exiting, then when I do actually exit, terminate STExport
completely instead of suspending".
STExportOutCount JCW
When STExport closes the output file, it sets a JCW named STExportOutCount with
the number of output records. This is the same number reported in the total line (i.e.,
OUT=). You can use this JCW to control job stream execution by checking if the
SprlinkOutCount JCW is non-zero. I there are more than 65,535 output records,
STExport sets STExportOutCount to 65,535.
You can use the :Showjcw command to see the value of a JCW. For values greater
than 16K, Showjcw displays either the word WARN, FATAL or SYSTEM followed
by some digits. These words correspond to the following values:
Add the value of the word to the number that appears with it for the true value of
STExportOutCount. For example,
:showjcw STExportoutcount
STEXPORTOUTCOUNT = WARN8616
16384 + 8616 = 25000
The MPE/iX :Showvar command can also be used to see the value of a JCW.
Showvar displays the full, correct number (e.g., 25,000) up to the maximum of
65,535.
STExport also sets two other JCWs: STExportOutCount1 and STExportOutCount2.
These communicate the full OUT= value to the STExport2 interface.
STExportFullCount Variable
On MPE/iX, when STExport closes the output file, it also sets a variable
namedSTExportFullCount with the number of output records. This is the same
number reported in the total line (i.e., OUT=). The advantage of the variable is that
if more than 65,535 records are written to the output file, the value of the
STExportFullCount variable is not truncated.
Importing Data
Use STExport to produce a formatted output file that can be used to import data into
databases and applications. Other databases have different requirements for the
format of input data. You will have to experiment with the various STExport
formatting options to find a format that your particular database tool accepts.
Input File
STExport reads one input file and formats each input record into one record in the
output file. The Input file must be a self-describing file (use the Output-Link option
in Suprtool).
Data-Types
Each STExport formatting command applies to all fields of a specific data-type (i.e.,
you cannot specify formatting field by field, only by type). For example, all numeric-
type fields can be formatted the same.
The main data-types that STExport identifies are
Byte-Type: STExport assumes that character information is stored in byte-type
fields. By default, all byte-type fields are surrounded by quotes and
trailing spaces are removed.
Numeric-Type: The numeric data-types are integer, logical, floating-point, packed,
and display. STExport converts the internal representation of each
data-type into a string of ASCII digits. By default, all numeric-type
fields have a leading sign and are variable length. Where appropriate,
numeric-type fields are converted with a decimal point.
Floating-Type: All commands that affect numeric-type fields also affect floating-type
Formatting Commands
Use the following table to determine which command applies to which data-type:
Command Data-Type
Date date-type
Floating floating-type
Quote byte-type
Sign numeric-type
Spaces byte-type
Zero numeric-type
Commands
Many of STExport's commands, such as the formatting commands above, once set
will retain their settings between tasks. Several other non-formatting commands will
also retain their settings:
Command
Columns
DElimiter
HEAding
HTML
Each command and its options will remain in effect between any STExport task,
unless specifically turned off.
For example, if a previous task has had custom Headings set with the Heading and
Heading Add options, the Headings will remain in effect for each subsequent task
until a new Heading option is entered.
Performance Considerations
On average, STExport is three-to-five times slower than Suprtool. This is the price
we pay for having all of STExport's formatting features.
You can make STExport faster by doing the following:
1. Pre-select only the records you need with Suprtool. The fewer records
STExport has to process, the faster it runs.
CI Variable Substitution
STExport is able to substitute any CI variables from any command line source,
whether through interactive, use file or batch input.
In order to use this feature, issue the following Set command:
set varsub on
Batch
Since the Streams facility (under default setups) will replace any "!" found in the first
column of a job stream. Anytime you want to specify an entire line thru Variable
Substitution you will need to leave a space before the variable is specified.
!setvar input "i dfile by message-no"
!run stexport.pub.robelle
$set varsub on
$ !input
Notes
For MPE commands some variables will be resolved twice when passed off to MPE,
which will give different values for a variable.
Setting variables at the CI level:
MPEXL:setvar x 10
MPEXL:setvar y "!!x"
MPEXL:showvar [xy]
X = 10
Y = !x
Because Stexport does one level of variable substitution prior to the command being
passed off to MPE, setting variables in Stexport that involves other variables will
give different results from MPE. We recommend that you set the variables prior to
running Stexport, or that you temporarily turn off variable substitution with the Set
Varsub Off command.
$set varsub off
$setvar a 10
$setvar b "!!a"
$showvar [ab]
A = 10
B = !a
$set varsub on
General Notes
When you run STExport, it prompts for commands on $stdlist with a "$" character
and reads command lines from $stdinx. STExport commands contain a command
name followed by one or more parameters, and are patterned after the same
commands in Suprtool.
In this chapter, we describe the STExport commands in alphabetical order.
Following each command name in brackets is the minimal abbreviation for the
command. For example: [I] for Input and [O] for Output.
Abbreviating
You may shorten the command to the first letter of the command name.
$v {verify}
$x {xeq}
Uppercase or Lowercase
You may enter the letters in either uppercase or lowercase, because STExport
upshifts everything in the command line except literal strings within quotes ("abc")
and file names. These two commands are identical:
$EXIT
$exit
STREAMX
STREAMX is a product from VESOFT that permits you to build flexible job
streams. STREAMX contains a complete programming language with loops,
prompts, and parameter substitution. A problem arises when trying to enter
comments into a Suprtool batch job that will be submitted with STREAMX. Suprtool
uses the {...} pair to delimit comments. STREAMX uses these same characters for
expressions.
You cannot change Suprtool's comment character, but you can change the {...}
characters in STREAMX. The following example shows how to change the
STREAMX expression characters from {...} to ~...~:
!job example,user.acct
::setbraces ~~
!run stexport.pub.robelle
$input invoices {Input file to format}
$floating fixed 2 {Option for floating-point numbers}
$output invdata {Produces the file we want}
$exit
!tell ~hpjobname~,~hpuser~.~hpaccount~;Example done.
!eoj
MPE Commands
STExport also accepts MPE commands, with or without a colon.
$:comment
$comment
For commands that are the same in both STExport and MPE, STExport executes the
MPE command only if you type the colon. For example:
$help {you get STExport help}
$:help {you get MPE help}
MPE/iX Commands
STExport/iX executes any MPE command (e.g., Run), UDCs, and command files.
Caution: programs that suspend, instead of terminating, are not killed by the
HPCICOMMAND intrinsic.
File Names
STExport's Input and Output commands accept a file name in either MPE or POSIX
format. File names starting with "/", "./", or "../" are treated as POSIX file names. All
other file names are assumed to be MPE file names. MPE file names are upshifted
and POSIX file names are not. POSIX file names are limited to a maximum of 240
characters. Here are some examples of POSIX file names:
Calculator
Any command line beginning with an equal sign (=) is treated as a calculator
expression. This feature can be used to do other calculations without the need of an
electronic calculator.
You can obtain a short description of the calculator by entering the following:
=? {? gives a summary of = functions}
For a detailed description of the calculator and its options, see the Suprtool manual.
Control-Y
You can interrupt a STExport task with the Control-Y key (hold down Control while
striking Y). STExport responds by telling you how far it has gotten (IN=, OUT=,
etc.), and asking if you wish to stop. Hit the Return key to continue or type YES to
stop the task.
Examples
$listf @.soruce {'source' is not spelled correctly}
NON-EXISTENT GROUP. (CIERR 908)
$Before {redo most recent command}
listf @.soruce {last command is printed}
our {you enter changes to it}
listf @.source {the edited command is shown}
{you press Return}
$listredo -10/
$before 5 {redo 5th command in stack}
$bef 8/10 {redo 8th through 10th}
$b listf {redo last Listf command}
$b listf temp {redo "listf temp" command}
$b @temp {redo last containing "temp"}
$before -2 {redo command before previous}
$before -5/-2 {redo by relative lines}
Modify Operators
If you wish to change any characters within the line, the modify operators are the
regular Control Codes used in Qedit:
• Any printing characters replace the ones above.
• Control-D plus spaces deletes columns above.
• Control-B puts you into "insert before" mode.
• Control-A starts appending characters at the end of line.
• Control-A, Control-D, plus spaces, deletes from the end.
• Control-T ends Insert Mode, allowing movement to a new column.
• Control-G recovers the original line.
• Control-O specifies "overwrite" mode (needed for spaces).
Since the Cleanchar is by default set to space, the above task could simply be:
$in mysdfile
$clean "^9","^10","^0","^7"
$out myexport
$xeq
You can also specify a range of characters with the following syntax:
$in mysdfile
$clean "^0:^10"
$out myexport
$exit
The above task would clean all byte type fields of any characters from Decimal 0
(Null) to Decimal 10. (Line Feed)
STExport will pad the field that was cleaned with the appropriate amount of
characters with a space at the end of the field.
Output File
The Columns command also affects the format of the Output file. If you specify
Columns None, the output file will have variable-length records. If you specify
Columns Fixed, the output file will have fixed-length records.
Date Format
The date-format can be one of:
• ccyymmdd
• yyyymmdd
• ddmmyyyy
• mmddyyyy
• yymmdd
• ddmmyy
• mmddyy
• aammdd
STExport converts each date field from its internal date format into the format that
you specify.
Separator Character
By default, STExport formats all dates without a separator between the day, month,
and year. Specify your own separator by enclosing it inside quotes after you specify
the date format. The separator must be one character long. For example, to specify
dates in ddmmyyyy format with a slash separator, use
$date ddmmyyyy "/"
Oracle Dates
Oracle dates contain both the date and the time. STExport formats the date, but not
the time. If you specify Date None, Oracle dates will be treated as byte-type fields.
Since Oracle dates actually contain binary data, the output is often unusable by other
applications, unless you specify a specific date-format.
STExport will produce a zero-length field if you specify Column Variable and
spaces if you specify Column Fixed. If you want to specify an explicit string for all
invalid dates, do so after the Invalid option. For example,
$date invalid "%%%%%"
will cause STExport to produce a string of five percent signs for any invalid date.
Example
First, use Suprtool to create the input file with the appropriate date attributes:
>get d-sales
>item deliv-date,date,mmddyyyy
>item purch-date,date,mmddyyyy
>output dsales,link
>xeq
Then use STExport to read the dsales file. Specify Date ddmmyyyy "-" which causes
all valid dates to be formatted in day-month-year format with a dash as the separator:
$input dsales
$date ddmmyyyy "-"
$output dexport
$xeq
String Parameter
You can put anything inside quote characters to specify your own Delimiter. For
example, Delimiter " , " would insert a space, a comma, and another space between
each field in the output record. You can use either single- or double-quote characters
to specify the delimiter (e.g., Delimiter " " and Delimiter ' ' are the same). The
maximum length of the delimiter string is three characters.
Examples
$listredo
$do {do previous command again}
$do 39 {do command line 39 again}
$do 5/8 {do command lines 5 to 8 again}
$do input {do most recent Input command}
$do -2 {do command before previous}
$do -7/-5 {do by relative line number}
$do 5/ {do command lines 5 to "last"}
Notes
The Do command cannot be abbreviated.
Persistent Redo
Redo commands can be saved in a permanent file and can therefore be used from
another session. You can use the Set redo command to specify a filename to save
your redo commands. Please see the Set Redo command for details.
(Default: None)
Many SQL importers allow you to add an escape character in front of characters that
may mean something else to the import program. For example if the import program
thinks that the delimiter character is a comma, the importer may treat a comma in an
address field as an indication to move to the next field, which will throw of the
import.
Some import programs, will treat the next character as data as opposed to a delimeter
if the character is preceded by an escape character, such as a slash. Thus when the
field is analyzed by STExport the data that originally started as:
"Niagara Falls,Ontario, Canada"
This function will not work on fixed columns and can be invoked with the escape
command:
escape delimeter quote eol "/"
The above command will take the defined delimeter, quote and Eol and escape with
a "/", if found in any byte type field.
Examples
$:comment. You began to specify an input file, stopped for
$:comment. coffee, and decided to cancel the task
$:comment. upon your return.
$input invoices
... coffee break ...
$exit abort {cancel the task and terminate}
End Of Program
Examples
:run stexport.pub.robelle
$exit {no input was specified}
:run stexport.pub.robelle
$input invoices
$floating fixed 2
$output invdata
$exit {format and stop}
Fixed Format
Use Floating Fixed to force all floating-point numbers to appear in a fixed format.
You specify the maximum number of digits to the right of the decimal point. If you
specify Floating Fixed, STExport does not remove trailing zeros from the formatted
numbers. If you specify Columns Fixed, all floating-point values will be aligned
along the decimal point.
Scientific Format
Use Floating Scientific to force all floating-point numbers to appear in scientific
notation. You must specify the number of digits to the right of the decimal point. The
Scientific option formats the number with all significant digits to the right of the
decimal-point followed by the exponent (e.g., "0.47832E-10").
Notes
Both the Fixed and Scientific options attempt to round the number to the specified
number of decimal-places within the maximum width for each floating-point data-
type. If STExport cannot format a floating-point field in the specified number of
decimal-places, the number appears as asterisks "****".
Formout File
The Form command writes all output to the file Formout. This file defaults to
$stdlist. You can redirect this file to a line printer or a disc drive. If you redirect the
Formout file to a disc file, Suprtool assumes a temporary file by default.
>:file formout;dev=lp
>form custfile {writes to line printer}
>:file formout;dev=disc
>form invfile {writes to temporary file}
Field Names
If you specify Heading Fieldnames, STExport creates a default heading. This
heading is constructed by using the field name of each field in the input file. The
Fieldname option uses the formatting options that apply to byte-type fields to
determine the final format (e.g., the Quote command).
STExport produces multiple field names for compound fields. For compound fields,
the repeat count is used to determine the number of field names. The repeat count is
appended to the field name, starting with one, until all the field names have been
generated.
Because the maximum length of an STExport input line is 256 characters, you may
not be able to specify a long heading with a single Heading command. Use Heading
Add to add additional strings to your heading:
Heading "Account" {Note no Add in first string}
Heading Add "First Name "
Heading Add "Last Name "
Heading Add "City "
Heading Add "State "
If you specify your own heading, STExport does not attempt to apply any formatting
options. If you need each field in the heading line to be surrounded by quotes and
separated by commas, you have to supply these yourself. For example,
Heading '"Account"' {Note no Add in first string}
Heading Add ','
Heading Add '"First Name"'
Heading Add ','
Heading Add '"Last Name"'
Heading Add ','
Heading Add '"City"'
Heading Add ','
Heading Add '"State"'
Column Headings
It is difficult to get headings right when you have to specify all the quotes and
delimiters with the Heading Add option. Instead, use Heading Column to specify
individual column headings without having to type formatting information.
STExport then uses the current quote and delimiter settings in the heading.
and Quote Double and Delimiter Comma are in effect, then the heading STExport
produces will be:
"Account","First Name","Last Name","City","State"
Notes
You cannot combine the Add and Column options. You must specify one or the
other. If you start with Heading Add and then later specify Heading Column,
STExport erases the heading you created with Heading Add and starts over with the
first column that you specify with Heading Column. Similarly, if you start with
Heading Column, a Heading string or Heading Add will start over with a new
heading.
Command Help
If you specify any parameters, Help first assumes that you want help on a specific
STExport command. If you know the structure of the help file, you can specify one
of the keywords under the command name.
$help sign {help on the Sign command}
$help sign,trailing {trailing section of the Sign command}
Keyword Help
If we cannot find any help in the "Commands" section of the help file, we assume
that you specified one of the outer-level keywords in the help file. To see this list of
keywords, type help with no parameters. You see a short introduction to STExport
and then a list of keywords. You can specify any of these keywords on the Help
command. You can also specify a subkeyword.
$help intro,input {input section of Introduction}
Quick Help - HQ
HQ asks STExport to look under the keyword Quick in the help file. Quick contains
the text from the STExport Quick Reference Guide, offering the experienced user a
quick review of the syntax of any command.
$hq input {quick description of Input}
Notes
If no parameters are specified, Help allows you to browse through the help file,
stexport.Help.Robelle. The Help command uses the Qhelp subsystem from the
QLIB. For "help in help", type "?" when you see the Qhelp prompt character ("?").
The help file is organized into levels. To go back to the previous level, press Return.
Press F8 to exit the Qhelp subsystem and return to STExport.
Example
$html table title "Product Listing"
Preformatted Format
To preserve the columns and spacing of each output line, use the HTML
Preformatted option. This option puts an HTML <pre> tag around all the data in the
input file. Most Web browsers will display preformatted text in a fixed-width font
such as Courier. Therefore, if you specify HTML Preformatted, you should also
select Columns Fixed.
Table Format
Use HTML Table to create output in HTML table format. STExport creates tables
with a border between each column and row. Tables make it easier to read tabular
information, but some older browsers do not support tables.
If you specify HTML Table, all byte-type fields are left-justified and all other fields
are right-justified. If you use Heading Column or Fieldnames, the column headings
are specified with HTML table heading tags. Most browsers highlight the column
headings in some way, such as bold text centered over the column.
Title
All HTML documents must have a title. By default, STExport uses the title "This is
the Title". You should specify your own title using the Title option.
Heading
The heading appears before the column headings and data from your input file. By
default, there is no heading. Use the Heading option to specify your own heading.
Roman-8 Characters
HP e3000 and HP 9000 computers use the Roman-8 character set. Web pages must
use the ISO-8859-1 character set. The characters in the Roman-8 set are similar to,
but not identical with, the ISO-8859-1 character set.
When formatting byte-type fields, STExport attempts to convert any Roman-8 input
character into the corresponding ISO-8859-1 character. STExport also tries to make
reasonable conversions such as:
Symbol Converted To
> >
< <
& &
Those characters that cannot be converted are dropped from the output. The
following characters cannot be converted:
Symbol Roman-8 value name
` 169 grave mark
^ 170 circumflex
~ 172 tilde
ƒ 190 function symbol
ß 222 beta symbol
Š 235 capital-S, Icelandic
š 236 small-S, Icelandic
Ÿ 238 capital-Y, umlaut
Notes
If you specify HTML Table, STExport sets:
• Quotes None
• Delimiters None
If you specify HTML Preformatted, STExport sets:
• Quotes None
• Delimiters Space
• Columns None
In either case, any changes cause STExport to print a warning to let you know that
these options have changed. If you do want quotes around byte-type fields or
delimiters between fields, specify those options after selecting the HTML option.
Examples
$listredo 5
$listredo 5/10
$listredo help {print all Help commands}
$listredo -10 {print last ten commands}
$listredo ALL {print entire redo stack}
$listredo @;rel {print ALL, relative numbers}
$listredo purge {print all Purge commands}
$listredo purge xx {print all "purge xx" commands}
$listredo @purge {print all with "purge" anywhere}
$listredo 1/10;out=*lp {dump commands to printer}
$listredo @;unn;out=save {write commands to a file}
Notes
The Listredo command cannot be abbreviated, but BJ and ,, (comma comma) are
accepted as a short forms.
Persistent Redo
Redo commands can be saved in a permanent file and can therefore be used from
another session. You can use the Set redo command to specify a filename to save
your redo commands. Please see the Set Redo command for details.
File Equations
STExport allows the use of file equations to help ensure a file is built with the
attributes that you require in the output file.
One example of this is when you are generating HTML output and want to use it
with the Apache Web server on MPE. The Web server needs the files to be
bytestream files.
One caveat for this technique with bytestream files is that you have to specify a disc
value greater than or equal to the total number of bytes that will be written to the file,
because by definition a bytestream file has a record size of only one byte. An
example of this technique is as follows:
:file x=myhtml;rec=,,b;disc=100000
$in mysdfile
$html table title "My Web Page"
$out *x
$exit
Stdlist
If the output file name is *, each output record is written to stdlist. This is useful for
trying out different formatting combinations until you find the one that best fits the
application that you want to import data into. For example,
$input sdfile
$output *
$xeq
$floating fixed 2 {change one option}
$input sdfile
$output *
$xeq {view the result}
$sign none {change a different option}
$input sdfile
$output *
$xeq {and so on}
and Quote Single had been specified, then the output would be:
'customer s'
Examples
$listf @.soruce {'source' is not spelled right}
NON-EXISTENT GROUP. (CIERR 908)
$redo {redo most recent command}
listf @.soruce {last command is printed}
our {you enter changes to it}
listf @.source {edited command is shown}
{you press <return> }
$listredo all
$redo 5 {redo 5th command in stack}
$redo {redo previous command}
$redo -2 {redo command before previous}
$redo 8/10 {redo 8th through 10th}
$redo -10/ {redo -10 through last}
$redo purge {redo last Purge command}
$redo purge temp {redo last "purge temp"}
$redo @temp {redo last containing "temp"}
Notes
The Redo command cannot be abbreviated.
To save more commands, use a :File command on the file Stexredo before you run
STExport:
file stexredo;disc=5000
run stexport.pub.robelle
CleanChar
SET CleanChar <string>
(Initially: set to space)
Sets what character is used to replace a Clean character. If you just want to clean the
fields and replace the “bad” character with no character then you need to set the
CleanChar in the following manner:
>Set CleanChar “<null>”
Mapped
SET MAPPED ON | OFF
(Initially: OFF)
Mapped forces STExport/iX to read the input file using mapped file access.
Specifying this option is an error in STExport/V. If the input is not in memory, the
wall time performance is worse with Set Mapped On, but CPU time performance is
better. You must Set Mapped On before specifying the input file.
Redo
SET REDO filename
(Initially: unnamed temporary file)
Commands entered at the STExport prompt are saved in something called the redo
stack. You can recall commands from the redo stack by using other commands such
as Before, Do and Redo. By default, the redo stack is stored in a temporary file and
If the file does not exist, STExport creates it. Otherwise, STExport uses the existing
file. All subsequent commands are written to the persistent redo stack. The setting is
valid for the duration of the STExport session. As soon as you exit STExport, the
setting is discarded. Next time you run STExport, you will get the temporary stack.
If the file name is not qualified, the redo stack is created in the logon group and
account. This may be desirable if you want to have separate stacks. If you want to
always use the same persistent stacks, you should qualify the name.
The Verify command shows which stack is currently in use. If it shows
<temporary>, then STExport is using the default stack. Anything else is the name of
the file used on the Set Redo command.
Concurrency
When STExport uses the default temporary stack, it is only accessible to that
particular instance of STExport. You can run as many STExport instances as you
need and each one gets its own redo stack. With temporary stacks you will never get
into concurrency problems.
If you start using a persistent redo stack, however, you might start running into
concurrency problems. A persistent redo stack can only be used by one STExport
instance at a time. If you try to use a persistent redo stack that is already in use, you
will get the following message:
$Set Redo Myredo
EXCLUSIVE VIOLATION: FILE BEING ACCESSED (FSERR 90)
Unable to open file for REDO stack
In this situation, STExport continues to use the redo stack active at the time and lets
you continue working as normal.
Qedit can also have permanent redo stacks. To prevent products from writing to each
other's redo stack, it is advisable to have separate stacks for each product by giving
them different file names. For example, if you use the command
set redo myredo
you will have a redo stack called Myredo for your STExport commands. If you exit
STExport, then run Qedit and supply the same command Set Redo command, your
Qedit commands will be written to the same file that was used for your STExport
commands.
Statistics
SET STATISTICS ON | OFF
(Initially: OFF)
Statistics causes STExport to print statistics at the end of each task.
VarsubDebug
SET VARSUBDEBUG ON | OFF
(Initially: OFF)
Suprtool, now has a setting called Set VarsubDebug on which will print out the line
after the variable substitution has occurred. This setting only works if Set Varsub is
on and Set VarsubDebug is on.
The output is formatted into 74 byte chunks and printed with a preceding “vd:” so
the “substituted” line is clear.
Warnings
SET WARNINGS OFF
(Initially: ON)
Suprtool normally prints warning messages out to $stdlist. You can turn off these
messages when you are running from batch by issuing a Set Warnings off command.
If you are simulating batch mode with the Set Interactive Off command, you must do
the Set Warnings off after the Set Interactive Off.
The default for this setting is On.
Xmltagchar
SET XMLTAGCHAR "." | "-" |"_"
(Initially: ".")
In XML the tags that surrounded the data can not have any special characters other
than hyphen, underscore and period ("-","_", "."). So STExport replaces any of the
STExport will only allow the hyphen, underscore and period to be set with this
command.
ZonedFix
SET ZONEDFIX OFF
(Initially: OFF)
Set ZonedFix has been added to fix a zoned field that when converted to byte, results
in "?", meaning that the source field has some characters that were not expected in a
Zoned field. If Set ZonedFix is On STExport zeroes out the field after an attempted
conversion of the field yields characters that cannot be converted.
The default for this setting is Off.
Trailing Sign
Specify Sign Trailing to cause the sign character to appear after each formatted
number. Remember that for many numeric-types the sign for positive numbers is a
space. STExport always leaves room for the sign, even if it is a space.
Examples
A usefile makes your task easier by allowing common commands to be specified
once in an external file. For example, the following usefile contains all the
commands for creating the Invcust file:
$use invuse
input invoices {input file to format}
floating fixed 2 {formatting option}
output invdata {produces the file we want}
exit
STExport prints the lines in the usefile, including the comment lines. This allows you
to include instructions and reminders in the usefile. In the example above, there were
no commands for the user to enter.
Notes
Usefiles cannot be nested in STExport. The usefile may be any unnumbered text file
or a Qedit workfile, but no more than 256 characters per record are processed.
By default, STExport displays the commands in a usefile as they are executed.
STExport can execute commands quietly using the Useq command. For
compatibility with Qedit, Useq can be abbreviated to UQ.
Example
STExport can generate "well-formed" XML output with just a few commands.
$input file1sd
$xml
$output myxml
$xeq
These four simple commands will generate the following file that packages such as
XMLSpy will consider to be "well-formed" XML. The result of such an STExport
task will look as follows:
<?xml version='1.0'?>
<file>
<record>
<CITY>Los Altos</CITY>
<CREDIT-RATING>100000</CREDIT-RATING>
<CUST-ACCOUNT>4003302</CUST-ACCOUNT>
<CUST-STATUS>20</CUST-STATUS>
<NAME-FIRST>Ralph</NAME-FIRST>
<NAME-LAST>Perkins</NAME-LAST>
<STATE-CODE>CA</STATE-CODE>
<STREET-ADDRESS>Room 655</STREET-ADDRESS>
<STREET-ADDRESS>Los Altos 040033022</STREET-ADDRESS>
<ZIP-CODE>93002</ZIP-CODE>
</record>
</file>
Notes
By default STExport will add the simplest version tag at thebeginning of the file,
then it inserts a <file> and matching </file> at the beginning and the end of the file.
Then STExport encloses each record from the input file in a <record> and </record>
tag. Finally, the Self-Describing tags are added around each field's data values and
edited appropriately.
Naturally users would want options to customize and specify the various options and
tags themselves, in order to generate a file that is acceptable to their tools.
Version
You can specify the "version" tag at the beginning of the XML file with the
following command:
xml version "?xml version='1.0' encoding='ISO-8859-1'?"
STExport will put the "<" and ">" around what is specified in the version string.
This will write the doctype specification at the top of the output file, directly after the
XML version specification.
More complicated and lengthy doctype specifications can be implemented by using
the filename option, whereby STExport will append the contents of a named file
directly after the version specification. The syntax can be simply:
xml doctype myfile.xml
File
You can customize the "file" tags with the following command commands:
xml file "orders"
STExport will put the "<" and ">" around what is specified in the File string.
Record
You can customize the "record" tags with the following command commands:
xml record "Details"
STExport will put the "<" and ">" around what is specified in the Record string.
Example
You can enter multiple XML commands per task to set the XML options you
require.
$in file1sd
$xml version "?xml version='1.0' encoding='ISO-8859-1'?"
$xml file "Orders" record "Details"
$out myfile
Tags
In XML the tags that surrounded the data can not have any special characters other
than hyphen, underscore and period ("-","_", "."). So STExport replaces any of the
invalid special characters with a "." by default.
You can change the default character to be something else with the following set
command:
$Set xmltagchar "_"
STExport will only allow the hyphen, underscore and period to be set with this
command.
Quotes
All of STExport's XML command options (version, doctype, file and record) allow
for a string to be passed via surrounding quotes. The quotes may be either single or
double, but keep in mind that if the string is to contain double quotes, then you
should surround the entire string with single quotes.
Example
In this example we show you how to use Suprtool and STExport. We start with an
IMAGE/SQL dataset, identify the fields that are dates and the number of implied
decimal places in other fields. We then produce a self-describing file using the
dataset as input and show the default output from STExport.
We also show you how easy it is to migrate data from MPE files and databases to an
Oracle database.
The Form command displays the fields in a dataset or a self-describing file. For files,
this information is stored in the user labels of an MPE file and is not accessible with
other tools. Use the Form command to obtain the record layout of STExport input
files.
Sales File
We will be formatting data from an IMAGE/SQL sales dataset that has the following
form:
>form d-sales
Database: STORE.DEMO.ROBELLE
Salefile
We now produce a file called "salefile" using Suprtool's Output,Link option. The
Link option produces a self-describing file, complete with the date and decimal-place
information:
>get d-sales
>output salefile,link
>xeq
>form salefile
Notice how the Form command correctly identifies which fields are dates and which
fields have implied decimal places. STExport uses this information to format the file.
STExport Output
We then use STExport to read the self-describing Salefile to produce our sample
output on stdlist. To demonstrate how dates are handled, we insert a separator in
each date field:
:run stexport.pub.robelle
$input salefile {self-describing input file}
$date yyyymmdd "-" {dates with a dash separator}
$output * {output to stdlist}
$xeq
10020,1993-10-05,50511501,98.31,1993-10-01,0.02,27.53,224.15
10003,1993-10-15,50511501,98.31,1993-10-15,0.01,13.76,112.07
10003,1993-10-15,50512501,145.62,1993-10-15,0.01,20.39,166.00
10003,1993-10-15,50513001,192.20,1993-10-15,0.01,26.91,219.10
10016,1993-10-21,50521001,24.59,1993-10-21,0.03,10.33,84.11
10016,1993-10-21,50532001,139.85,1993-10-21,0.01,19.58,159.42
There are no byte-type fields in the input file, so all fields are converted from their
internal numeric representation to a string of digits. All date fields were converted
from their internal yyyymmdd format to the external yyyymmdd format with a dash
separator between day, month, and year. All fields with implied decimal places have
been converted with a decimal point.
The username and password are valid Oracle connect information. SQL*Loader
reads the load specifications from the file specified in the control keyword. It writes
operation information and statistics to the file specified in the log keyword. It also
creates a number of files to report data problems etc. SQL*Loader has many other
Maximums
To achieve maximum speed, STExport/V stores all the necessary information in the
HP e3000 stack. This limits the size of input and output records and restricts the
number of fields per file. Users should be aware of these limits before attempting to
use STExport with extremely complicated databases. STExport/iX stores information
in a simulated HP e3000 stack, so all the limits apply to both STExport/V and
STExport/iX.
Introduction
Welcome to version 5.4 of Dbedit for MPE, a module of Suprtool that permits
people to add, change, list, or delete individual records or "chains" of records from
an IMAGE/3000 database. Dbedit is useful for debugging applications, for quickly
prototyping systems, and for the data entry of simple applications.
The functions of Dbedit are similar to QUERY, but the commands and operations
are more consistent and logical. Because Dbedit is a part of Suprtool, you can hold
Suprtool as a suspended process from within other software (e.g., Qedit) with the
database open. This facilitates fast process switching when you need to examine a
test database.
You enter Dbedit via the Edit command of Suprtool. Once in Dbedit, you cannot use
the Suprtool commands (while in Suprtool you cannot use the Dbedit commands).
Certain commands are the same in both Dbedit and Suprtool (e.g., Use, Before, and
Set). The Before command works independently and each software module saves its
own last command.
Restrictions
1. Most Dbedit commands require you to have opened the database using
the Base command of Suprtool. Dbedit does not have a Base command.
2. Dbedit does not work with any files other than IMAGE/3000 datasets.
3. You cannot switch to another database while in Dbedit. Instead, you
must Exit, do a Base command in Suprtool, then Edit.
4. The maximum size of any individual data item is 80 bytes (i.e., 5X80 is
acceptable, but X100 is not).
5. Only datasets whose search fields are compatible with Dbedit can be
accessed (i.e., no K5 search fields).
Functions of Dbedit
There are five major functions in Dbedit:
Command Function
Performance of Dbedit
Suprtool was designed to be as fast as possible, while Dbedit was designed to have
as many features as possible. Dbedit does no special optimizations. It uses the
standard IMAGE intrinsics to do all of the accesses to the database. Dbedit does not
use the fast sequential access method of Suprtool, but Dbedit usually works only
with a few records within your database at one time.
Field Lists
Dbedit arranges the list of fields in a dataset different from QUERY or Suprtool. The
QUERY ADD command prompts for the each field in the dataset in the order they
were declared in the IMAGE schema. In Dbedit, the order of field lists is changed
using the following algorithm:
1. The search field for a master dataset or the primary search field for a
detail dataset appears first.
2. Any other detail search fields appear second.
3. Any sort fields appear third.
4. All other non-search and non-sort fields that are compatible with
Dbedit appear last.
5. Where a non-compatible field would appear in a list, Dbedit replaces it
with a compatible field from the end of the list.
Example:
The following example shows the difference between QUERY and Dbedit. We add
an entry to the d-inventory dataset of the Store database. In this dataset, supplier-
name is the primary search field and product-no is another nonprimary search field.
QUERY/3000
>add d-inventory
BIN-NO =>>1201
LAST-SHIP-DATE =>>
OH-HAND-QTY =>>
PRODUCT-NO =>>2001001
SUPPLIER-NAME =>>STD Ribbons
UNIT-COST =>>
DBEDIT/SUPRTOOL
Database Locking
Dbedit uses the following locking strategy. The Add command locks one dataset
(using DBLOCK, mode-3) after all of the field values have been entered. The
Modify and Delete commands do the following:
1. After all of the field values have been entered, the dataset is locked.
2. The records are re-read using DBGET, mode-4 for details or DBGET,
mode-7 for masters.
3. The re-read record is compared with the original record. If they are not
the same, no update or delete is done.
4. The record is updated or deleted. When a search field or a sort field is
changed with the Modify command, the record is deleted and added
again.
5. The dataset is unlocked.
The Change command locks the entire database while all key values are being
changed. In all cases, the DBLOCK is done unconditionally. This means that Dbedit
always waits for other locks to be released (possibly holding up your terminal).
Decimal Points
If you use Suprtool's Item command to specify implied decimal places for an item,
Dbedit scales all input values according to the number of implied decimal places.
When listing records, fields with implied decimal places are formatted with a
decimal point. For example,
>item unit-cost,decimal,2 {two implied decimal pts.}
>edit
#add d-inventory:unit-cost
SUPPLIER-NAME >STD Ribbons
PRODUCT-NO >2001001
UNIT-COST >10.50
SUPPLIER-NO = 5051
PRODUCT-NO = 50513001
UNIT-COST = 10.50
Type ? to get a description of When Dbedit prompts for field values, you can type a question mark to obtain a
the field. description of the field. If the field has implied decimal places, the field description
will include the number of decimal places (e.g., << .2 >> for two implied decimal
points).
Critical-Item Update
Starting with MPE/iX 4.0, IMAGE was enhanced to have a new feature: critical-item
update. This feature allows programs to change critical fields in detail datasets
General Notes
When you run Dbedit, it prompts for commands on Stdlist with a "#" character and
reads command lines from Stdin. Dbedit commands have a command name followed
by one or more parameters separated by semicolons, colons, and commas.
Semicolons are NOT used to combine several commands on the same line as in
Suprtool.
This chapter describes the Dbedit commands in detail. The commands are presented
in alphabetical order. Each command name is followed by the minimal abbreviation
for the command, in brackets. For example: [F] for File and [FO] for Form.
Abbreviating
You may shorten command names to any substring that uniquely defines the
command. For example, Add can be shortened to AD or A, since there are no other
commands that start with "A". Form, however, can be abbreviated only to FO, since
there is a File command, abbreviated F, in Dbedit.
>base store.pub,5
>edit
#l m-customer;all {list}
#e {exit}
Uppercase or Lowercase
You may enter letters in either uppercase or lowercase, because Dbedit upshifts
everything in the command line. These two commands are identical:
#LIST M-CUSTOMER
#list m-customer
Continuation
The maximum physical command line is 256 characters. You may enter commands
on multiple input lines by putting an "&" continuation character at the end of the
line. The maximum total command length is 256 characters. Multiple commands
cannot be placed on one input line. The separating semicolon, colon, or comma in
commands is REQUIRED, not optional.
Control-Y
If you press Control-Y during an operation, Dbedit responds by printing a blank line
and stopping the current operation.
If you want to include a brace as part of an x-type field, you must precede the brace
with the Dbedit escape character "[". For example, to search for the supplier "{STD
Ribbons}", you would use:
#list m-supplier {include braces in the name}
SUPPLIER-NAME >[{STD Ribbons}
MPE Commands
Dbedit interprets any command line beginning with a colon (:) as an MPE command.
Only the commands that MPE allows in "break" are allowed in Dbedit. This feature
can be used to establish :File commands for the SUPRLIST file, to show the time,
and to include :COMMENT lines. For example:
#:comment Modify M-CUSTOMER records
#modify m-customer
#exit
MPE/iX Commands
Dbedit/iX will execute any MPE command (e.g., Run), UDCs, and command files.
Caution: programs that suspend, instead of terminating are not killed by the
HPCICOMMAND intrinsic.
Calculator
Any command line beginning with an equal sign (=) is treated as a calculator
expression. You may use this feature to compute data entry values without the need
of an electronic calculator.
Example Database
The examples in this manual use the revised STORE database described in the
IMAGE/3000 Handbook.
Command Parameters
The major commands (File, List, Add, Delete, Modify, and Change) have a similar
parameter structure, consisting of the command name, then an optional file part and
an optional option part. A space separates the file part from the command name, and
a semicolon separates the option part from the file part. The general format of these
commands is
#command [file] [;options]
File Parameter
The file parameter consists of an IMAGE/3000 dataset name followed by an optional
list of field names. If the file part is missing, Dbedit uses the previous file. The
general format of the file parameter is
#command [file] [:fieldname,...]
Even when you use field names, Dbedit will add the search fields to the field list. In
the Add command, Dbedit assumes default values for noncritical fields that are
missing, but will prompt for the search fields and sort fields (they are required).
#add d-inventory:bin-no {assume defaults for all but BIN-NO}
SUPPLIER-NAME >STD Ribbons
PRODUCT-NO >105391
BIN-NO >10
In this case you will not be prompted for BIN-NO, ON-HAND-QTY, or LAST-
SHIP-DATE.
When working on a single dataset, it is only necessary to specify the dataset name in
the first command. For example:
#list d-inventory
SUPPLIER-NAME >STD Ribbons
SUPPLIER-NAME >//
Option Parameter
The file parameter and the options must be separated by a semicolon.
#command [file] [;option...]
The available options are:
numeric-value, All, Key, Limit, Related, UNder, UPdatekey
These options qualify the operation of the File, List, Modify, Change, Delete, and
Add commands. Some options only apply to one command. Options can be
combined and can be abbreviated. When more than one option is specified, each
option must be separated by a semicolon.
#list d-inventory;key=product-no;under
PRODUCT-NO >
Numeric-Value Option
Commands normally cycle, prompting for new search values or new entries, until
you press Return or Control-Y. However, if you specify a numeric-value after the
semicolon, the command only prompts you numeric-value number of times. For
example, if you only want to do one List function, you would enter:
#list d-inventory;1 {only prompt for SUPPLIER-NAME once}
All Option
The All option works only with the List, Modify, or Delete commands. When All is
specified, every record in the specified file is processed sequentially. You can stop
the scan by pressing Control-Y.
Key Option
The Key option overrides the primary search field. Dbedit prompts for the primary
search field first. Often, this is not the value that you know. You can use the Key
option to force Dbedit to prompt you for another search field. For example:
PRODUCT-NO >105391
SUPPLIER-NAME >
Limit Option
The Limit option controls the number of entries allowed per key value. This option is
only useful for the Add command. Dbedit limits the number of entries for the first
field in the field list to the Limit value specified. For example,
#add d-inventory;limit=2 {two records per supplier}
#add d-inventory;limit=2;key=product-no
{two records per product}
Related Option
The Related option is for finding or deleting related records. It applies only to Delete
and List. If you use Related when Listing an entry in a master dataset, Dbedit prints
the specified master entry and then prints all detail entries with the same search value
in all datasets that are linked to the master dataset by an explicit path. If you use List
Related with a detail dataset, Dbedit prints the specified detail entry, followed by the
master entry for each search field in the detail.
You can only Delete Related from a master dataset. Dbedit shows the master entry.
After confirming the deletion, Dbedit deletes all entries with the same search value
in all related datasets. Control-Y can be used to interrupt the deletion process.
Dbedit can only use explicitly defined IMAGE paths to navigate between datasets.
User-defined paths are not supported in Dbedit. When listing related records, Dbedit
shows all fields in each dataset including those that Dbedit normally doesn't support
(e.g., X100). The following example shows how related records are listed, starting
with a master dataset and then its related detail datasets.
#list m-supplier;related {all related records}
SUPPLIER-NAME >STD Ribbons
Under Option
When Dbedit prompts for a value for a field, it prints a series of underlines. These
underlines indicate the maximum field width.
These underlines can be useful, but they may not work on all terminals. You can
disable underlining by using Set Underline Off. Once underlining is turned off, you
may wish to enable it again, but only for one command. The Under option overrides
the Set Underline, but only for the current command.
Subcommands
You may enter a subcommand any time Dbedit prompts for the value of a field. The
available subcommands are:
Subcommand Purpose
// stops the current command immediately.
\\ same as // (you may also use the Control-Y key).
? describes the current field, including any implied decimal points.
< goes back one field to the previous field in the list.
<3 goes back three fields.
<< returns to the first field in the list.
> goes forward one field to the next field in the list.
>3 goes forward three fields.
>> skips the rest of the fields in the list. This is especially useful when
Dbedit is prompting you for multiple search and sort fields and you
only want to enter the first.
' uses blanks for the field (useful in batch).
* uses the last value for this field.
[ forces what follows the [ to be a value and not a subcommand (e.g.,
[*BOB tells Dbedit to use *BOB as the actual value instead of
interpreting the * to mean "last value").
@F search for the field F (e.g., @bin-no). The field can include a
subscript (e.g., @street-address(2)).
= calculator.
#list m-supplier
#modify d-inventory
#modify m-customer
CUST-ACCOUNT >4003302
CITY >@street-address(2) {go to subfield}
STREET-ADDRESS(2) >
Examples
#listf @.soruce {'source' is not spelled right}
NON-EXISTENT GROUP. (CIERR 908)
#Before {redo most recent command}
listf @.soruce {last command is printed}
our {you enter changes to it}
listf @.source {the edited command is shown}
{you press <return> }
#listredo -10/
#before 5 {redo 5th command in stack}
#bef 8/10 {redo 8th through 10th}
#b listf {redo last Listf command}
#b @temp {redo last containing "temp"}
#before -2 {redo command before previous}
#before -5/-2 {redo by relative lines}
Modify Operators
If you wish to change any characters within the line, the modify operators are the
regular Control Codes used in Qedit:
• Any printing characters replace the ones above.
• Control-D plus spaces deletes columns above.
• Control-B puts you into "insert before" mode.
• Control-A starts appending characters at the end of line.
• Control-A, Control-D, plus spaces, deletes from the end.
• Control-T ends Insert Mode, allowing movement to a new column.
• Control-G recovers the original line.
• Control-O specifies "overwrite" mode (needed for spaces).
Example
#change m-supplier
Change Key Value for File: M-SUPPLIER
Examples
#listredo
#do {do previous command again}
#do 39 {do command line 39 again}
#do 5/8 {do command lines 5 to 8 again}
#do list {do most recent List command}
#do show {do last starting with "show"}
#do showjob job {do last "showjob job" command}
#do @job {do last containing "job"}
#do -2 {do command before previous}
#do -7/-5 {do by relative line number}
#do 5/ {do command lines 5 to "last"}
Notes
The Do command cannot be abbreviated.
will cause all subsequent commands to prompt for the PRODUCT-NO before the
SUPPLIER-NAME. Specifying a new file or options parameter in the Add, Change,
Delete, List, or Modify commands overrides and replaces the current file and option
values.
Example
>base store,5
>item last-ship-date,date ,yymmdd
>item unit-cost ,decimal,2
>edit {enter Dbedit}
#form d-inventory
D-INVENTORY Detail
Entry:
BIN-NO J1 1
LAST-SHIP-DATE J2 3 <<YYMMDD>>
ON-HAND-QTY J2 7
PRODUCT-NO Z8 11 (M-PRODUCT)
SUPPLIER-NAME X16 19 (!M-SUPPLIER)
UNIT-COST P8 35 << .2 >>
Capacity: 112 Entries: 3 Entry Length: 19 Blocking: 14
Formout File
The Form command writes all output to the file Formout. This file defaults to
$stdlist. You can redirect this file to a line printer or a disc drive. If you redirect the
Formout file to a disc file, Suprtool assumes a temporary file by default.
>:file formout;dev=lp
>form sets {writes to line printer}
>:file formout;dev=disc
>form d-inventory {writes to temporary file}
Form Keywords
The Form command shows Items, Paths, and Sets before searching for a dataset or
file with these names. Use a string (e.g., "sets") to display the form of a dataset or
file that matches one of the Form keywords.
>form "paths"
Command Help
If you specify any parameters, Help first assumes that you want help on a specific
Dbedit command. If you know the structure of the help file, you can specify one of
the keywords under the command name.
#help list {Help on the List command}
#help list,notes {notes section of the List command}
Keyword Help
If no help is found in the Commands section of the help file, we assume you
specified one of the outer-level keywords. To see this list of keywords, type help
with no parameters. You'll see a short introduction to Dbedit before the list. Specify
any of the keywords, or a subkeyword, on the Help command.
#help intro {introduction section}
Quick Help - HQ
HQ asks Dbedit to look under the keyword QUICK in the help file. QUICK contains
the text from the Dbedit Quick Reference Guide, offering the experienced user a
quick review of the syntax of any command.
#hq add {quick description of Add}
#hq commands {quick list of command names}
Notes
If no parameters are specified, Help allows you to browse through the "help" file.
The Help command uses the QHELP subsystem to enable you to move through the
file Dbedit.Help.Robelle, which contains most of the User Manual. For "help in
help", type "?" when you see the QHELP prompt character ("?"). The help file is
organized into levels. To go back to the previous level, press Return instead of a key
name. If you press F8, you will exit the QHELP subsystem and return to Dbedit.
CUST-ACCOUNT >4003302
Examples
#listredo 5
#listredo 5/10
#listredo help {print all Help commands}
#listredo -10 {print last ten commands}
#listredo ALL {print entire redo stack}
#listredo purge {print all Purge commands}
#listredo purge xx {print all "purge xx" commands}
#listredo @purge {print all with "purge" anywhere}
#listredo @;rel {print ALL, relative numbers}
#listredo 1/10;out=*lp {dump commands to printer}
#listredo @;unn;out=save {write commands to a file}
Notes
The Listredo command cannot be abbreviated, but BJ is accepted as a short form.
CUST-ACCOUNT >4003302
CUST-ACCOUNT =4003302
CREDIT-RATING =1000.00
2500.00
CUST-ACCOUNT = 4003302 CREDIT-RATING = 2500.00
Examples
#listf @.soruce {"source" is not spelled correctly}
NON-EXISTENT GROUP. (CIERR 908)
#redo {redo most recent command}
listf @.soruce {last command is printed}
our {you enter changes to it}
listf @.source {edited command is shown}
{you press <return> }
#listredo all
#redo 5 {redo 5th command in stack}
#redo {redo previous command}
#redo -2 {redo command before previous}
#redo 8/10 {redo 8th through 10th}
#redo -10/ {redo -10 through last}
#redo purge {redo last Purge command}
#redo @temp {redo last containing "temp"}
LP
SET LP ON|OFF
(Initially: OFF)
All output from the List command is normally sent to $stdlist. When you turn Set LP
to On, Dbedit opens the file Suprlist which defaults to the line printer. Turning Set
LP Off closes the SUPRLIST file and releases it to the spooler. Dbedit automatically
closes the Suprlist file when you return to Suprtool.
Prompt
SET PROMPT char
(Initially: #)
Prompt tells Dbedit to use a different character for prompting. Any special character
can be used as the prompt character. For example:
>edit
#set prompt %
%list m-customer
Quiet
SET QUIET ON|OFF
(Initially: OFF)
Turning this option On causes Dbedit to reduce the number of helpful messages that
are printed and to shorten other messages.
Reset
SET RESET ON|OFF
(Initially: ON)
When you use the File, List, Modify, Change, or Delete commands you may override
the default order that Dbedit uses to prompt for search fields (using the KEY=
option). With Reset On, Dbedit always resets the KEY= option to the default. With
Reset Off, Dbedit will continue to use the new order of search fields.
Verify
SET VERIFY ON|OFF
(Initially: ON)
When you are adding new records to a dataset, Dbedit lists the contents of new
records after you have entered all of the field values. Turning Verify Off causes
Dbedit to stop listing new records after they are added.
Examples
A usefile makes your task easier by allowing common commands to be specified
once in an external file. Usefiles can also be set up for data entry functions such as
adding a new customer into the database (e.g., add one master entry, add one billto
entry, add multiple shipto entries, and then list the master entry plus RELATED
details). For example, here is a usefile that uses the File command to define a dataset:
file d-inventory;key=product-no;5 {key and limit}
q You may use the List, Modify, or Delete
q commands to modify inventory records. You
q are restricted to at most five inventory
q records per product number.
Quiet Execution
By default, Dbedit displays the commands in the usefile as they are executed. Dbedit
can execute commands quietly using the Useq command:
#useq store.use {no commands are listed}
Notes
Usefiles cannot be nested in Dbedit. The usefile may be an EDITOR /KEEP
file,UNN or a Qedit workfile, but no more than 256 characters per record will be
processed. For compatibility with Qedit, Useq can be abbreviated to UQ.
Examples
#verify dset {current dataset}
#verify all {print the status of everything}
Welcome to Suprlink
Welcome to Suprlink for MPE Version 5.4. Suprlink is a program that works with
Suprtool to add "multidataset" capability to Suprtool. Rather than take the regular
path to multiple datasets -- random retrieval via IMAGE keys -- with its well-known
performance problems, we have chosen to follow a different path: fast serial extracts
plus a very efficient merge.
Summary of the Suprlink commands:
Before Input Redo Xeq
Do Join Reset =expression
Exit Link Set :MPE Command
Form LISTREDO Use
Help Output Verify
Installing Suprlink
Suprlink is installed as part of the Suprtool installation process. See the "Installing
Suprtool" chapter of the Suprtool User Manual for more details of how to install
both Suprtool and Suprlink.
Group Name
Suprlink examines the group name where Suprlink is running to determine the group
name for the built-in file names. If the group name is PUB, Suprlink assumes help
files are in the HELP group. The same assumption is made for any group name
where the first three letters are not PUB. When Suprlink is run from a group that
starts with Pub (e.g., Pub), Suprlink assumes the help files have the same suffix (e.g.,
Helpnew).
Examples
Here are a few examples of the names that Suprlink would use for the Suprlink help
file:
Suprlink Program File Name Suprlink Help File Name
Suprlink.Pub.Robelle Suprlink.Help.Robelle
Suprlink.Pub.Account Suprlink.Help.Account
Suprlink.PubRob.Account Suprlink.HelpRob.Account
Suprlink.Robelle.Dist Suprlink.Help.Dist
After a short pause, Suprlink will take over your terminal and print out some
identifying information. You will notice that your command prompt has changed to
"+", telling you that you have made it into Suprlink. Suprlink expects you to type
command lines, ending each one with Return.
If you entered the Xeq command, Suprlink will finish the current task, then prompt
you for another task. This continues until you enter the Exit command. If you wish to
terminate Suprlink immediately (perhaps you are confused), enter Exit Abort. This
will terminate the Suprlink program immediately, without attempting any task.
Son Process
If you RUN Suprlink within Qedit or Select, you can retain the Suprlink process and
re-activate quickly later.
Refer to the Link command in the "Suprtool Commands" chapter of the Suprtool
user manual for more information.
You can also use the Suprtool2 interface and the Link command to "call" Suprlink.
See the Suprcall User Manual for a complete example of how to use the interface to
pass commands to Suprlink.
Values may be combined by adding them together. For example, Parm = 96 means
"check with me before exiting, then when I do actually exit, terminate Suprlink
completely instead of suspending".
SuprlinkOutCount JCW
When Suprlink closes the output file, it sets a JCW named SuprlinkOutCount with
the number of output records. This is the same number reported in the total line (i.e.,
OUT=). You can use this JCW to control job stream execution by checking if the
Add the value of the word to the number that appears with it for the true value of
SuprlinkOutCount. For example,
:showjcw Suprlinkoutcount
SUPRLINKOUTCOUNT = WARN8616
16384 + 8616 = 25000
The MPE/iX :Showvar command can also be used to see the value of a JCW.
Showvar displays the full, correct number (e.g., 25,000) up to the maximum of
65,535.
Suprlink also sets two other JCWs: SuprlinkOutCount1 and SuprlinkOutCount2.
These communicate the full OUT= value to the Suprlink2 interface.
SuprlinkFullCount Variable
On MPE/iX, when Suprlink closes the output file, it also sets a variable
namedSuprlinkFullCount with the number of output records. This is the same
number reported in the total line (i.e., OUT=). The advantage of the variable is that
if more than 65,535 records are written to the output file, the value of the
SuprlinkFullCount variable is not truncated.
Input Files
The primary Input file, which if doing a link operation is the file that should have the
many or "detail" records. If any of the Link files contain duplicate records, Suprlink
will select one of them to link to the primary record(s). The Suprlink Output file will
have no more records than the Input file.
The Input file and Link files are created with the Output xxx,Link option in Suprtool.
These files must be sorted by the same key field in ascending order.
Output Files
The Output file will be a self-describing file, containing data extracted from the
Input file and the Link files. Suprlink combines the Input and Link records together
in a fixed way, dropping the duplicated key fields and appending the remaining
fields of each file in the order specified. You control which fields occur by using the
Extract command in Suprtool, but you have no control over their order. Use the
Form command to print out the final record format so that you can prepare COBOL
COPYLIB or PowerHouse QSCHEMA definitions.
Sort Keys
The Input file and Link files must be sorted by the same key field. Their names do
not have to be identical, but they must be the same type and have the same length.
Suprlink does not support real- or long-type keys.
Selection Logic
Selection logic can be tricky, since it is distributed over independent Suprtool extract
tasks, the Suprlink merge phase, and the final report program.
Suprtool Selection. You can use the If command to select which records you want
from each dataset. You do have the option to select key values from one dataset, then
load them into a Table and use $lookup to select related entries in another dataset. It
makes sense to use If on every dataset, since you have another selection possibility
when the files are linked. For example, you might select all customers in California
and all invoices with an amount greater than $2000.
Suprlink Selection. The Input file limits the scope of the Output file. You cannot
have more Output records than you do Input records, but you can have fewer. When
you do a Link to another file, you have an implied selection criterion. That is, if
Suprlink cannot find a record in the Link file with matching key value(s), the Input
record is dropped from the Output file. If you have seven Link files, the Input record
must match all seven or be dropped. This is the default selection logic. You can
override this for any specific Link file by specifying the OPTIONAL keyword on the
Link command. Only do this is you don't care whether that data exists or not, since
Suprlink will supply default values for those Link fields.
We now have a self-describing file with all the customers from California sorted by
the customer number. Next we select all invoices over $2,000.00 and sort them into
customer number sequence:
>get d-invoice {select all invoices...}
>if amount>200000 {...over $2,000.00}
>sort custnum {sort and link key again}
>output invoices,link {remember the link option}
>exit
If we specify the cust file as input, the Output file will only contain one invoice per
customer. Because we want to produce a report of all the selected invoices, we
specify it as the input file:
+input invoices {driving input file, custnum is the key}
+link customer {combined with customers}
+output invcust {produces the file we want}
+exit
Each record of the invcust file will have both the invoice information and the
customer information for each invoice of the Input file (i.e., one record per invoice).
What happens if there is no customer record for a specific invoice? In this case, the
invoice record does not appear in the Output file. To force Suprlink to include these
records, use the optional keyword on the Link command:
+input invoices {sorted by custnum}
+link customer optional {don't exclude invoices if...}
+output invcust {the customer information...}
+exit {...is missing}
A Join Example
Suprlink can join files together that have multiple key records in each file, what has
been come to be know as a many-to-many link. Suprlink has traditionally been able
to link an Input file with many records with the same key to a Link file that has a
single record with the same key value.
The above task will link multiple records of the file ordhist, to the multiple records
of the file in orders. This assumes that the files are sorted by a common key. In SQL
terms this is known as an Inner Join. An Outer Join, one where the keys do not
necessarily have a match can be achieved by adding the optional keyword to the Join
command:
+input ordhist
+join orders optional
+output joined
+xeq
In SQL parlance, once again you can achieve both a Left Outer Join and Right Outer
Join by reversing the order of the files, between the input and the join commands.
To give you an example of how the Join operation would work consider the
following data. First we have an inventory file with multiple records for the same
product-no. This data is stored in the file dinv:
50512001 {Rest of data}
50512001 {Rest of data}
50512003 {Rest of data}
The next file will have sales records, once again with multiple key values, this data is
stored in the file dsales:
50512001 {Rest of data}
50512001 {Rest of data}
If you did the following task assuming both files are sorted by the product-no:
+in dinv
+join dsales
+out invsales
+xeq
The resulting file would have four records, with the multiple matching dinv and
dsales records. The record layout would have the dinv information first followed by
the dsales information. If you add the optional keyword on the join command the
resulting file would have 5 records. The matching 4 records from dinv and dsales as
well as the dinv record that did not match with the numeric fields set to zero and the
byte fields set to spaces.
Only one Join operation is allowed per task.
By default, Suprlink will join files base on the primary sorted key in the self-
describing file. You can specify a secondary key for the files to be joined on in a
similar manner to how the Link command did:
Performance Considerations
Select only the records you need, unless the time to load a table of desired key
values, plus the time needed to do $lookup for each record, is longer than the time to
extract and sort the entire dataset. Use the Sorted and Hold options of the Table
command when loading a table. Because of the time needed to search a large table, it
is often faster to extract all of the records and let Suprlink skip over the ones it
doesn't need.
This method does a lot of sorts. Sorting time can vary depending on system load and
available memory, but it increases dramatically for large records and large datasets.
You should try to use Suprtool's Extract command to reduce the record size, and
consider using Suprtool's If command to reduce the number of records.
Suprlink needs enough disc space to invert a significant subset of your database, then
link it into an Output file. Although all of the Suprlink files can be job temporary,
you still need enough disc space for the original database, the final Output file, the
primary Input file, and each of the Link files. One of the tradeoffs with this method
is more disc space for faster elapsed time.
Another Example
From the sales records, retrieve all of the sales for October, 2000 and append the
customer name, salesman code, and year-to-date sales total to the sales record (these
fields are located in the customer records).
:run suprlink.pub.robelle
+input sales {link sales...}
+link custs {...to custs...}
+output repts temp {...producing REPTS!}
+xeq {...run the task}
+form repts {fields in repts}
+exit
:purge repts,temp
Illegal Digits
Whenever Suprlink is processing files with packed- or zoned-decimal keys, errors
can occur because of invalid digits in the keys. Suprlink reports the input and link
record numbers with illegal digits and processing stops. You can use Suprtool to
examine input and link records, by using record selection with Suprtool's input
command. A packed-decimal number consists of nibbles (there are two nibbles in
each byte). The last nibble is the sign of the number. The remaining nibbles must
each contain a number in the range 0-9. A zoned-decimal number must have a valid
digit in each byte and end in "0"-"9", "A"-"R", "{", or "}".
Selecting Non-Matches
Consider a common problem easily solved with Quiz from Cognos: finding all
records in a file which have no corresponding records in a related file. For example,
to find all records in an invoice lines file with no corresponding invoice master
record, the following Quiz code could be written.
This small amount of code, however, can take a long time to execute, depending on
the size of the Lines and Header files. A Quiz program will usually take longer as
new links are added, causing the size of the record complex to grow.
Suprlink can provide the same information, possibly in a fraction of the time. The
technique as applied to the same problem requires four steps:
1. Sort the Lines file by Invoiceno.
2. Add a new constant field, Linkflag, to the Header file and fill it with
"Y". Sort by Invoiceno.
3. Link the two files with Suprlink using the Optional parameter.
4. Select the record complexes where linkflag does not contain a "Y".
:run suprtool.pub.robelle
>base invdb
>get lines
>sort invoiceno
>output file1,temp,link
>xeq
>get header
>define linkflag,1,1
>extract invoiceno,linkflag="Y"
>sort invoiceno
>output file2,temp,link
>xeq
>input file3
>if linkflag <> "Y"
>extract invoiceno
>list standard
>exit
Any invoice line with a corresponding record in the invoice Header file will have a
"Y" in the linkflag field. Records failing the match will contain the default space.
This technique can easily be adapted for use as a command file, to minimize the
amount of code added to a job stream. See the "MPE/iX Programming" section of
the Suprtool User Manual for ideas about command files.
This example would sort the entire MPE file. To select a subset, you would define
more fields and use the If command. Treat KSAM files exactly the same way.
Suprtool does not read KSAM files in sorted order, so you must remember to specify
the sort explicitly when converting the KSAM file to a self-describing file.
Suprlink cannot create nor write to KSAM files. You can use Suprtool to load a
KSAM file with the output from Suprlink.
CI Variable Substitution
Suprlink is able to substitute any CI variables from any command line source,
whether thru interactive, use file or batch input.
In order to use this feature, first issue the following Set command:
set varsub on
Batch
Since the Streams facility (under default setups) will replace any "!" found in the first
column of a job stream. Anytime you want to specify an entire line thru Variable
Substitution you will need to leave a space before the variable is specified.
!setvar input "i dfile by message-no"
!run suprlink.pub.robelle
+set varsub on
+ !input
Notes
For MPE commands some variables will be resolved twice when passed off to MPE,
which will give different values for a variable.
Setting variables at the CI level:
MPEXL:setvar x 10
MPEXL:setvar y "!!x"
MPEXL:showvar [xy]
X = 10
Y = !x
Because Suprlink does one level of variable substitution prior to the command being
passed off to MPE, setting variables in Suprlink that involves other variables will
give different results from MPE. We recommend that you set the variables prior to
running Suprlink, or that you temporarily turn off variable substitution with the Set
Varsub Off command.
+set varsub off
+setvar a 10
+setvar b "!!a"
+showvar [ab]
A = 10
B = !a
+set varsub on
The subfile must contain all of the fields that Suprlink will produce in the output file,
with the same attributes (data-type and length) and in the same order. Use the
Include option of QTP's Subfile command to define each of the fields in the correct
order.
The numrecs parameter must be replaced with the number of records that will be
created by the Suprlink run. The default numrecs is 1023 when the input limit is set
to 0.
Notes on Subfiles
One of the advantages that Suprlink has over the link function in PowerHouse is that
Suprlink does not require the "key" field in the link files to be a database key.
Because Suprlink uses a serial-merge approach, its files only need to have a common
field with the same data-type and length. If you do use Suprlink to link files that do
not share a common database key, you need some extra steps to create the
PowerHouse subfile.
Since Suprlink cannot currently write to NM Ksam files you cannot directly write to
PowerHouse indexed subfiles. You can use Suprtool to load file to the Indexed
KSAM file.
You must be careful to ensure that the data definitions of the Defined fields are
correct. Note that you cannot assign default display specifications (such as Heading
or Picture specifications) for Defined fields in QTP.
>access m-customer
>subfile custtemp size 1 include &
> name, address
>set input limit 0
>go
General Notes
When you run Suprlink, it prompts for commands on $stdlist with a "+" character
and reads command lines from $stdinx. Suprlink commands contain a command
name followed by one or more parameters, and are patterned after the same
commands in Suprtool.
In this chapter, we describe the Suprlink commands in alphabetic order. Following
each command name in brackets is the minimal abbreviation for the command. For
example: [I] for Input and [L] for Link.
Abbreviating
You may shorten the command name to the first letter of the command name.
+v {verify}
+x {xeq}
Uppercase or Lowercase
You may enter the letters in either uppercase or lowercase, because Suprlink upshifts
everything in the command line except literal strings within quotes ("abc"). These
two commands are identical:
+EXIT
+exit
Continuation
The maximum physical command line is 256 characters. You may enter commands
on multiple input lines by putting an "&" continuation character at the end of the
line. The maximum total command length is 256 characters. The most common
reason for continuing commands is to specify a lengthy Link command with
secondary keys.
STREAMX
STREAMX is a product from VESOFT that permits you to build flexible job
streams. STREAMX contains a complete programming language with loops,
prompts, and parameter substitution. A problem arises when trying to enter
comments into a Suprtool batch job that will be submitted with STREAMX. Suprtool
uses the {...} pair to delimit comments. STREAMX uses these same characters for
expressions.
You cannot change Suprtool's comment character, but you can change the {...}
characters in STREAMX. The following example changes the STREAMX
expression characters from {...} to ~...~:
!job example,user.acct
::setbraces ~~
!run suprlink.pub.robelle
+input invoices {driving input file, custnum is the key}
+link customer {combined with customers}
+output invcust {produces the file we want}
+exit
!tell ~hpjobname~,~hpuser~.~hpaccount~;Example done.
!eoj
MPE Commands
Suprlink also accepts MPE commands, with or without a colon.
+:comment
+comment
For commands that are the same in both Suprlink and MPE, Suprlink only executes
the MPE command if you type the colon. For example:
MPE/iX Commands
Suprlink/iX will execute any MPE command (e.g., Run), UDCs, and command files.
Caution: programs that suspend, instead of terminating, are not killed by the
HPCICOMMAND intrinsic.
File Names
Suprlink's Input, Link and Output commands accept a file name in either MPE or
POSIX format. File names starting with "/", "./", or "../" are treated as POSIX file
names. All other file names are assumed to be MPE file names. MPE file names are
upshifted and POSIX file names are not. POSIX file names are limited to a
maximum of 240 characters. Here are some examples of POSIX file names:
:hello david,mgr.dev,david
:CHDIR SUBDIR
:run suprlink.pub.robelle
+input ./file
+verify input
/DEV/DAVID/SUBDIR/file
Calculator
Any command line beginning with an equal sign (=) is treated as a calculator
expression. This feature can be used to compute blocking factors and do other
calculations without the need of an electronic calculator.
You can obtain a short description of the calculator by entering the following:
=? {? gives help}
{prints a summary of = functions}
For a detailed description of the calculator and its options, see the Suprtool manual.
Control-Y
You can interrupt a Suprlink task with the Control-Y key (hold down Control while
striking Y). Suprlink responds by telling you how far it has gotten (IN=, OUT=,
etc.), and asking if you wish to stop. Hit the Return key to continue or type YES to
stop the task.
Examples
+listf @.soruce {"source" is not spelled right}
NON-EXISTENT GROUP. (CIERR 908)
+Before {redo most recent command}
listf @.soruce {last command is printed}
our {you enter changes to it}
listf @.source {the edited command is shown}
{you press Return}
+listredo -10/
+before 5 {redo 5th command in stack}
+bef 8/10 {redo 8th through 10th}
+b listf {redo last listf command}
+b listf temp {redo "listf temp" command}
+b @temp {redo last containing "temp"}
+before -2 {redo command before previous}
+before -5/-2 {redo by relative lines}
Modify Operators
If you wish to change any characters within the line, the modify operators are the
regular Control Codes used in Qedit:
• Any printing characters replace the ones above.
• Control-D plus spaces deletes columns above.
• Control-B puts you into "insert before" mode.
• Control-A starts appending characters at the end of line.
• Control-A, Control-D, plus spaces, deletes from the end.
• Control-T ends Insert Mode, allowing movement to a new column.
• Control-G recovers the original line.
• Control-O specifies "overwrite" mode (needed for spaces).
Examples
+listredo
+do {do previous command again}
+do 39 {do command line 39 again}
+do 5/8 {do command lines 5 to 8 again}
+do link {do most recent Link command}
+do show {do last starting with "show"}
+do showjob job {do last "showjob job" command}
+do @job {do last containing "job"}
+do -2 {do command before previous}
+do -7/-5 {do by relative line number}
+do 5/ {do command lines 5 to last}
Notes
The Do command cannot be abbreviated.
Persistent Redo
Redo commands can be saved in a permanent file and can therefore be used from
another session. You can use the Set redo command to specify a filename to save
your redo commands. Please see the Set Redo command for details.
Examples
+:comment. You began to specify a linkage, stopped for
+:comment. coffee, and decided to cancel the task
+:comment. upon your return.
+input invoices
... coffee break ...
+exit abort {cancel linkage and terminate}
Examples
:run qedit.pub.robelle
/:run suprlink.pub.robelle
+input invoices
+link customer {start specifying options}
+exit suspend {return to Qedit without an Xeq}
SUPRLINK.PUB.ROBELLE is still alive. Okay to HOLD ? Y
/...
/:activate suprlink
SUPRLINK.PUB.ROBELLE
+output invcust {continue specifications}
+xeq {execute the current task}
Examples
:run suprlink.pub.robelle
+exit {no input was specified}
End Of Program
:run suprlink.pub.robelle
+input invoices
+link customer
+output invcust
+exit {link and stop}
Formout File
The Form command writes all output to the file Formout. This file defaults to
$stdlist. You can redirect this file to a line printer or a disc drive. If you redirect the
Formout file to a disc file, Suprlink assumes a temporary file by default.
+:file formout;dev=lp
+form custfile {writes to line printer}
+:file formout;dev=disc
+form invfile {writes to temporary file}
Command Help
If you specify any parameters, Help first assumes that you want help on a specific
Suprlink command. If you know the structure of the help file, you can specify one of
the keywords under the command name.
+help link {help on the Link command}
+help link,notes {notes section of the Link command}
Keyword Help
If we cannot find any help in the "Commands" section of the help file, we assume
that you specified one of the outer-level keywords in the help file. To see this list of
keywords, type help with no parameters. You will see a short introduction to
Suprlink and then a list of keywords. You can specify any of these keywords on the
Help command. You can also specify a subkeyword.
+help before,example {example section of Before command}
Quick Help - HQ
HQ asks Suprlink to look under the keyword QUICK in the help file. QUICK
contains the text from the Suprlink Quick Reference Guide, offering the experienced
user a quick review of the syntax of any command.
+hq input {quick description of Input}
+hq commands {quick list of command names}
Notes
If no parameters are specified, Help allows you to browse through the help file,
Suprlink.Help.Robelle. The Help command uses the Qhelp subsystem from the
QLIB. For "help in help", type "?" when you see the Qhelp prompt character ("?").
The help file is organized into levels. To go back to the previous level, press Return.
Press F8 to exit the Qhelp subsystem and return to Suprlink.
File Name
The Join file should be created by Suprtool with the Output,Link option; it should
only contain the fields that you actually need in the final report, plus any sort fields .
If you do a :LISTF of the file, it should show "SD" as the CODE; this means it is
self-describing. It contains a description of its own record structure in some special
user labels; this allows you to refer to the same field names as in the original
database and Suprlink can compute where they occur in the record. For example:
+input sales {Sales is sorted by custno}
+join custfile {key is custno}
+output custsale {Join two files...}
+exit {...into custsale}
Join Keys
Suprlink allows files to be linked by up to two keys, a primary and a secondary key
field.
By default, Suprlink assumes that the key field to the Join file is the same key field
specified for the Input file. If the Join key field is different from the Input key field,
use the BY-clause to specify the correct key field:
+input customer {key-name is custnum}
+join sales by custno {new name for the same field}
You would also use the BY-clause if the Link file was created using the Suprtool
Output,Query option instead of Output,Link.
Secondary Keys
Suprlink has an option that allows you to select which join record you want by
matching a second key field in the master.
JOIN filename BY primary-key secondary-key
This option forces Suprlink to compare both the primary-key and the secondary-key
when comparing an input record to a join record. For example,
+input ordhist {key-name is cust}
+join orders by cust prod {Orders contains prod}
This example says that the file Orders is sorted by both cust and prod fields. The join
will occur on those records that match both keys.
Note that you must specify the Input file key field as part of the FROM-clause. This
example is identical to the previous secondary key example, but in this case the
current major field is called "products" in the ordhist file and "prod" in the orders
file.
Optional Join
If there are no join records for a given key value of the input file, that input record is
dropped from the output file (this is the default option, REQUIRED).
To make the join optional, specify the OPTIONAL keyword. When you use
OPTIONAL, and Suprlink does not find a matching join record in the file, Suprlink
fills in the linked fields with default values. The default for byte-type fields is spaces,
for zoned-type the default is ASCII zeros "0", and for all other types the default is
binary zeros. For example,
+input custfile {key-name is custno}
+join addrfile optional {don't drop customers...}
+output custaddr {...if there is no address}
+exit
File Name
The Link file should be created by Suprtool with the Output,Link option; it should
only contain the fields that you actually need in the final report, plus any sort fields.
If you do a :LISTF of the file, it should show "SD" as the CODE; this means it is
self-describing. It contains a description of its own record structure in some special
user labels; this allows you to refer to the same field names as in the original
database and Suprlink can compute where they occur in the record. For example:
+input sales {Sales is sorted by custno}
+link custfile {key is custno}
+link addrfile
+output custsale {link three files...}
+exit {...into custsale}
Link Keys
Suprlink allows files to be linked by up to two keys, a primary and a secondary key
field.
By default, Suprlink assumes that the key field to the Link file is the same key field
specified for the Input file. If the Link key field is different from the Input key field,
use the BY-clause to specify the correct key field:
+input customer {key-name is custnum}
+link sales by custno {new name for the same field}
You would also use the BY-clause if the Link file was created using the Suprtool
Output,Query option instead of Output,Link.
Secondary Keys
Suppose that you are linking a master to a detail and the detail can have several
entries for each master. Suprlink has an option that allows you to select which link
record you want by matching a second key field in the master.
LINK filename BY primary-key secondary-key
This option forces Suprlink to compare both the primary-key and the secondary-key
when comparing an input record to a link record. For example,
+input students {key-name is ssn}
+link majors by ssn cmaj {Students contains cmaj}
This example says that the file Majors is sorted by ssn and may contain more than
one record per student. To select the desired record for each student, Suprlink
matches the students' cmaj against the cmaj in the link record.
Note that you must specify the Input file key field as part of the FROM-clause. This
example is identical to the previous secondary key example, but in this case the
current major field is called "curmajor" in the students file and "cmaj" in the majors
file.
Optional Linkage
If there is more than one link record with the same key value, Suprlink will select the
first one it finds. You can sort by another value such as date-time to force a certain
record to be first. Please note that this is unlike Quiz, which does a hierarchical
expansion to include every record accessed. If there are no link records for a given
key value of the input file, that input record is dropped from the output file (this is
the default option, REQUIRED).
To make the linkage optional, specify the OPTIONAL keyword. When you use
OPTIONAL, and Suprlink does not find a matching link record in the file, Suprlink
fills in the linked fields with default values. The default for byte-type fields is spaces,
for zoned-type the default is ASCII zeros "0", and for all other types the default is
binary zeros. For example,
+input custfile {key-name is custno}
+link addrfile optional {don't drop customers...}
+output custaddr {...if there is no address}
+exit
Examples
+listredo 5
+listredo 5/10
+listredo help {print all Help commands}
+listredo -10 {print last ten commands}
+listredo ALL {print entire redo stack}
+listredo purge {print all Purge commands}
+listredo purge xx {print all "purge xx" commands}
+listredo @purge {print all with "purge" anywhere}
+listredo @;rel {print ALL, relative numbers}
+listredo 1/10;out=*lp {dump commands to printer}
+listredo @;unn;out=save {write commands to a file}
Notes
The Listredo command cannot be abbreviated, but BJ is accepted as a short form.
Persistent Redo
Redo commands can be saved in a permanent file and can therefore be used from
another session. You can use the Set redo command to specify a filename to save
your redo commands. Please see the Set Redo command for details.
Quiz Subfiles
The Erase option is provided for Quiz users who create an empty subfile using QTP
or Quiz before running Suprtool and Suprlink. See the Suprlink with Quiz/QTP
section for details.
Since Suprlink cannot currently write to NM Ksam files you cannot directly write to
PowerHouse indexed subfiles. You can use Suprtool to load file to the Indexed
KSAM file.
Examples
+listf @.soruce {"source" is not spelled right}
NON-EXISTENT GROUP. (CIERR 908)
+redo {redo most recent command}
listf @.soruce {last command is printed}
our {you enter changes to it}
listf @.source {edited command is shown}
{you press Return}
+listredo all
+redo 5 {redo 5th command in stack}
+redo {redo previous command}
+redo -2 {redo command before previous}
+redo 8/10 {redo 8th through 10th}
+redo -10/ {redo -10 through last}
+redo purge {redo last Purge command}
+redo purge temp {redo last "purge temp"}
+redo @temp {redo last containing "temp"}
Notes
The Redo command cannot be abbreviated. To save more commands, use a :File
command on the file LINKREDO before you run Suprlink:
:file linkredo;disc=5000
:run suprlink.pub.robelle
Persistent Redo
Redo commands can be saved in a permanent file and can therefore be used from
another session. You can use the Set redo command to specify a filename to save
your redo commands. Please see the Set Redo command for details.
Mapped
SET MAPPED ON | OFF
(Initially: OFF)
MAPPED forces Suprlink/iX to read the input and link files using mapped file
access. Specifying this option is an error in Suprlink/V. If the input and link files are
not in memory, the wall time performance is worse with Set Mapped On, but CPU
time performance is better. You must Set Mapped On before specifying the input
file.
Redo
SET REDO filename
(Initially: unnamed temporary file)
Commands entered at the Suprlink prompt are saved in something called the redo
stack. You can recall commands from the redo stack by using other commands such
as Before, Do and Redo. By default, the redo stack is stored in a temporary file and
discarded as soon as you exit. This temporary stack is not preserved across Suprlink
invocations.
The new Set Redo command assigns a permanent file as the redo stack, allowing the
stack to become available for future Suprlink invocations. For example, to assign the
Myredo file as a persistent redo stack, enter
+set redo myredo
If the file does not exist, Suprlink creates it. Otherwise, Suprlink uses the existing
file. All subsequent commands are written to the persistent redo stack. The setting is
valid for the duration of the Suprlink session. As soon as you exit Suprlink, the
setting is discarded. Next time you run Suprlink, you will get the temporary stack.
If the file name is not qualified, the redo stack is created in the logon group and
account. This may be desirable if you want to have separate stacks. If you want to
always use the same persistent stacks, you should qualify the name.
The Verify command shows which stack is currently in use. If it shows
<temporary>, it means Suprlink is using the default stack. Anything else is the name
of the file used on the Set Redo command.
In this situation, Suprlink continues to use the redo stack active at the time and lets
you continue working as normal.
Qedit can also have permanent redo stacks. To prevent products from writing to each
other's stack, it is advisable to have separate stacks for each product by giving them
different file names.
For example, if you use
set redo myredo
you will have a redo stack called Myredo for your Suprlink commands. If you exit
Suprlink, then run Qedit and supply the same Set Redo command, your Qedit
commands will be written to the same file that was used for your Suprlink
commands.
Statistics
SET STATISTICS ON | OFF
(Initially: OFF)
STATISTICS causes Suprlink to print statistics at the end of each task.
Varsub
SET VARSUB ON | OFF
(Initially: OFF)
Setting Variable Substitution causes Suprlink to resolve any CI variables in a
command before processing.
VarsubDebug
SET VARSUBDEBUG ON | OFF
(Initially: OFF)
Suprtool, now has a setting called Set VarsubDebug on which will print out the line
after the variable substitution has occurred. This setting only works if Set Varsub is
on and Set VarsubDebug is on.
The output is formatted into 74 byte chunks and printed with a preceding “vd:” so
the “substituted” line is clear.
Examples
A usefile makes your task easier by allowing common commands to be specified
once in an external file. For example, the following usefile contains all the
commands for creating the invcust file:
+use usecust
input invoices {sorted by custnum}
link customer {combined with customers}
output invcust {produces the file we want}
exit
Suprlink prints the lines in the usefile, including the comment lines. This allows you
to include instructions and reminders in the usefile. In the example above, there were
no commands for the user to enter.
Notes
Usefiles cannot be nested in Suprlink. The usefile may be any unnumbered text file
or a Qedit workfile, but no more than 256 characters per record will be processed.
By default, Suprlink displays the commands in a usefile as they are executed.
Suprlink can execute commands quietly using the Useq command. For compatibility
with Qedit, Useq can be abbreviated to UQ.
Example
The Form command displays the fields in a self-describing file. This information is
stored in the user labels of an MPE file and is not accessible with other tools. Use the
Form command to obtain the record layout of Suprlink output files.
The following example shows the Form command listing for an input file, a Link
file, and the resulting output file. We start with an input file of invoices.
+form invoices
File: INVOICES.TEST.DATA (SD Version B.00.00)
Entry: Offset
CUSTNUM X8 1 <<Sort #1 >>
DELIVERED I2 9
PRODUCTNUM Z8 13
PRICE I2 21
PURCHASED I2 25
QTY I1 29
TAX I2 31
TOTAL I2 35
Limit: 100 EOF: 100 Entry Length: 38 Blocking: 107
Suprtool produced both the invoice and the customer file by using the Get, Extract,
and Sort commands. The invoice file was produced with Suprtool's Output Link
option. If you had used Suprtool's Output Query option, the Form command would
not have printed any information about the key fields. The next listing is the
customer file.
+form cust
File: CUST.TEST.DATA (SD Version B.00.00)
Entry: Offset
CITY X12 1
RATING I2 13
CUSTNUM X8 17 <<Sort #1 >>
STATUS X2 25
FIRSTNAME X10 27
LASTNAME X16 37
STATE X2 53
ADDRESS 2X25 55
ZIPCODE X6 105
Limit: 50 EOF: 50 Entry Length: 110 Blocking: 37
The street address is a compound-field. If you had used Suprtool's Output Query
option, the field would have appeared with a question mark for the data-type. In that
case, you cannot use the field as a key-field in Suprlink, but the actual data in the
field will be processed and linked correctly. Your final report should be able to read
The final Form command shows the record layout of the Output-file. You would use
this file as input to your report program.
+form invcust
File: INVCUST.TEST.DATA (SD Version B.00.00)
Entry: Offset
CUSTNUM X8 1 <<Sort #1 >>
DELIVERED I2 9
PRODUCTNUM Z8 13
PRICE I2 21
PURCHASED I2 25
QTY I1 29
TAX I2 31
TOTAL I2 35
CITY X12 39
RATING I2 51
STATUS X2 55
FIRSTNAME X10 57
LASTNAME X16 67
STATE X2 83
ADDRESS 2X25 85
ZIPCODE X6 135
Limit: 100 EOF: 100 Entry Length: 140 Blocking: 29
Maximums
The various limitations of Suprlink are described here. In general you need to reduce
the number or sizes of fields if you encounter any of these limits.
MPE V
On MPE V, you install Speed Demon in the System SL (see Installing Speed Demon
for instructions). Speed Demon/V should be about five times faster than DBGET
mode-2.
MPE/iX
On MPE/iX, you run your native mode programs with an XL file:
DemonXL.Pub.Robelle. Speed Demon/iX can be slightly slower than DBGET
mode-2 or it can run as much as eight times faster. We are not certain why there is
such a range of performance values. We would be happy to see performance results
from users.
Conditions of Use
Speed Demon is included as part of Suprtool. Any licensed Suprtool users can use
Speed Demon in their own application software. Speed Demon cannot be included in
SPDEPREFETCH JCW
Speed Demon can read data directly from disc into memory using Multi-Rec
NOBUF reads. However, Speed Demon is often slowed down on MPE/iX while
waiting for the file system to satisfy its read requests. Using prefetch on MPE/iX,
Speed Demon is able to increase its throughput by instructing MPE/iX's memory
manager to read the data from disc to memory ahead of time. This way, when Speed
Demon needs the data it is already in memory and Speed Demon doesn't have to
wait.
System SL Installation
This procedure is required for MPE/V systems, and for compatibility mode programs
on MPE/iX.
The Speed Demon/V routines are distributed in the file DemonUSL.Pub.Robelle.
The job stream Demon.SuprJob.Robelle installs the Speed Demon/V intrinsics in the
System SL. This is the only method for installing Speed Demon/V. You also use this
job stream to update Speed Demon/V when you receive a new version, or to re-
install the interface after a MIT update from HP. You will need a small tape for a
new cold load tape to contain the Speed Demon/V segments.
Warning: You must have created the Robelle account and restored all files as
described in the installation chapter of the Suprtool User Manual. To install
Speed Demon/V into the System SL, follow these steps:
1. Ensure that no one will use Speed Demon/V until the installation is
complete. No one can be running a program which uses Speed
Demon/V. Stop all jobs and send an operator warning.
User XL Installation
This procedure is for native mode programs on MPE/iX, and is optional.
You normally access Speed Demon/iX by specifying XL="DemonXL.Pub.Robelle"
when running your program. Therefore, there may be no need to perform any
installation steps for Speed Demon/iX.
The advantage of leaving Speed Demon/iX in the Robelle account and always
pointing to the XL when you run your programs, is that when you receive an upgrade
of the Robelle account files, Speed Demon/iX is automatically upgraded with no
effort on your part. The disadvantage is that you must remember to always put the
XL= statement on all Run commands for your programs that use Speed Demon/iX. If
you don't want to change your Run commands, you can copy Speed Demon/iX into
your own XL that is already being searched.
Installing Speed Demon/iX in your own XL requires that both the account and the
group where the XL resides have privileged mode capability. Calling programs do
not have to have privileged mode capability. The XL can reside anywhere on your
system, it does not have to be in the same account or the same group as your XL file.
Here are the commands to install Speed Demon/iX in your own XL:
:hello user.acct
:linkedit
>xl xl {we assume the XL already exists}
>copyxl from=demonxl.pub.robelle; replace
>exit
The Replace option is not in all versions of Linkedit. If your version does not allow
Replace, and you already have Speed Demon in your XL file, you will need to
manually purge the existing modules before copying the new one.
Demonxl can successfully be installed into the System XL file, but this is not
recommended by HP. Demonxl can be combined into an XL file with other Robelle
XL files, except Qcompxl (a part of Qedit).
To alter an existing program to use the Demonxl, you can use the Altprog command
from within Linkedit:
LinkEd>altprog myprog; xl=demonxl.pub.robelle
Please see the Linkedit manual for details about the Link and Altprog commands in
Linkedit.
Netbase
Netbase is a product from Quest software that intercepts IMAGE and File System
calls. Netbase allows any database or file to be automatically directed to a remote
machine. Netbase does not support System SL installation. For this reason, the only
way to make Speed Demon/V and Netbase work together is to install Speed
Demon/V in a Pub SL along with the Netbase software.
Pub SL
Installing Speed Demon/V in a Pub SL requires that both the account and the Pub
group have privileged mode capability. The calling program must be installed in the
same account (it does not have to be in the Pub group) and it must be run with
Lib=P. Here are the commands to modify an existing account called Dev.
The previous example shows the capability list as "cap=...,pm". You must fill in the
"..." by obtaining the existing capabilities for the Dev account and the Pub group. On
MPE/iX, you can use the :listacct and :listgroup commands. On other versions of
MPE, you will need to :run Listdir5.Pub.Sys.
Group SL
The steps for installing Speed Demon/V in a group SL are the same as for the Pub
SL, except that you use the actual group name instead of the Pub group. Your user
programs must be installed in the same group as the SL and they must be run with
Lib=G.
perform 10-read-and-report
thru 10-read-and-report-exit
until end-of-d-sales.
05-report-control-exit. exit.
10-read-and-report section.
perform 10-10-get-d-sales.
go to 10-read-and-report-exit.
10-10-get-d-sales.
call "DBGET" using db-base
db-set-d-sales
db-mode2
db-status-area
db-all-list
db-buffer-d-sales
db-dummy-arg.
if db-end-of-file then
move true-value to end-of-d-sales-flag
else
if not db-stat-ok then
perform 99-image-fatal-error.
10-read-and-report-exit. exit.
perform 10-read-and-report
thru 10-read-and-report-exit
until end-of-d-sales.
perform 05-20-close-d-sales.
go to 05-report-control-exit.
05-05-init-d-sales.
call "SPDEDBINIT" using db-base
db-set-d-sales
db-mode1
db-status-area
spde-db-control
db-dummy-arg.
if not db-stat-ok then
perform 98-spde-error.
05-20-close-d-sales.
call "SPDEDBSHUT" using db-base
db-set-d-sales
db-mode1
db-status-area
db-dummy-arg.
if not db-stat-ok then
perform 98-spde-fatal-error.
05-report-control-exit. exit.
The read-and-report section has one change. Calls to DBGET are replaced with calls
to SPDEDBSCAN. If SPDEDBSCAN fails, we perform a different error section.
Note that the parameter list for SPDEDBSCAN is not the same as for DBGET. Our
original program used the @-list, so we don't need to make any changes to the
buffer-d-sales declaration.
10-read-and-report section.
perform 10-10-read-d-sales
if not end-of-d-sales then
if dsa-sales-total > 10000 then
perform 20-report-d-sales
thru 20-report-d-sales-exit.
go to 10-read-and-report-exit.
10-10-read-d-sales.
call "SPDEDBSCAN" using db-base
db-status-area
db-buffer-d-sales
db-dummy-arg.
if db-end-of-file then
move true-value to end-of-d-sales-flag
else
if not db-stat-ok then
perform 98-spde-error.
10-read-and-report-exit. exit.
If the original program used partial field lists, we would call SPDEDBINIT with
mode-2 and pass the field list as the last parameter. For example,
The definition of the control record, with the proper initializing values is:
01 spde-db-control.
05 spde-version pic s9(4) comp value 0.
05 spde-buffer-size pic s9(9) comp value zeros.
05 spde-future pic x(20) value spaces.
Error Handling
Programs that call IMAGE intrinsics usually have an error section for fatal IMAGE
errors. These sections typically call DBEXPLAIN and abort the program. When a
fatal Speed Demon error occurs, SPDEEXPLAIN should be called instead of
DBEXPLAIN.
98-spde-fatal-error-exit. exit.
MPE/iX
To access Speed Demon/iX from a native mode program, you must modify the :Run
command for your program to include an XL file. The following example shows
how you would compile, link, and run a native mode COBOL program that calls
Speed Demon/iX:
:cob74xl testsrc.demon
:link
:run $oldpass;xl='demonxl.pub.robelle'
The Intrinsics
In this chapter we describe the Speed Demon intrinsics in alphabetic order. The
parameters to each intrinsic are word arrays (just like IMAGE). You must include
every parameter or pass a dummy variable as a place holder. The condition code is
not returned by any Speed Demon intrinsic.
Status
The twenty-byte array used to call any Speed Demon intrinsic which
SPDEEXPLAIN will describe. The database and dataset parameters must not change
between the call to the Speed Demon intrinsic and the call to SPDEEXPLAIN.
The Speed Demon intrinsics can return many of the standard IMAGE error numbers,
but Speed Demon has many of its own. SPDEEXPLAIN will print the correct error
message in either case. Because the dataset parameter is not passed to the Speed
Demon intrinsic, SPDEEXPLAIN may not be able to print the name of the dataset in
the second line of the message.
Database
Database name as returned from DBOPEN (first two characters must be non-blank).
Dataset
Dataset name or dataset number to read. You must have full-read access to this
dataset.
Mode
SPDEDBINIT can be called in any of four modes:
Mode Function
0 Return the version number of SPDEDBINIT. All the other parameters
are ignored and Speed Demon is not initialized.
1 Initialize Speed Demon to sequentially access the dataset of the
specified database.
2 Same as mode-1, but allows partial field lists.
3 Same as mode-2, but Speed Demon will read to the physical end of the
dataset. Use this mode if your program expects changes to the dataset at
the same time Speed Demon is reading it.
Status
If SPDEDBINIT succeeds with mode-0, the following values are returned in the
status array.
Word Usage
1 Zero.
2 Major version number.
3 Minor version number.
4 Pre-release version number.
5-10 Zeros.
Control
Special control record that must be declared and initialized as follows:
01 s7pde-db-control.
05 spde-version pic s9(4) comp value 0.
05 spde-buffer-size pic s9(9) comp value zeros.
05 spde-future pic x(20) value spaces.
Normally you won't be changing this control buffer. You might want to change the
spde-buffer-size. This sets the size of the file system reads and the size of the Speed
Demon extra data segment. The default size is 14,336 words, but you may wish to
reduce it.
List
For mode-0 or mode-1 this is a dummy parameter. For mode-2 or mode-3, this is the
field list that corresponds to the buffer that will be returned by SPDEDBSCAN.
Highwater Mark
When you specify a detail dataset, Suprtool and Speed Demon read records until the
highwater mark. If there is a big difference between the number of entries in the
dataset and the highwater mark, Suprtool and Speed Demon could take much longer
to read the dataset (this is true for all programs, not just Suprtool and Speed Demon).
Because mode-1 and mode-2 calls to SPDEDBINIT return the highwater mark for
detail datasets in the status area (this is the record limit), you can write your own
programs to automate checking for excessive highwater marks.
Notes
You must call DBOPEN before calling SPDEDBINIT. This is just like IMAGE --
you cannot call DBGET unless you have first called DBOPEN.
When you call SPDEDBINIT, Speed Demon determines how many records to read.
For master datasets, mode-1 and mode-2 of SPDEDBINIT uses DBINFO to obtain
the number of entries in the dataset. For detail datasets, mode-1 and mode-2 of
SPDEDBINIT uses the highwater mark for the dataset. SPDEDBSCAN stops
reading the dataset when it has read that number of entries. If the dataset is changing
dynamically, new records might be missed. Use mode-3 to force Speed Demon to
read to the physical end of the dataset. This mode makes Speed Demon more
reliable, but slower when the dataset is mostly empty.
Database
Database name as passed to DBOPEN.
Status
If SPDEDBSCAN succeeds, the following values are returned in the status array.
The forward and backward pointers are not returned.
Word Usage
1 Zero.
2 Entry length of the record returned in buffer.
3-4 Record number of the record read.
5-10 Zeros.
Buffer
Array where the values of the record read are placed. This buffer must correspond to
the field list specified in SPDEDBINIT.
Dummy
This is a dummy parameter and it may contain anything.
Database
Database name as passed to DBOPEN.
Dataset
Dataset name or dataset number to shut. This must be the same dataset name or
dataset number passed to SPDEDBINIT.
Mode
SPDEDBSHUT can be called in any of three modes:
Mode Function
0 Return the version number of SPDEDBSHUT. All the other parameters
are ignored and Speed Demon is not closed.
1 Close the Speed Demon environment.
2 Close the Speed Demon environment and print a summary of the read
operation on $stdlist.
Status
If SPDEDBSHUT succeeds with mode-0, the following values are returned in the
status array.
Word Usage
1 Zero.
2 Major version number.
3 Minor version number.
4 Pre-release version number.
5-10 Zeros.
If SPDEDBSHUT succeeds with mode-1 or mode-2, zeros are returned in the status
array.
Dummy
This is a dummy parameter. It may contain anything.
Demon/iX does not print the System SL version numbers. If you are on MPE/iX and
have installed Speed Demon/V into the System SL, you can get the version numbers
by running the compatibility mode version of Demon:
:run demonCM.pub.robelle,version
COBOL Example
The following is an example COBOL program that shows how to call Speed Demon.
This program prompts for a database, database password, dataset, and field list to
process. Because upshifting is so messy in COBOL, you must enter the dataset name
and field list in uppercase. If you want to use the @-field-list, just specify @ when
asked by the sample program.
***********************************************************
* *
* testread - test spde intrinsics. *
* *
* version: 1.0 *
* purpose: *
* *
* General-purpose program to test Speed Demon. *
* *
* Demonstrates that you must call DBOPEN before you call *
* the Speed Demon procedures. *
* *
***********************************************************
environment division.
configuration section.
source-computer. hp-3000 series 37.
object-computer. hp-3000 series 37.
special-names.
top is new-page.
input-output section.
file-control.
select line-printer assign to "LINEPRT".
data division.
file section.
fd line-printer
data record is line-record.
01 line-record pic x(132).
$page "CONSTANTS"
working-storage section.
01 true-value pic x value "T".
01 false-value pic x value "F".
$page "VARIABLES"
01 line-count pic s9(4) comp.
01 page-no pic s9(4) comp.
01 end-of-db-set-flag pic x.
88 end-of-db-set value "T".
01 image-area.
05 db-all-list pic x(2) value "@ ".
05 db-same-list pic x(2) value "* ".
05 db-null-list pic s9(4) comp value 0.
05 db-dummy-arg pic s9(4).
05 db-password pic x(8).
05 db-mode0 pic s9(4) comp value 0.
05 db-mode1 pic s9(4) comp value 1.
05 db-mode2 pic s9(4) comp value 2.
05 db-get-serial redefines db-mode2 pic s9(4) comp.
05 db-mode3 pic s9(4) comp value 3.
05 db-rewind-set redefines db-mode3 pic s9(4) comp.
01 db-base.
05 filler pic x(2) value spaces.
05 db-name pic x(26).
01 spde-control.
05 spde-version pic s9(4) comp value 0.
05 spde-buffer-size pic s9(9) comp value zeros.
05 filler pic x(20) value spaces.
perform 05-get-parameters
thru 05-get-parameters-exit.
perform 90-close-files
thru 90-close-files-exit.
00-main-exit. goback.
$page "[05] get-parameters"
*
* Prompt for the database, password, dataset and field list.
*
05-get-parameters section.
go to 05-get-parameters-exit.
05-10-get-database.
move spaces to input-line.
display "Enter Database Name".
accept input-line.
move input-line to db-name.
05-20-get-password.
move spaces to input-line.
display "Enter Database Password".
accept input-line.
move input-line to db-password.
05-30-get-dataset.
move spaces to input-line.
display "Enter Dataset Name (must be uppercase)".
accept input-line.
move input-line to db-set.
05-40-get-field-list.
move spaces to input-line.
display "Enter @ or Field-List (must be uppercase)".
accept input-line.
move input-line to db-list.
05-get-parameters-exit. exit.
$page "[10] init-testread"
*
* Open the database and initialize Speed Demon.
*
10-init-testread section.
perform 10-10-open-base.
perform 10-20-init-spde.
perform 10-30-display-suprinit.
go to 10-init-testread-exit.
10-10-open-base.
call "DBOPEN" using db-base
db-password
db-mode5
db-status-area.
if not db-stat-ok then
perform 99-fatal-error.
10-20-init-spde.
call "SPDEDBINIT" using db-base
db-set
db-mode2
db-status-area
spde-control
db-list.
if not db-stat-ok then
perform 98-supr-error.
10-30-display-suprinit.
move db-stat2 to display-number.
10-init-testread-exit. exit.
$page "[20] read-set"
*
* Read all the records in the dataset.
*
20-read-set section.
perform 20-10-get-next.
go to 20-read-set-exit.
20-10-get-next.
call "SPDEDBSCAN" using db-base
db-status-area
db-buffer
db-dummy-arg.
if db-end-file then
move true-value to end-of-db-set-flag
else
if not db-stat-ok then
perform 98-supr-error.
20-20-display-next.
* move db-stat3-4 to display-number.
* display "Record# ", display-number.
20-read-set-exit. exit.
$page "[90] close-files"
*
* Cleanup by closing the dataset and the database.
*
90-close-files section.
perform 90-10-close-dataset.
perform 90-20-close-base.
go to 90-close-files-exit.
90-10-close-dataset.
call "SPDEDBSHUT" using db-base
db-set
db-mode2
db-status-area
db-dummy-arg.
if not db-stat-ok then
perform 98-supr-error.
90-20-close-base.
call "DBCLOSE" using db-base
db-dummy-arg
db-mode1
db-status-area.
if not db-stat-ok then
perform 99-fatal-error.
90-close-files-exit. exit.
$page "[98] supr-error"
98-supr-error section.
stop run.
98-supr-error-exit. goback.
$page "[99] fatal-error"
99-fatal-error section.
stop run.
99-fatal-error-exit. goback.
Pascal Example
Calling Speed Demon from Pascal is more difficult than from other languages due to
Pascal's tighter type-checking on procedure parameters. The following is a complete
example program written in Pascal/V that reads the process dataset of the
menu.qlib database. This example program compiles and runs in native mode
under MPE/iX, but you must make the two changes indicated. Because the buffer
length parameter is not 32-bit aligned, Pascal/iX produces a warning when compiling
the spde_db_control type. Note that the $check_actual_parm$ setting is left at 2 for
the entire program. This is required to prevent parameter type mismatches between
Speed Demon and Pascal.
type_db_base =
record
db_id : packed array[1..2] of char;
db_name : packed array[1..14] of char;
end;
type_db_set =
record
name : packed array[1..16] of char;
end;
type_spde_db_control =
record
spde_version : shortint;
spde_buffer_size : integer;
spde_future : packed array[1..20] of char;
end;
var
spde_db_control : type_spde_db_control;
db_status_area : type_db_status_area;
db_dummy_arg : type_db_dummy_arg;
db_mode1 : type_db_mode;
db_mode2 : type_db_mode;
db_base : type_db_base;
$check_formal_parm 2$
$check_actual_parm 2$
procedure spdedbinit(var db_base : type_db_base;
var db_set : type_db_set;
var db_mode : type_db_mode;
var db_stat : type_db_status_area;
var control : type_spde_db_control;
var dummy : type_db_dummy_arg
); external spl;
procedure spdedbscan(var db_base : type_db_base;
var db_status : type_db_status_area;
var db_buffer : type_db_buffer;
var dummy : type_db_dummy_arg
); external spl;
procedure spdedbshut(var db_base : type_db_base;
var db_set : type_db_set;
var db_mode : type_db_mode;
var db_stat : type_db_status_area;
var dummy : type_db_dummy_arg
); external spl;
procedure test_spde;
var
start_cpu : longint;
start_wall: longint;
procedure complete_driver;
var
db_set : type_db_set;
begin
db_set.name := 'PROCESS; ';
spdedbshut(db_base
,db_set
,db_mode2
,db_status_area
,db_dummy_arg
);
if db_status_area[1] <> 0 then
spdeexplain(db_status_area);
end (*complete_driver*);
begin (*driver*)
db_mode1[1] := 1;
db_mode2[1] := 2;
if open_base then
if init_spde then
begin
test_spde;
complete_driver;
end;
end.
Assertion Errors
It is possible for Speed Demon to abort because of an internal inconsistency. These
are called assertion errors and they should be reported to Robelle Solutions
Technology Inc. There is one assertion error that can be caused by problems in the
application software.
Each Speed Demon/V intrinsic checks for ten words of room in the status area. If
there is not enough room, Speed Demon/V is aborted with assertion error number
one. If this happens, you should check that the declaration of the status area is
correct. This problem could also be caused by a large portion of the application stack
being wiped out.
Calling Suprtool
Suprtool, including its Suprlink and Dbedit components, is a utility program, like
FCOPY or QUERY. You run it, either interactively or in a batch job, and feed it
commands to define a task to be done. How would a user application program invoke
Suprtool to perform a desired task? One way would be to use the COMMAND
intrinsic to launch a batch job that ran Suprtool. Unfortunately, the user program
would have little control over when the batch job started or finished.
To solve this problem, Robelle provides an interface routine that will run Suprtool
for a user program, and pass commands from the program to Suprtool (the same
commands you would type into Suprtool). This routine (procedure, subroutine,
intrinsic) allows user programs to "call" Suprtool. A typical use of this interface
would be for a COBOL program to ask Suprtool to extract a selected subset from a
large IMAGE dataset and write it to a disc file, which the COBOL program would
then read and format into a report.
Suprtool2 Routine
The interface routine is called Suprtool2 (not Suprtool). User programs written in
COBOL, COBOL/iX, FORTRAN, FORTRAN/iX, Pascal, Pascal/iX,
SPEEDWARE, SPL, or TRANSACT can call Suprtool2 and ask Suprtool to do any
of the normal Suprtool tasks such as copy, extract, or sort. The routine creates
Suprtool as a son process.
The user program instructs Suprtool by calling the Suprtool2 routine repeatedly with
Suprtool command lines. When the first Suprtool command is sent, the interface
builds temporary files which will be used for input and output to Suprtool. When the
user program sends an Exit command in a separate call to the interface, the interface
creates Suprtool as a son process. Finally, the interface prints the $stdlist message
file, if so directed by the user program.
Control Record
The user program must pass a special control record to the interface on each call. For
COBOL, we suggest that this control record be placed in the COPYLIB and copied
into programs that require the Suprtool interface. The most common error in using
the Suprtool2 interface is typing the control record incorrectly. Use the file
Cobol.Qlibsrc.Robelle instead. You can copy the control record directly into your
COBOL program with the following Qedit command (use /JOIN with EDIT/3000):
/add 50.1=cobol.qlibsrc.robelle
The definition of the control record, with the proper initializing values, is as follows:
01 supr-control.
05 supr-version pic s9(4) comp value 4.
05 supr-status pic s9(4) comp.
88 supr-ok value zeros.
88 supr-bad-msgfiles value 1.
88 supr-aborted value 2.
88 supr-create-error value 3.
88 supr-bad-total-type value 4.
05 supr-command-line pic x(256) value spaces.
05 supr-flags.
10 supr-priority pic x(2) value spaces.
88 supr-priority-cs value "CS".
88 supr-priority-ds value "DS".
88 supr-priority-es value "ES".
10 supr-maxdata pic s9(9) comp value 0.
10 supr-print-state pic x(2) value "ER".
88 supr-print-on-error value "ER".
88 supr-print-always value "AL".
88 supr-print-never value "NE".
10 supr-total-type pic x(2) value "CO".
88 supr-total-cobol value "CO".
88 supr-total-ascii value "AS".
10 supr-other-flags pic x(18) value spaces.
05 supr-totals pic s9(17) sign is trailing
separate character occurs 15 times.
05 supr-out-count pic s9(9) comp.
05 supr-workspace pic x(20) value spaces.
Status
The supr-status field returns a 0 if the command line was sent to Suprtool without
incident or one of the error numbers shown as 88 levels.
Command Line
The supr-command-line can contain any Suprtool command. Use the same format
that you use in typing commands into Suprtool. You don't need to enter commands
as a single string of 256 characters in a single call to the interface. You may use ";"
to send several commands in one string, or you may use the "&" mechanism to
continue commands.
The final call must have Exit as the command, alone and left-justified in the
command line. The final Exit command can be in uppercase or lowercase, but cannot
be abbreviated. MPE commands can be passed into the interface and Suprtool will
execute them.
Maxdata
The supr-maxdata contains the Maxdata in words for Suprtool. The default is 32,000,
but you can ask for a smaller stack using this parameter (e.g., 20,000). There is no
problem with reducing Maxdata when you plan to Sort. However, if you plan to do
copies without sorts, you should send Suprtool a Buffer 4096 command if you
reduce Maxdata. Otherwise, you are likely to get a Stack Overflow abort within
Suprtool or the error message "Unable to allocate buffer in DL area". If you want the
default, this field should contain a 0.
Print State
If the supr-print-state contains "AL", the output from Suprtool will always be printed
on $stdlist. If the state is "NE", the output will never be printed. If the state is "ER"
or blank, the output will be printed only if Suprtool aborts due to an error.
Total Type
The supr-total-type determines the format of the supr-totals array. If you call
Suprtool2 from COBOL, you should use "CO". The COBOL format is display (with
leading zeros) and a trailing sign. If the type is "AS", each total is returned left-
justified in the total field with a leading sign.
Totals
If you specify the Total command as part of an extract task, Suprtool2 returns the
totals in the supr-totals array. Totals are returned in exactly the same order in which
they were specified. If you are calling Suprtool2 from COBOL, never specify the
decimal-precision portion of the Total command. If your total includes an implied
decimal point, you will have to modify the supr-totals declaration to include an
implied decimal point (e.g., pic s9(15)v99 ...).
If you specify "AS" as the supr-total-type, each total is formatted as an 18-byte
string. In this case, you should specify the correct decimal-precision in the Total
command. The exponent portion of real totals is truncated by the Suprtool2 interface.
Out Count
After a successful call to the Suprtool2 interface, the supr-out-count is set to the
number of Suprtool output records. The supr-out-count is only returned after the
Suprtool2 call with the Exit command. Suprtool also puts this count in the
SuprtoolOutCount JCW, up to the maximum JCW value permitted, 65,535.
Workspace
The supr-workspace part of the record MUST contain spaces before the first call to
the Suprtool2 procedure.
Using Lib=
The installation chapter of the manual tells how to install the interface so that it is
available to every program. You can also install the interface routine in a SL file and
run your program with Lib=. Here is an example of how to add the Suprtool segment
from ST2USL.Pub to your existing SL file.
:run fcopy.pub.sys
>from=st2usl.pub.robelle;to=st2usl.pub;new
>exit
:segmenter
-buildsl sl.pub,400,4 {fails if you already have an SL}
-sl sl.pub
-usl st2usl.pub
-addsl suprtool
-exit
:cobol tool2cob.source
:prep $oldpass,tool2cob.program;cap=ph
:save tool2cob.program
:run tool2cob.program;lib=p
The MPE :prep command prints a warning message when you specify cap=ph. You
may ignore this message or specify cap=ia,ba,ph on your :prep command. If your
program requires other capabilities, they should also be specified (e.g., cap=ph,ds).
Warning: The Suprtool2 interface will change over time. The interface should never
be installed directly into a program file. It should only be installed into SL files.
You require PH capability in order to use the Suprtool2 interface. The interface is
installed in XL files. The following commands demonstrate how to compile and link
your program to use the native mode Suprtool interface.
:cob85xl example.source
:link from=$oldpass;to=example.pub;cap=ph
:run example.pub;xl='st2xl.pub.robelle'
User XL Files
You can use MPE/iX's Linkedit command to add the Suprtool2 interface to your own
XL file. For example,
The Replace option is not in all versions of Linkedit. If your version does not allow
Replace, and you already have Suprtool2 in your XL file, you will need to manually
purge the existing module before copying the new one:
:linkedit
-xl xl.pub
-purgexl module=suprtool.asm
Suprtool2 can successfully be installed into the System XL file, but this is not
recommended by HP. Suprtool2 can be combined into an XL file with other Robelle
XL files, except Qcompxl (a part of Qedit).
Moving Suprtool
To change the location of the Suprtool program file, you must specify a JCW and use
a :File command for the program file:
:setjcw suprtool2filecommand = 2
:file suprtool = suprtool.pub.dev
:run example.pub;lib=p
We suggest you add the Setjcw and :File commands to a logon UDC. This way,
every invocation of the Suprtool2 interface will use the copy of Suprtool in the Pub
group of the Dev account.
Previous versions of the Suprtool2 interface accepted a value of 1 for the
suprtool2filecommand JCW. In this case, you must specify a file command for
Suprtool.Pub.Robelle. We don't recommend you do this, since this only works on
MPE/iX and not on MPE V.
Lib=
The Suprtool2 interface looks at the Suprtool2lib JCW for which library to use. The
values of this JCW correspond to the description of the library portion of the flag
variable of the create intrinsic. These values are:
JCW Value uses lib
0 Lib=S
1 Lib=P
2 Lib=G
3 <invalid>
If the Suprtool2lib JCW does not exist, the Suprtool2 interface runs Suprtool with
Lib=S. To have the Suprtool2 interface always invoke Suprtool with Lib=P, you
would use this command:
Slist234 File
Some previous versions of the Suprtool2 interface created a temporary file called
Slist234, which contained the $stdlist from the Suprtool run. A few programs were
written to read this file. By default, the Suprtool2 interface no longer creates this file.
If your program needs it, use the following JCW to force the interface to create and
save the Suprtool listing in the temporary Slist234 file:
:setjcw saveslist234 = 1
Lockwords on Suprtool
To tell the Suprtool2 interface that the Suprtool program has a lockword you can use
the suprtoolfilecommand facility.
file suprtool=suprtool/secret.pub.robelle
setjcw suprtool2filecommand = 2
run prog;lib=p
COBOL Example
Below is a sample COBOL program named TOOL2COB. It calls the Suprtool2
interface procedure. The purpose of TOOL2COB is to print selected item master
entries from an inventory database, sorted by item number. The program uses
Suprtool to create a disc file named SELITEM, filled with the selected item numbers
and their descriptions. Then it reads the disc file and prints a report on the line
printer.
The database used in this example is called INVORY, and the dataset is called
INVREC. Here is a QUERY FORM listing of the dataset:
SET NAME:
INVREC,DETAIL
ITEMS:
ITEM, X8 <<SEARCH ITEM>>
DESCRIPT, X50
WEIGHT, J2
STD-PKG, X12
SELLPRCE, J2
SPUOM, X2
SPLEVEL, 3J2
SPMULTIR, 3J1
CPMULTIR, J1
INDIC, X2
VENDORPR, X6
SUPPNUM, X2
PRCEDATE, X6
************************************************************
* *
* TOOL2COB *
* *
* FUNCTIONAL OVERVIEW: uses Suprtool to extract and print*
* *
* INPUT: Invrec set of INVORY database. *
* All items with spec prefix (4 char), sorted. *
* *
* OUTPUT: print report on LINE-PRINTER *
* *
* TERMINATED BY: eof or error *
* *
* PREP WITH: cap = ph *
* *
* REV ,INIT,DATE , REASON: *
* 00, rmg, 19 Apr83, started first implementation. *
* 01, djg, 25 Jan84, modified the control record to *
* include the version number. *
* 02, djg, 09 Nov87, modified to include totals in the *
* control record. *
* 03, djg, 10 Aug90, modified for version 4 control rec. *
* *
************************************************************
input-output section.
file-control.
select line-printer assign to "LINEPRT,UR,A,LP".
select selitem assign to "SELITEM".
data division.
file section.
fd selitem
data record is item-record.
01 item-record.
05 item-number.
10 item-prefix pic x(4).
10 item-suffix pic x(4).
05 item-description pic x(50).
fd line-printer
data record is line-record.
01 line-record pic x(132).
$page "constants"
working-storage section.
01 true-value pic x value "T".
01 false-value pic x value "F".
01 revision-no pic 99 value 03.
************************************************************
* *
* P R O C E D U R E D I V I S I O N *
* *
************************************************************
procedure division.
00-main section.
perform 02-print-item
until end-of-items.
close selitem.
close line-printer.
00-main-exit. goback.
01-call-suprtool.
call "SUPRTOOL2" using supr-control.
if not supr-ok then
display "Error: Unable to sort the invrec dataset"
display " "
display "Suprtool interface error number: ",
supr-status.
02-print-item.
FORTRAN Example
FORTRAN programmers may use the Suprtool2 interface to invoke Suprtool from
within a FORTRAN program. The control area may be in COMMON or it may be
FORTRAN 66
FORTRAN 66 users may need to increase the size of Maxdata for your program in
order to use the interface. The $HP3000_16 ALIGNMENT$ option is not needed by
FORTRAN 66 and if it is not deleted a warning is produced by the compiler.
FORTRAN 66 produces a warning on the line call setjcw, but this warning
may be safely ignored.
TRANSACT Example
To call the Suprtool2 interface from a TRANSACT program, you must first define
the Suprtool2 control record. We suggest that the control record be included from the
file Transact.Qlibsrc.Robelle. The TRANSACT definition of the control record, with
the proper initializing values, is as follows:
list supr-control;
Below is a sample program that uses the TRANSACT include file to call the
Suprtool2 interface. The program uses Suprtool to find two totals and the output
count of selected records from the sales-hist dataset of the SH database. Be careful
not to create commands greater than 256 characters in length.
LIST TOTAL1,
TOTAL2,
CUSTNO;
!INCLUDE(TRANSACT.QLIBSRC.ROBELLE)
DATA(SET) CUSTNO;
DISPLAY
"There are ": SUPR-OUT-COUNT, EDIT="ZZZZZZZZ^":
"records for customer ": CUSTNO:
"Period 1 Qty this year", COL=5, LINE: TOTAL1:
"Last year ": TOTAL2;
EXIT;
CALL-SUPRTOOL2:
PROC SUPRTOOL2((SUPR-CONTROL));
IF (SUPR-STATUS) <> 0 THEN
DISPLAY "SUPRTOOL2 INTERFACE ERROR ", LINE = 2:
SUPR-STATUS, JOIN = 1:
"ON COMMAND:",LINE:
SUPR-COMMAND;
RETURN;
END SUPREX;
name: tool2spl
purpose: test the suprtool interface.
prep: cap = ph
run: run with parm=2 for print stdlist always.
run with parm=3 to print stdlist never.
>>
define current'version = "(Version 0.6)"#;
$page "Global variables of the tool2spl program"
equate
wl'supr'control = 290
,wl'supr'command'line = 128
,wl'supr'totals = 9
,bl'supr'totals = wl'supr'totals * 2
,max'supr'totals = 15
;
equate supr'ok = 0
,bad'msgfiles = 1
,suprtool'aborted = 2
,create'error = 3
;
integer
copy'of'parm << copy of "ACTUAL'PARM" >>
,actual'parm=q-4 << run ;parm=nn (use in mainline) >>
,input'length << used only with input defines >>
;
logical
batch << run in batch mode >>
;
equate
rtn = 13 << carriage return in ascii >>
,bell = 7 << ring the bell in ascii >>
,bl'inbuf = 86
,bl'outbuf = 132
,wl'outbuf = bl'outbuf/2
,wl'inbuf = bl'inbuf/2
;
define
end'if = end# ,end'else = end# ,end'while= end#
,end'case = end# ,end'do = end# ,end'proc = end#
,end'subr = end#
,p = begin move outbuf := #
,output=,2;output'(*);end#,err=,2;err'(*);end#
,ask=,2;ask'(*);end#, warn =,2;warn'(*);end#
,trim = while input'length>0 and
inbuf'(input'length-1)=" " do
intrinsic
ascii, aritrap, binary, calendar, clock, dascii,
dateline, dbinary, debug, genmessage, print, quit, readx,
terminate, who, xaritrap, xcontrap, xlibtrap, xsystrap,
setjcw;
procedure err'(address);
value address; integer address; << in outbuf >>
begin integer output'length;
integer array errbuf(0:10);
move errbuf:=([8/bell ,8/10]<<lf>>,"ERROR: ");
print(errbuf,5,%320);
<< check length for overflow of buf >>
output'length := (address-@outbuf)*2;
if output'length > bl'outbuf then begin
print(outbuf,-bl'outbuf,0);
quit(111);
end'if;
print(outbuf,-output'length,0);
print(errbuf,0,0);
end'proc; <<err'>>
procedure blank(buf,count);
value count;
integer count;
procedure b'blank(buf,count);
value count;
integer count;
byte array buf;
begin
if count > 0 then begin
buf:=" ";
if (count:=count-1)>0 then
move buf(1):=buf,(count);
end'if;
end'proc; <<b'blank>>
procedure print'totals;
begin
byte array
blank'total(0:bl'supr'totals)
;
byte pointer
supr'totals'
;
integer
total'index
,total'offset
;
logical
first'time
;
b'blank(blank'total,bl'supr'totals);
first'time := true;
total'index := 0;
end'proc; <<print'totals>>
$page "call'suprtool2"
<<
pass a command line to suprtool
>>
procedure call'suprtool2;
begin
integer length;
subroutine print'command;
begin
length := 256;
do length:=length-1 until
length<0 or b'command'line(length)<>" ";
length:=length+1;
print(supr'command'line,-length,0);
end'subr; <<print'command>>
suprtool2 (supr'control);
if supr'status <> supr'ok then begin
p "Suprtool2 interface call has failed!" err;
print'command;
p "Error number = " ask;
print'int(supr'status);
setjcw(-1);
end'if;
blank(supr'command'line,wl'supr'command'line);
end'proc; <<call'suprtool2>>
$page "init'tool2spl"
<<
check logon mode, parm values, etc.
see if we can send one command to suprtool.
>>
init'tool2spl := false;
who(temp);
batch := temp.(12:2) = 2;
blank(supr'control,wl'supr'control);
supr'version := 4;
supr'maxdata := 0d;
move supr'print'state := "ER";
move supr'total'type := "AS";
if copy'of'parm=2 then
move supr'print'state := "AL"
else
if copy'of'parm=3 then
move supr'print'state := "NE";
p "Please hit RETURN for EXIT at end. Thanks" output;
move supr'command'line :=
":COMMENT Test of Suprtool Interface";
call'suprtool2;
if supr'status=0 then begin
init'tool2spl := true;
print(outbuf,0,0);
end'if;
end'proc; <<init'tool2spl>>
$page "mainline"
copy'of'parm := actual'parm;
end. <<tool2spl>>
C Example
Below is a C program to invoke Suprtool through the interface routine.
call_suprtool2()
Pascal Example
Below is a Pascal program to invoke Suprtool through the interface routine. The
example as given is for use with Pascal/iX. Note that the $HP3000_16$ compiler
option is set. This is required because Suprtool2's control record uses 16-bit
alignment instead of Pascal/iX's default 32-bit alignment.
For Pascal/V, change the $set nm$ line to $set 'nm=false'$
program test(input,output);
const
MaxSuprCmdLen = 256;
type
SuprCmdStr = string[MaxSuprCmdLen];
SuprTotalStr = packed array[1..18] of char;
SuprControlRec = record
version : shortint;
status : shortint;
command : packed array[1..MaxSuprCmdLen] of char;
priority : packed array[1..2] of char;
maxdata : integer;
print_state: packed array[1..2] of char;
total_type : packed array[1..2] of char;
other_flags: packed array[1..18] of char;
totals : array[1..15] of SuprTotalStr;
out_count : integer;
workspace : packed array [1..20] of char;
end;
var
SuprControl : SuprControlRec;
procedure InitST2;
var
i: integer;
begin
SuprControl.version := 4;
SuprControl.status := 0;
SuprControl.priority[1] := 'C';
SuprControl.priority[2] := 'S';
SuprControl.maxdata := 0;
SuprControl.print_state[1] := 'A';
SuprControl.print_state[2] := 'L';
SuprControl.total_type[1] := 'A';
SuprControl.total_type[2] := 'S';
for i:=1 to 20 do
SuprControl.workspace[i] := ' ';
for i:=1 to MaxSuprCmdLen do
SuprControl.command[i] := ' ';
end;
procedure CallSuprtool2;
begin
suprtool2( SuprControl );
if (SuprControl.status<>0) then
begin
writeln('Suprtool2 interface call has failed!');
writeln('Error number = ', SuprControl.status:1 );
end;
end;
begin
InitST2;
ST2Cmd( 'in infile;out $null');
ST2Cmd( 'exit');
writeln( SuprControl.out_count );
end.
SPEEDWARE Example
You can call the Suprtool2 interface from a SPEEDWARE V.6 or V.7 program. Use
the Supr-Control area to pass commands to Suprtool2.
There are 3 ways to get Speedware to find the Suprtool2 routine.
1. Using Designer. In the Operating Options (OPEO) screen add the XL
to Local 4GL Parms. : XL="ST2XL.PUB.ROBELLE". This is the
recommended approach for SPEEDWARE V.6.
2. Using Linkedit. Copy the routines into
SPWXL.SPWxxxxx.SPEEDWRE. This is the XL that Speedware
provides for this purpose. This could become a problem as
SUPRTOOL2 changes over the years and the new version is not
updated into SPWXL.
3. Using RUN. Add the XL to the run command. n.b. If you do this you
will also need to include Speedware's database interface XL called
DBMSXL.
:RUN SPW4GL.SPWxxxxx.SPEEDWRE
;XL="DBMSXL.SPWxxxxx.SPEEDWRE,ST2XL.PUB.ROBELLE"
MENU:
SET WINDOW(ROW=4,COL=4,HEIGHT=15,WIDTH=40);
BRANCH "Copy D-SALES to file" DO REPORT-SUPRTOOL2;
EXIT;
REPORT-SUPRTOOL2:LISTING;
SET TITLE("Calling Suprtool2");
SET WINDOW;
DCL
SUPR-CONTROL FORMAT (TYPE = CHAR, BYTES =582),
SUPR-VERSION FORMAT (TYPE = INT , BYTES = 2, LEN= 4)
REDEFINES (SUPR-CONTROL[1:2]),
SUPR-STATUS FORMAT (TYPE = INT , BYTES = 2, LEN= 4)
REDEFINES (SUPR-CONTROL[3:4]),
SUPR-COMMAND-LINE FORMAT (TYPE = CHAR, BYTES = 256)
REDEFINES (SUPR-CONTROL[5:260]),
SUPR-PRIORITY FORMAT (TYPE = CHAR, BYTES = 2)
REDEFINES (SUPR-CONTROL[261:262]),
SUPR-MAXDATA FORMAT (TYPE = INT , BYTES = 4, LEN= 9)
REDEFINES (SUPR-CONTROL[263:266]),
SUPR-PRINT-STATE FORMAT (TYPE = CHAR, BYTES = 2)
REDEFINES (SUPR-CONTROL[267:268]),
SUPR-TOTAL-TYPE FORMAT (TYPE = CHAR, BYTES = 2)
REDEFINES (SUPR-CONTROL[269:270]),
SUPR-FUTURE-FLAGS FORMAT (TYPE = CHAR, BYTES = 18)
REDEFINES (SUPR-CONTROL[271:288]),
SUPR-TOTALS (15) FORMAT (TYPE = ZONE, BYTES = 18,)
REDEFINES (SUPR-CONTROL[289:558]),
SUPR-OUT-COUNT FORMAT (TYPE = INT , BYTES = 4, LEN= 9)
REDEFINES (SUPR-CONTROL[559:562]),
SUPR-WORKSPACE FORMAT (TYPE = CHAR, BYTES = 20)
REDEFINES (SUPR-CONTROL[563:582]);
(* initial values *)
CALCUL 4 = SUPR-VERSION,
0 = SUPR-STATUS,
'DS' = SUPR-PRIORITY,
'ER' = SUPR-PRINT-STATE,
'AS' = SUPR-TOTAL-TYPE,
' ' = SUPR-WORKSPACE;
END;
END;
EXIT;
Restrictions
When calling the Suprtool2 interface, you signal the end of commands and the start
of processing by passing the Exit command. If you specify the Link command with
no parameters, the interface switches to Suprlink. When you have passed all the
Suprlink commands, do not end the Suprlink task by passing Exit. This will end the
Suprlink task, but it will also result in a Suprtool error. There are two solutions to
this problem:
1. Specify a substring of Exit (for example, E).
2. Specify all Suprlink commands with Suprtool's Link command (e.g.,
Link Exit).
COBOL Example
Below is a sample COBOL program named LINK2COB, which calls the Suprtool2
interface procedure. Its purpose is to print the notes for a selected product with the
associated company name sorted by serial number. The program uses the Suprtool2
interface to do the following:
1. Select and sort records from the notes dataset.
2. Extract specific fields and sort the entire Customer dataset.
3. Use Suprlink to link the Notes and Customer files into the Notecust
file.
The program then reads the Notecust file and prints a report on the line printer.
The database used in this example is called Cust, and the datasets are called Notes
and Customer. Here is a Suprtool Form listing of the datasets:
>form customer
CUSTOMER Master
Entry:
SERIAL-NO U4 <<Search-Field>>
COMPANY-NAME X60
ALTERNATE-NAME X60
CONTACT-NAME X40
CONTACT-TITLE X40
PHONE-NO X20
CONTACT-NOTE X40
ADDRESS 4X40
COUNTRY X12
CUSTOMER-NOTE X40
RELATED-NAME X60
SORTING-SEQ U16
OMNIDEX-SI J2
TIMESTAMP-INIT U16
Capacity: 1499 Entries: 1250 Entry Length: 286
***********************************************************
* *
* link2cob *
* *
* functional overview: Uses Suprtool to extract *
* and print. *
* input: Notes dataset of the cust database. *
* All notes with a specified product *
* code and the related customer name *
* from the customer dataset. *
* *
* output: print report on line-printer *
* *
* terminated by: eof or error *
* *
* prep with: cap = ph;maxdata=15000 *
* *
* rev#,init,date , reason: *
* 01 , djg,15 Sep88, started first implementation. *
* 02 , djg,10 Aug90, version 4 of the control record. *
* *
***********************************************************
input-output section.
file-control.
select line-printer assign to "LINEPRT,,,LP".
select notecust-file assign to "NOTECUST".
data division.
file section.
fd notecust-file
data record is item-record.
01 notecust-record.
05 notecust-serial-no pic x(4).
05 notecust-product-code pic x(2).
05 notecust-text-line pic x(80).
05 notecust-company-name pic x(60).
fd line-printer
data record is line-record.
01 line-record pic x(132).
$page "constants"
working-storage section.
01 true-value pic x value "T".
01 false-value pic x value "F".
01 revision-no pic 99 value 2.
$page "variables"
01 report-detail.
05 rept-text-line pic x(80).
$include cobol.qlibsrc.robelle
***********************************************************
* *
* p r o c e d u r e d i v i s i o n *
* *
***********************************************************
procedure division.
00-main section.
perform 10-create-notecust-file
thru 10-create-notecust-file-exit.
perform 20-produce-report
thru 20-produce-report-exit.
00-main-exit. goback.
10-create-notecust-file section.
perform 10-10-create-notefile.
perform 10-20-create-custfile.
go to 10-create-notecust-file-exit.
10-10-create-notefile.
move "get notes" to supr-command-line.
perform 10-90-call-suprtool.
move if-command to supr-command-line.
perform 10-90-call-suprtool.
move "extract serial-no" to supr-command-line.
perform 10-90-call-suprtool.
move "extract product-code" to supr-command-line.
perform 10-90-call-suprtool.
move "extract text-line" to supr-command-line.
perform 10-90-call-suprtool.
move ":purge notefile" to supr-command-line.
perform 10-90-call-suprtool.
move "output notefile,link" to supr-command-line.
perform 10-90-call-suprtool.
move "sort serial-no" to supr-command-line.
perform 10-90-call-suprtool.
move "sort sort-item,desc" to supr-command-line.
perform 10-90-call-suprtool.
move "xeq" to supr-command-line.
perform 10-90-call-suprtool.
10-20-create-custfile.
move "get customer" to supr-command-line.
perform 10-90-call-suprtool.
move ":purge custfile" to supr-command-line.
perform 10-90-call-suprtool.
move "output custfile,link" to supr-command-line.
perform 10-90-call-suprtool.
move "sort serial-no" to supr-command-line.
perform 10-90-call-suprtool.
move "extract serial-no" to supr-command-line.
perform 10-90-call-suprtool.
move "extract company-name" to supr-command-line.
perform 10-90-call-suprtool.
move "xeq" to supr-command-line.
perform 10-90-call-suprtool.
10-30-link-notefile-custfile.
move "link" to supr-command-line.
perform 10-90-call-suprtool.
move "input notefile by serial-no"
to supr-command-line.
perform 10-90-call-suprtool.
move "link custfile" to supr-command-line.
perform 10-90-call-suprtool.
move ":purge notecust" to supr-command-line.
perform 10-90-call-suprtool.
move "output notecust" to supr-command-line.
perform 10-90-call-suprtool.
move "e" to supr-command-line.
perform 10-90-call-suprtool.
10-90-call-suprtool.
call "SUPRTOOL2" using supr-control.
if not supr-ok then
display "Error: Unable to call Suprtool2"
display " "
display "Suprtool interface error number: ",
supr-status.
10-create-notecust-file-exit. exit.
20-produce-report section.
perform 20-10-read-notecust
until end-of-notecust.
go to 20-produce-report-exit.
20-10-read-notecust.
read notecust-file at end
move true-value to end-of-notecust-flag.
if not end-of-notecust then
perform 20-20-process-record.
20-20-process-record.
if notecust-serial-no <> head-serial-no then
perform 20-30-print-header.
move notecust-text-line to rept-text-line.
write line-record from report-detail.
20-30-print-header.
move spaces to line-record.
write line-record.
move notecust-serial-no to head-serial-no.
move notecust-company-name to head-company-name.
write line-record from report-header.
20-produce-report-exit. exit.
Error Numbers
Suprtool2 returns error numbers in the status parameter of the workspace. For most
errors, a message is also displayed on $stdlist. The following summarizes the form of
Suprtool2 error messages and the error numbers returned.
Messages On $Stdlist
Most Suprtool2 errors result in a message being displayed on $stdlist. All Suprtool2
error messages start with "ST2 -" making them easier to identify. For example,
Error: ST2 - Caller lacks PH capability
2 - Suprtool Aborted
If the Suprtool task has any errors, Suprtool is terminated with the fatal JCW set. In
this case, Suprtool2 returns error #2 to indicate that the requested task failed. If the
print-state in the workspace was set to "ER" (error) or "AL" (always), the output
from Suprtool will be displayed on $stdlist. If the print-state is "NE" (never), nothing
is displayed on $stdlist.
Commonly-used Terms
Batch
Suprtool operates in session mode or batch mode. In batch, any error message
causes Suprtool to quit. Warning messages do not cause an abort. If an error occurs,
Suprtool sets the Job Control Word to flush the remainder of the job.
In batch mode, Suprtool does not prompt for missing information as it does in
session mode. Instead, it attempts to choose the alternative that has the least chance
of destroying valid data. For example, if the output file is a duplicate file name in
batch mode, Suprtool saves the new output file with a "made up" name (Outputnn,
where nn is from 00 to 20), prints a warning message, and aborts. Another example
is that of missing database passwords. In session mode, Suprtool prompts for the
password; in batch mode, it uses the CREATOR password instead.
Pseudo-Batch Tasks
During a canned on-line task, such as passing usefiles to Suprtool, you can "fool"
Suprtool into responding YES to operational questions. For example, if one of the
canned tasks requires Suprtool to output myfile,erase, then Suprtool asks
the question
ERASE all records from this OUTPUT file [no]?
You can avoid typing "yes" in response to this question by invoking Suprtool with:
:run suprtool.pub.robelle; &
stdin=$null; info="use filename"; parm=4
Blocksize
The block size of a file is the record length multiplied by the blocking factor. MPE
permits block sizes up to 32,000 words, but Suprtool restricts the total block size.
When copying an MPE file, the maximum block size of either the input or output file
is 14,336 words. If Suprtool detects an input or output file with a block size larger
than 14,336 words, it prints one of the following error message:
The input blocksize is greater than 14336 words
The output blocksize is greater than 14336 words
Chains
A chain is a group of related records in an IMAGE dataset linked by a key value.
The Chain command is used to force Suprtool to use IMAGE search-paths when
reading the input source. The Chain command can also be used with master datasets,
even though master datasets only have one record per key value.
Control Character
You create a control character by holding down the Control key while you strike
another key. "Y" plus Control generates Control-Y. These are normally nonprinting
characters, but they may do things to your terminal. For example, Control-G rings
the bell.
Suprtool uses control characters for a number of purposes:
In the Before command, control characters specify the edit functions: Control-D for
delete, Control-B for before, etc.
Control-Y stops execution of the current Suprtool task. Suprtool prints a status report
and asks if you would like to stop the operation.
Control-H causes the cursor to backspace one position in the current line.
Control-X cancels the current input line.
Control-S pauses a listing that is printing too fast for you to read.
Control-Q resumes a listing that you have paused with Control-S.
Database
A database in Suprtool is an IMAGE/3000 database or an SQL database. A database
is specified in the Base or Open command. Several commands (e.g., Get, Chain, or
Select) do not work until a database has been specified. Some commands only work
with IMAGE/3000 databases and other commands only work with SQL databases.
An IMAGE database consists of datasets (files) which in turn consist of fields. An
SQL database consists of tables or views, and each table or view consists of
Dataset
A dataset is a file within an IMAGE database. The Form command provides path
information in DBSCHEMA format, including entry length and blocking factor on
the dataset description. Use Get dataset to access the data within a specific IMAGE
dataset.
Datasets have an implied structure that you specify when you create the database.
Use the Form command to obtain a list of fields in the current dataset. Fields are
used by other Suprtool commands and they are described below.
Errors
Errors are messages printed by Suprtool indicating a fatal problem in the task which
prevents it from completing. In batch mode, errors cause the job to terminate. Error
messages are further described in Appendix A.
Field
A field is a portion of a record. When you access an IMAGE dataset, this makes
Suprtool aware of the IMAGE fields in the dataset. When you access an SQL
database with the Select command, Suprtool is aware of each column name (fields
and columns are synonymous in Suprtool). The Define command allows you to
define new fields or redefine existing fields to have new sizes or data-types. Use
Define to get at bytes of interest within existing fields and to give them an
appropriate name. Then you can refer to the defined field in other commands (e.g.,
Extract, If, etc.). The following commands all contain a field:
>if balance>10000
>sort account
>extract a,b
Filename
A filename is any valid filename and is used in Suprtool commands to identify the
input source, specify the output destination, or to specify an external file to be
accessed in the Table or Use command. File names may be enclosed in quotes. The
following commands all contain file names:
>input xyz
>output *out
>use supruse
>input "xyz"
MPE Command
If Suprtool does not recognize a command as one of its own, it treats the command
as an MPE command. Examples of MPE commands are LISTF to get a list of your
files; TELL to send messages to other users; SHOWTIME to get the date and time;
SHOWJOB to get a list of other users on the computer, and STREAM to start a job.
>showjob
In Suprtool/V only MPE commands allowed in "break" mode are allowed. This
means that commands such as RUN cannot be executed from within Suprtool/V.
Suprtool/V will not execute any User Defined Commands or command files.
Suprtool/iX can execute any MPE/iX command, UDC or command file.
Strings
Suprtool expects all strings to be surrounded by a pair of single or double quotes (' or
"). When Suprtool knows the length of a field, it pads strings with trailing spaces.
For example,
>define long,1,125 {125 character field}
>extract long="abcef" {Suprtool adds 120 spaces}
Subscript
A subscript is used to specify one-of-many fields in a repeated item. Within IMAGE
it is possible to specify repeated fields. For example:
costs, 5J2;
The item COSTS consists of five double integers. You select one element of a
compound field by specifying a subscript in parentheses (the first element is 1, not
0). For example, if you wanted to select the input records where the second cost was
greater than 10000, you would use:
>if costs(2) > 10000
The (2) portion of the command is the subscript. The default subscript is the first
sub-item for Total, Define, Sort, and If, but the entire compound item for Extract.
Table does not allow subscripts -- it always uses (1). The If command has another
syntax, using up to three subscripts, allowing you to refer to subfields without Define
(see the If command for details).
Tables
Tables are created with the Table command and they are used for testing in the If and
Chain commands. Tables are used by the $lookup function of the If command. Use
tables when you wish to check a data field for many different test values. You may
also use tables to specify the records to search for with the Chain command.
Table can also mean a table from an SQL database.
Third-Party Indexing
In MPE/iX 4.0, Hewlett-Packard added support for third-party indexing (TPI) to
TurboIMAGE/XL. TPI is a seamless interface to the indexing products of Dynamic
Information Systems Corporation (DISC) and Bradmark Technologies Inc. Their
products, Omnidex and Superdex, respectively offer generic and keyword search
capabilities, through the standard interface in TurboIMAGE/XL.
TPI is only available to users on MPE/iX 4.0 or later. The database must be indexed
using either Omnidex or Superdex, and must be enabled for indexing using
DBUTIL.
If a database has TPI enabled, Suprtool can take advantage of the generic search
capability in the Chain command. The Form command shows the third-party indexes
that correspond to IMAGE fields and any byte-type indexes that do not correspond to
Warnings
Warnings are messages produced by Suprtool to let you know about nonfatal
conditions that might affect your task. Some common warning messages and their
meanings are described in Appendix A.
Yes or No
When Suprtool asks a question that requires a YES or NO answer, "Y", "OUI", "JA",
and "SI" are accepted as "YES", and any other answer is considered "NO".
Special Characters
Special Characters
Certain non-alpha and non-numeric characters like > and : have special meaning
within Suprtool. See the descriptions that follow. As well, the term "special"
designates a class of characters in the If command.
, Means a List
Comma (,) in Suprtool commands is used to separate parameters:
>base actrec.data,3 {open the database exclusively}
>key 1,4,double {specify a double-integer key}
>if acct=764523,456732,98765
Commas are optional in some Suprtool commands (e.g., Output), but are required in
others (e.g., Extract).
, is the abbreviation for the Redo command.
,. is the abbreviation for the Do command.
,, is the abbreviation for the Listredo command.
% Means Percentage
In the Numrecs command, use % to indicate the number of output records as a
percentage of the input file size.
>numrecs 10%
,
)
, means a list ........................................................................ 490 ) means end parameter ........................................................ 490
:
{
: for O/S commands............................................................. 489 { start command line comment ........................... 283, 336, 379
!
}
! for HP-UX commands ...................................................... 489 } end command line comment ............................ 283, 336, 379
! for O/S commands ............................................................ 489
@
?
@ matches anything ............................................................ 488
? (prompt for database password) ....................... 112, 220, 489
? means alphanumeric (pattern) .......................................... 489
*
'
* means $stdinx / $stdlist / file command ........................... 487
*tape, needs =reply.............................................................. 193
' means string ....................................................................... 490
/
"
/ means range of records ..................................... 167, 192, 490
" means string ...................................................................... 490
"closed" tables ..................................................................... 254
\
(
\ means range of fields ........................................................ 142
<
4
< means less than ................................................................ 488 4096, record size ................................................................... 75
<> means not equal to ......................................................... 488 4GLs .............................................................................. 79, 410
=
A
= means calculator....................................................... 336, 487 A4-size paper ...................................................................... 205
= means equal to.................................................................. 487 aammdd date format ...................................................... 96, 196
= set name parameter .......................................... 160, 191, 487 abbreviating commands .............................. 107, 283, 335, 378
== means matches pattern ................................................... 488 Abort option on Exit............................................ 135, 296, 384
=Input option of Output ...................................................... 214 absolute field definition....................................................... 121
absolute value function ............................................... 145, 178
accessing Speed Demon ...................................................... 417
>
accuracy in numeric expressions ......................................... 177
Add command ............................................................. 111, 342
> changing the prompt character ......................................... 246 Add command, locking ....................................................... 332
> is the prompt character ..................................................... 488 Add Dates ............................................................................ 142
> means greater than ........................................................... 488 adding records to a dataset .................................................. 220
>< means doesn't match pattern .......................................... 488 All option, Dbedit................................................................ 338
Allbase applications .............................................................. 54
Allbase database .................................................................. 212
Allbase date and time ............................................................ 55
$
Allbase, restrictions ............................................................... 55
alphanumeric string test ...................................................... 179
$abs function ............................................................... 145, 178 alternate values ............................................................ 173, 254
$atoe, Extract function ........................................................ 160 alternatives to the If command ............................................ 171
$Clean function ................................................................... 120 Analyzing Performance Data .............................................. 103
$Counter function ................................................................ 146 AND operator ...................................................................... 172
$date function .............................................................. 140, 182 appending to a file ....................................................... 210, 248
$date, how it works ............................................................... 95 appending, Hpmodify .......................................................... 224
$days.................................................................................... 184 application systems ............................................................... 89
$days function ..................................................................... 141 APS, date format ................................................................. 196
$etoa, Extract function ........................................................ 160 arithmetic expressions ................................................. 144, 177
$file, Total command .......................................................... 259 arithmetic trap ..................................................................... 271
$FindClean function ............................................................ 180 Arithmetic, Set option ......................................................... 230
$invalid .......................................................................... 97, 183 ascending order ........................................................... 200, 252
$lookup data, If command ............................................. 32, 173 ASCII option ................................................................. 43, 217
$lookup function ................................................................. 173 ASK MANMAN date selection .......................................... 196
$lookup, performance.......................................................... 174 ASK option.......................................................................... 216
Z
Y
Zero command .................................................................... 324
Year 2000 ............................................................................ 233 zoned constants ................................................................... 139
Year 2000 testing ................................................................ 101 zoned-decimal, illegal digits ............................................... 372
yes answer to questions ............................................... 270, 487 Z-type TPI-keys .................................................................... 89