DISPLAY [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation
HP Transact Reference Manual
DISPLAY
Produces a display of values from the data register.
Syntax
DISPLAY[([ [TABLE],[FILE=mpe-file] ])][display-list] ...;
DISPLAY generates a display from values in the data register. The
display can be formatted and enhanced by character strings specified in
the display-list. If you do not specify a format, the display can be
formatted by any active FORMAT verb.
Statement Parts
none or Transact generates a display according to the
TABLE specifications of an active FORMAT statement. If there is
without none, the following default formatting occurs:
display-list
* Values are displayed in the order in which they
appear in the data register.
* A heading consisting of one of the following is
displayed before each line:
* the heading specified by the HEAD= option in a
DEFINE(ITEM) statement,
* the heading taken from the dictionary, or
* the associated data item name in the list register.
* Each value is displayed in a field whose length is
the greater of the data item size or the heading
length.
* A single blank character separates each value field.
If a field cannot fit on the current display line,
then the field begins on a new line.
TABLE with Headings are displayed only at the top of each new page in
display-list the information display.
mpe-file The name of an MPE file that will receive the output from
the DISPLAY statement.
display-list The display list contains one or more display fields and
their formatting parameters, as shown in the following
format:
[display-field][,format-parameter]...
[:display-field[,format-parameter]...]...;
Several fields can be displayed. The fields and their
formatting parameters are separated by commas; the
field/format-parameter combinations are separated from each
other by colons. If you omit display-list, the display is
formatted as described under "none" and "TABLE".
display- The following options can be used for display
field fields:
* A reference to a data item name in the
list register (the data item name can
be subscripted if the item referenced
is an array item).
* A child item name whose parent item is
in the list register.
* A character string delimited by
quotation marks.
* If no display field is specified,
Transact defaults to a NULL (" ")
character string.
If the requested item cannot be found in the
list register, then Transact generates an
error at execution time.
Five system variables can also be used as
display fields. As noted, some are affected
by native language support. (See Appendix E,
"Native Language Support," for more
information.)
$CPU Displays the cumulative amount
of CPU time used by the
Transact program, in
milliseconds.
$DATELINE Displays the current date and
time in the form Tue, Apr 14,
1992, 3:07 P.M. The format is
affected by native language
support.
$PAGE Displays the current page
number.
$TIME Displays the current time; the
default format is HH:MM AA (for
example, 03:07 PM). The format
is affected by native language
support.
$TODAY Displays the current date; the
default format is MM/DD/YY (for
example, 04/14/92). The format
is affected by native language
support.
__________________________________________________________
NOTE Text can be displayed only in columns 1 through 79.
Column 80 is reserved for the carriage control
character.
__________________________________________________________
format- One or more of the following formatting parameters can
parameters follow the display field name:
CCTL=number Issues a carriage control code of number
(decimal representation) for the display line
containing the associated display field.
Carriage control codes are found in the MPE
Intrinsics Manual. Note that the use of
CCTL=number and LINE, NOCRLF, or ROW, may
affect output due to conflicting values.
CENTER Centers a display field on a line. The
entire field, including leading or trailing
blanks, is centered.
COL=number Starts the display field in the absolute
column position specified by number. The
first column position is 1.
If the display is already at a column
position equal to or greater than the line
width of the display device, the field is
truncated if:
* it is a character field, or
* pound signs are displayed for a
numeric field.
If no part of the field fits, it is not
displayed.
EDIT="edit- Characters that designate edit masks. The
string" following characters have special meanings
when used in the edit-string for all
display-fields except system variables $TIME
and $TODAY:
^ Inserts the character from the source
data field into this position in the
display field.
Z Suppresses leading zeros. Note that
you must use an uppercase Z.
$ Adds business (single character)
currency symbol. If the
language-defined currency symbol
precedes, then the symbol is floated.
If the symbol succeeds, then it follows
the last character of the number and
the edit mask is shifted left one
character to leave room. If the symbol
imbeds, it replaces the radix (decimal
point or equivalent). If no business
currency symbol is defined for the
current language, then "$" edit
characters are treated the same as
"other" edit characters, explained
below.
______________________________________
NOTE In Transact/iX native language
mode, the pound sterling currency
sign (#) does not float the way
the dollar sign ($) does in a
displayed field with the edit
mask. To get the pound sign to
float, change your terminal
configuration to KEYBOARD=UK.
When you specify the edit mask,
use the dollar sign in place of
the pound sign. The pound sign
will then be displayed.
______________________________________
______________________________________
NOTE The number of digits available
for the source number depends on
the type of currency symbol.
Thus, the same value might cause
a field overflow in some
languages and not in others.
______________________________________
* Fills field with asterisks.
. Aligns the implied decimal point as
specified in the dictionary or in a
DEFINE(ITEM) definition statement with
this edit character in the edit mask
and outputs the language-defined radix
character.
! Ignores the implied decimal place and
replaces this character with a language
defined radix character.
, Outputs the language-defined thousands
separator character (numeric only).
( Surrounds negative values with
parentheses (must be last character in
edit mask).
All "other" characters, which mean any
character not defined above in the list of
special characters, are treated as insert
characters. For example:
EDIT="@@@@@@.@@"
displays entered data as:
@@@@@@.@@
To denote numeric data type 9, Z, P, I, J, K,
R, or E negative values with a trailing "-",
"CR", or "DR", add a trailing "-", "CR", or
"DR" to the edit string. Some edit-string
examples follow:
Number Edit String Result
1234 $$,$$$!^^ $l2.34
123456 $$,$$$!^^ $1,234.56
123456 ***,**$!^^ *$1,234.56
000009 ZZZZ!^^ .09
475.49 XXX,XXX.XX XXX,XXX.XX
-123456 $$,$$$!^^CR $1,234.56CR
-123456 Z,ZZZ!^^- $1,234.56-
230485 ^^/^^/^^ 23/04/85
System variables (except $DATELINE) can also
be edited. The edit mask characters just
defined can be used for $CPU and $PAGE.
Special editing characters are used for $TIME
and $TODAY. For $TIME, characters in the
edit-mask string are processed as follows:
H Displays the hour with no leading
blank or zero if hour < 10.
ZH Displays the hour with leading blank
if hours < 10.
HH Displays the hour with leading zero
if hours < 10.
24 Displays the hour as expressed on a
24-hours clock; used as a prefix to
H.
M Displays the minute with no leading
blank or zero if minute < 10.
ZM Displays the minute with leading
blank if minute < 10.
MM Displays the minute with leading zero
if minute < 10.
S Displays the second with no leading
blank or zero if second < 10.
ZS Displays the second with leading
blank if second < 10.
SS Displays the second with leading zero
if second < 10.
T Displays the tenth of a second.
A Displays the next letter in the AM or
PM sequence in uppercase.
a Displays the next letter in the AM or
PM sequence in lowercase.
AA Displays both letters in the AM or PM
sequence in uppercase.
aa Displays both letters in the AM or PM
sequence in lowercase.
Except for "a", all other $TIME edit mask
characters must be in uppercase. All
characters other than edit mask characters
are inserted on a character by character
basis.
Here are some examples of how edit masks
change the format of the $TIME value 3:07:32
PM:
Edit Mask Displayed Time
HH:MM:SS 03:07:32
24H:M:S 15:7:32
H:MM:SS a.a 3:07:32 p.m.
ZH:ZM:SS AA 3: 7:32 PM
For $TODAY, characters in the edit mask
string are processed as follows:
D Displays the day of the month with no
leading blank or zero if day < 10.
ZD Displays the day of the month with
leading blank if day < 10.
DD Displays the day of the month with
leading zero if day of the month <
10.
DDD Displays the Julian day of year.
M Displays the month with no leading
blank or zero if month < 10.
ZM Displays the month with leading blank
if month < 10.
MM Displays the month with leading zero
if month < 10.
nM Displays the first n letters of month
name in uppercase; if n > number of
letters in month name, trailing
blanks are not inserted.
nm Displays the first n letters of month
name in lowercase except for the
first letter, which appears in
uppercase.
YY Displays the last two digits in
current year.
YYYY Displays the current year.
nW Displays the first n letters of day
of week in uppercase; if n > length
of the week name, no trailing blanks
are inserted.
nw Displays the first n letters of day
of week in lowercase except for the
first letter, which appears in
uppercase.
All edit string characters must be in
uppercase, except for "m" and "w". All
characters not defined as an edit string
character are inserted on a character by
character basis.
Various edit masks applied to the $TODAY date
April 14, 1992, make it appear as follows:
Edit Mask Displayed Date
3w 3m DD, YYYY Tue. Apr 14, 1992
DD 3M, YY 14 APR, 92
M-DD-YY 4-14-92
MM/DD/YY 04/14/92
DDD, YYYY 105, 1992
____________________________________________
NOTE When a numeric value to be printed is
too large for the edit mask, a series
of pound signs (#) are printed in place
of the value, to indicate an overflow.
____________________________________________
HEAD= Uses the character-string rather than the
"character- default, which is the heading from the
string" dictionary, the heading from DEFINE(ITEM), or
the item or system variable name.
JOIN[=number] Places this number of spaces between the last
non-blank character of the current line and
the first character of the current display
field. To concatenate the character strings,
use JOIN=0. The default is 1.
LEFT Left-justifies the data item value in the
display field. This is the default
specification.
LINE[=number] Starts the next display field on a new line
or on a line after a line skip count
specified by number. If the print device
being used can overprint and you want it to
do so, specify LINE=0. The default is 1.
LINE=0 and LINE= (no number specified) cause
a carriage return but no line feed. To
accumulate output from several display
statements on one line, use the parameter
NOCRLF.
LNG=number Truncates the display field to this number of
characters. If this option refers to a
compound item, then that item is displayed
within a display field length of number. If
necessary, new lines are generated.
NEED=number Prints the current line at the top of the
next page if there are fewer than the
specified number of lines between the current
line and the bottom of the page. If you are
grouping a set of items together on a single
line, the NEED= must appear with the first
item.
NOCRLF Does not issue a carriage return and line
feed for the display line containing the
display field. This parameter allows you to
print output from the next DISPLAY statement
on the same line where the previous display
left off. NOCRLF is processed when a listing
goes to the terminal or printer. If the
listing is sent to a disk file, the option is
ignored.
NOHEAD Suppresses the default heading for this item
reference.
NOSIGN A numeric display field is always positive
and no sign position is required in the
display field. If a negative value occurs,
the display field contains a string of minus
signs (-).
PAGE[=number] Starts the display field on a new page or on
a page after a page skip count specified by
number. The default is 1.
RIGHT Right-justifies the data item value in the
display field.
ROW=number Places the display field at absolute line
location number. The first line position is
1. If the display is already at a line
position greater than number, then LINE=1 is
in effect.
SPACE[= Places this number of spaces between the end
number] of the previous display field and the start
of the current display field. To concatenate
fields, use SPACE=0. Default=1.
TITLE Displays the associated display field and any
preceding display fields only at the start of
each new page for which this statement
applies.
TRUNCATE Truncates this display field if it overflows
the end of the display line; if field is a
numeric type, displays pound signs and does
not truncate.
ZERO[E]S Right-justifies a numeric data value in the
display field and inserts leading zeros.
Redirecting Output To A File
The formatted output generated by DISPLAY can be redirected to a
specified file by using the FILE= option. This feature allows you to
generate multiple reports and to save each in a different file. The only
requirement is that the specified file must first be identified by a
corresponding SYSTEM statement using the FILE= option. If the file is
not defined in the SYSTEM statement, an INVALID FILE NAME error will
occur during compilation. The default output width for DISPLAY is 79
characters.
When using this option, the DISPLAY verb sets the status register to
indicate the number of characters written to the specified file or -1 to
indicate an end-of-file. The status register is not altered unless the
FILE= option is used.
When using SET(OPTION) PRINT, the output file must be built with records
= 133 characters.
Examples
Assuming the items NAME, ADDRESS, CITY, DISCOUNT, and CUR-BAL have been
defined and also specified in a LIST statement, the following code:
DISPLAY NAME, COL=5:
ADDRESS, SPACE=3:
CITY, SPACE=5:
"DISCOUNT RATE IS", LINE=2, COL=5:
DISCOUNT, NOHEAD:
"%", JOIN=0:
"CURRENT BALANCE IS", SPACE=10:
CUR-BAL, EDIT="$,$$$,$$$.^^", NOHEAD;
results in the following display:
NAME ADDRESS CITY
SMITH R 3304 ROCKY ROAD COLORADO SPRINGS
DISCOUNT RATE IS 7.5% CURRENT BALANCE IS $14,734.05
The following example illustrates the use of the TABLE modifier and the
TITLE option:
DISPLAY(TABLE)
"CUSTOMER LIST", COL=25, TITLE:
CUST-NO, LINE=2:
FIRST-NAME, SPACE=3:
LAST-NAME, JOIN=3:
STREET-ADDR, SPACE=3:
CITY, SPACE=3:
ZIP, SPACE=3;
This statement produces a display that prints the title "CUSTOMER LIST"
at the start of each page as a result of the TITLE option, and only
prints the item heads once on each page as a result of the TABLE
modifier. For example,
CUSTOMER LIST
CUST-NO: FIRST-NAME: LAST-NAME: STREET-ADDR: CITY: ZIP:
22431 John Jones 5 Main Avenue Centerville 12345
34567 Mary Smith 123 4th St. Roseville 95747
The following example shows the use of the FILE= option to redirect
formatted output. It routes EMPLOYEE-NAME, EMPLOYEE-ADDRESS, and SALARY
to the MPE file "REPORT."
DISPLAY(FILE=REPORT) EMPLOYEE-NAME: EMPLOYEE-ADDRESS: SALARY;
MPE/iX 5.0 Documentation