HP 3000 Manuals

FORMAT [ HP Transact Documentation Update Notice ] MPE/iX 5.5 Documentation


HP Transact Documentation Update Notice

FORMAT 

Specifies the format of information displayed by the OUTPUT verb or by an
unformatted DISPLAY verb.

Syntax 

FORMAT display-list;

FORMAT specifies the format of a display and the inclusion of any
character strings to enhance the display.  You use it in conjunction with
the OUTPUT verb or an unformatted DISPLAY verb.  Use the FORMAT/OUTPUT
statement combination when you want to generate a display from more than
one entry in a particular data set or file.

The FORMAT statement must precede the DISPLAY or OUTPUT statement it
formats.  A FORMAT statement in PERFORM procedure associated with an
OUTPUT statement does not format that OUTPUT, though it may format
another OUTPUT or DISPLAY statement within the PERFORM= procedure.

The specifications in a FORMAT statement are used by the next OUTPUT
statement or by the next unformatted DISPLAY statement.  The FORMAT
specifications cannot be re-used unless program control passes through
that FORMAT statement again.  Format specifications are reset to default
values after each FORMAT statement is used by the OUTPUT or DISPLAY
statement.

When native language support is used, the decimal and thousands
indicators are language sensitive.  As indicated below, some of the EDIT=
mask characters are also language sensitive.  (See Appendix E, "Native
Language Support," for more information.)

The default format is:

   *   Displays the values in the order in which they appear in the data
       register.

   *   Accompanies each value with a heading consisting of:

          *   the heading specified for that value in a HEAD= option of a
              DEFINE(ITEM) statement,

          *   the heading taken from a data dictionary definition of the
              item, or

          *   the associated data item name in the list register.

   *   Each value is displayed in a field whose length is either the data
       item size or the heading length, whichever is longer.

   *   A single blank character separates each value field from the next.
       If a field cannot fit on the current display line, then the field
       begins on a new line.

Statement Parts 

display-list          The display list contains one or more display
                      fields and their formatting parameters separated by
                      a colon.  The fields are separated from their
                      formatting parameters by commas as shown below:

                           display-field[,format-parameter]...
                              [:display-field[,format-parameter]...]...

                      If you omit display-list, the display is formatted
                      according to the default format described earlier
                      in this verb description.

                      display-field         The following options can be
                                            used for display fields:

                                               *   A reference to a data
                                                   item name in the list
                                                   register (the item
                                                   name may be
                                                   subscripted if an
                                                   array item is being
                                                   referenced).

                                               *   A child item name
                                                   whose parent item is
                                                   in the list register,
                                                   or

                                               *   A character string
                                                   delimited by quotation
                                                   marks.

                                            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.

format- parameters    One or more of the following formatting parameters
                      can 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 (octal
                                          representation) are found in
                                          the MPE Intrinsics Manual.
                                          Note that the use of
                                          CCTL=number and LINE, NOCLRF,
                                          or ROW, may affect output due
                                          to conflicting values.  [REV
                                          BEG]Valid range is 30-1025.[REV
                                          END]

                      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.  [REV
                                          BEG]Maximum is 299.[REV END]

                                          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-string"  Characters that designate edit
                                          masks.  The following
                                          characters have special
                                          meanings when used in the
                                          edit-string for all [REV
                                          BEG]display-fields except the
                                          system variables $TIME and
                                          $TODAY:[REV END]

                                          ^       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  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
                                                  leading asterisks.

                                          .       Aligns the implied
                                                  decimal point as
                                                  specified in a data
                                                  dictionary or in a
                                                  DEFINE(ITEM) definition
                                                  statement with this
                                                  edit character in the
                                                  edit mask and output
                                                  the language defined
                                                  radix character.

                                          !       Ignores the implied
                                                  decimal place and
                                                  replaces this character
                                                  with a language defined
                                                  decimal character.

                                          '       Outputs the language
                                                  defined thousands
                                                  separator character
                                                  (numeric only).

                                          (       Surrounds negative
                                                  values with parentheses
                                                  (must be last character
                                                  in the edit mask).

                                          All "other" characters, which
                                          means 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-
                                                230479            ^^/^^/^^         23/04/79

                                          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 hour <
                                                  10. 

                                          HH      Displays the hour with
                                                  leading zero if hour <
                                                  10. 

                                          24      Displays the hour as
                                                  expressed on a 24-hour
                                                  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="character-    Uses the character-string as
                      string"             the heading rather than the
                                          default, which is the heading
                                          from a data 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;[REV BEG] valid
                                          range is 0-299.[REV END]

                      LEFT                Left-justifies the data item
                                          value in the display field.
                                          This is the default
                                          specification.

                      LINE[=number]       Starts the 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, you
                                          should specify LINE=0.  [REV
                                          BEG][LINE=0 and LINE= cause a
                                          carriage return but no line
                                          feed.]  The default is 1;
                                          maximum is 99.[REV END]

                      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.  [REV BEG]Range is
                                          1-299.[REV END]

                      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 on
                                          the page.  [REV BEG]Range is
                                          1-99.[REV END]

                      NOCRLF              Does not issue a carriage
                                          return and line feed for the
                                          display line containing the
                                          display field.  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              Allows no sign position 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; [REV
                                          BEG]maximum is 99.[REV END]

                      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.  [REV BEG]Maximum is
                                          99.[REV END]

                      SPACE[=number]      Places this number of spaces
                                          between the end of the previous
                                          display field and the start of
                                          the current display field.  To
                                          concatenate fields, use
                                          SPACE=0.  Default is 1; [REV
                                          BEG]maximum is 299.[REV END]

                      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
                                          a character field overflows the
                                          end of the display line;
                                          display pound signs if field is
                                          numeric.

                      ZERO[E]S            Right-justifies a numeric data
                                          value in the display field and
                                          inserts leading zeros.

Examples 

The following example uses an OUTPUT statement to retrieve information
from a data set DETAIL and then display it in a format set up by the
preceding FORMAT statement.  All headings are suppressed by the first
SET(OPTION) statement, rather than by NOHEAD options for individual
items.  The final RESET(OPTION) statement resets the NOHEAD option for
subsequent displays.

     SET(OPTION) NOHEAD;
     FORMAT "Mailing List:",COL=15:
            " ",LINE=3,TITLE:
            FIRST-NAME,COL=5,LINE:
            ADDRESS,COL=5,LINE:
            CITY,COL=5,LINE:
            ",",JOIN=0:
            STATE:
            ZIP,COL=30;
     OUTPUT(SERIAL) DETAIL;
     RESET(OPTION) NOHEAD;

This code produces the following:

               Mailing List:

     Harry Swartz
     1 Main St.
     Anywhere, CA             12345



MPE/iX 5.5 Documentation