| CCAPRINT:
A Newsletter for Model 204® and System 1032® Users |
July
10, 2003
|
 |
System 1032
Lesser Known Features: Part
4
By Tym Stegner
In this edition of
CCAPRINT, as part of my on-going series, I am highlighting the lesser-known
features of System 1032 that support data integrity and data presentation.
Ensuring That
System 1032 Data Is Reliable
A System 1032 dataset
is a robust data storage medium that takes advantage of the data security
features of the OpenVMS operating system. In addition, you can also ensure
increased integrity of a dataset in System 1032 by using its own dataset
journaling.
As part of a dataset
definition, the JOURNAL command designates an external file where update
transactions are managed. Before an update is executed on the dataset, System
1032 saves a copy of the disk blocks to be changed to the journal file and
sets a checkpoint in the journal file for that update. A checkpoint is a
place in a routine where enough information is stored to restart a computation
or job run, if needed. The checkpoint contains the following information:
- Checkpoint identification
number
- Username of the
process issuing the update command
- Date and time of
the checkpoint posting
- A damage notation,
if System 1032 detected any damage since the last update
A dataset journal logs
execution of the following commands:
ADD
|
ADMIT |
ALLOCATE |
APPEND |
| CHANGE |
DELETE |
DUMP DS_OUTPUT |
INSERT |
| MODIFY |
PREVENT |
REMOVE |
UNDELETE |
Restoring
a Dataset to a Valid State
The primary purpose of
the journal file is to provide a way to return a dataset to a previously valid
state. This capability is provided by the RECOVER command that can restore
a damaged dataset back to:
- A specific checkpoint
- A savepoint
- A specific time
During RECOVER processing,
System 1032 displays the identification of all the checkpoints that precede
the specified target checkpoint, in reverse chronological order. When finished,
RECOVER processing truncates the journal and the damage history files, and
clears the datasets current selection set.
Updates that followed
the specified checkpoint or time are discarded. As journaling does not store
any data about the actual updates, there is no way to roll a dataset forward
after a recovery. The previous updates must be reapplied.
You can examine a datasets
journal file using the SHOW JOURNAL INFORMATION command.
Using
the Journal File
A dataset journal is activated
only after the dataset is loaded. In addition, ADD commands are journaled
after the ADD command has completed execution, not while it is processing.
Adding multiple records via an ADD REPEATING command is treated as a single
update event.
Non-update checkpoints
can be posted using the SAVEPOINT command. A savepoint contains all the
checkpoint information, plus a checkpoint name. Savepoints might be generated
at the beginning of an update run, or at the beginning or end of a day.
The SAVEPOINT command also has the option to purge a journal file by creating
a new journal file, and creating an initial checkpoint.
Creating
Readable, Logical Reports
To generate paged output
to one or more files, reports in System 1032 are generally built on the
PRINT command, often in conjunction with the PAGE and WRITE commands. These
commands control the display or arrangement of the data at your terminal,
on printer paper or address labels, or as simply stored in a file.
Controlling
Column Spacing
The $PRNT_COLSPC system
variable controls the default spacing between items specified in a PRINT command
item list. The default value is two spaces. In situations where you need just
a little more data on the line, you can set the system variable to one space.
Note: you must reset the variable to two when you are done, if you want to
maintain the default behavior. The space setting can be up to the limit of
127 spaces.
You can also use the
LAYOUT option of the PRINT command to position columns. The LAYOUT default
is relative spacing between items. By using the ABSOLUTE option, you can
explicitly position each print item.
Assigning
Page Numbers
System 1032 provides
the PAGE command to perform page setup operations for an output channel.
When a PAGE command is issued on a channel, the page number default is 1
and you may apply it to the page using the $PAGE system variable.
In some cases, such
as when successive programs are writing to the same report file, you may
want the page number to increase incrementally, instead of being reset by
a new procedure. Use the INITIAL_PAGE option on a PAGE command to specify
the starting page number.
Setting
Page Margins and Breaks
The default page width
for System 1032 is 80 columns. If you want to write a longer line, but do
not want pagination on that channel, you can suppress the pagination on
a channel by specifying PAGE LENGTH MISSING. Note that the MISSING keyword
does not work with the PAGE SIZE option.
In the course of reporting,
often you need to specify multiple blank lines or force a new page. While
the WRITE FORMAT command offers means to accomplish these functions, additional
options are provided by the OUTPUT command. The OUTPUT command can accept
an integer variable to skip a varying number of lines or an integer constant
can be used.
The OUTPUT SKIP PAGE
command forces a page break. Odd or even pages are supported.
Formatting
on the Fly
When creating reports,
often additional output data is generated by WRITE commands within DO control
blocks. The difficult part of presenting these additions is getting the
newly output information to correctly line up with the print columns. Changes
to the column formats do not propagate to the line formats used by the WRITE
command.
However, using the TC and TV format specifiers, you can align the newly
generated data with the appropriate print columns, thus eliminating the
need to modify line formats, if column formats change.
Figure 1 illustrates
the use of the TC format to align a dashed line at the end of the Length
of Film column to indicate a summary. In the next WRITE command, the TV
format is used to position and provide the column format for the calculated
average timespan value.
Figure
1. Using the TC and TV formats in a WRITE command
1032> PRINT FILM LOF FORMAT TS4.7 BY FINAL DO AFTER 1032_ WRITE -------------- FORMAT( TC2 G) 1032_ WRITE The average film length is $AVE(LOF) 1032_ FORMAT( G TV2 ) 1032_ END_DO Film Title Length of Film ----------------------------------- -------------- Hamlet 2:35:00 The Bridge on the River Kwai 2:41:00 Lawrence of Arabia 3:41:00
The Hireling 1:48:00 -------------- The average film length is 2:05:05
|
Another example of
the use of TV formats can be found in the CCAPRINT article How
do I line up my summary lines in System 1032 Reports?
In
Summary
Journaling has become
more popular, as disk sizes are now sufficient to accommodate journal files
for frequently updated datasets. Sophisticated PRINT commands comprise some
of the mainstays of data presentation in System 1032.
Coming
Attractions
In the coming months,
articles suggested by a review of lesser-known features will include:
- The System 1032
Debugger
- TRANGEN a
transact-command generator
- System 1032 Record
Descriptors
- System 1032 Security