Go to Home Page
Questions?
Call 1-800-572-5517
 
  Go to Home Page  
  See all products
  See price schedules
  See manuals, tutorials, articles
  Download a free 30-day trial
  See user testimonials
  About Pacific Systems Group
 
  Welcome Rocket Software MXI Users - Learn about Spectrum SMF Writer for MXI
  Choose Spectrum Writer to add 4GL to your product
  Report Writer Speedup Tips Article

Using Display Formats


Return to "Working with Dates".

Display formats can be used in various control statements to indicate how data should be formatted in a report or output file. When no display format is specified, Spectrum Writer formats data using a default display format. To override Spectrum Writer's default, use one of the display formats found in the following table.

For example, you can specify a display format in the FORMAT parm of the FIELD statement:

FIELD: SOCIAL–SEC–NUM TYPE(PACKED) LENGTH(5) FORMAT(PIC'999–99–9999')

The FIELD statement above includes a picture type of numeric display format. Specifying a FORMAT parm in the FIELD statement assigns a default format to use for that field whenever it appears in a report or output file.

You can also assign a default display format to computed fields in the COMPUTE statement:

COMPUTE: PERCENT-GROWTH(PIC’ZZ9%’) = (NEW - OLD) * 100 / OLD

You can also specify an override display format in any statement that describes a print line (such as the COLUMNS, TITLE, FOOTNOTE and BREAK statements.) For example:

COLUMNS: HIRE–DATE(DD–MM–YYYY)

The above COLUMNS statement tells Spectrum Writer to format the HIRE–DATE field in "DD/MM/YYYY" format in the current report.

To change the default display format for all fields in a report, use the FORMAT parm of the OPTIONS statement:

OPTIONS: FORMAT(DOTSEP)

The above statement causes Spectrum Writer to format all numeric fields in the report with the DOTSEP format (e.g.: 1.234.567,89). You can still override any particular numeric field by using an override display format (for example, in the COLUMNS statement.)

For more information on exactly where and how to use a display format, see under the appropriate statement's description in Chapter 10, "Control Statement Syntax."

Display Formats for Date Fields

The display formats allowed for a particular field depend on the field's data type. The table below shows the display formats available for date fields.

DISPLAY FORMAT DESCRIPTION (See Note 1) EXAMPLE
Formats Normally Used in Reports
MM–DD–YY MM/DD/YY This is the default display format for
all date fields, regardless of their data type. (1)
12/31/96
12–31–96
12.31.96
MM–DD–YYYY MM/DD/YYYY (1) 12/31/1996
12–31–1996
12.31.1996
MMDDYY MMDDYY 123196
MMDDYYYY MMDDYYYY 12311996
DD–MM–YY DD/MM/YY (1) 31/12/96
31–12–96
31.12.96
DD–MM–YYYY DD–MM–YYYY (1) 31/12/1996
31–12–1996
31.12.1996
DDMMYY DDMMYY 311296
DDMMYYYY DDMMYYYY 31121996
YYYY–MM–DD YYYY-MM-DD (1) 1996/12/31
1996–12–31
1996.12.31
YYMMDD YYMMDD 961231
YYYYMMDD YYYYMMDD 19961231
YYDDD YYDDD (Julian date) 96366
YYYYDDD YYYYDDD (Julian date) 1996366
SHORT1 MMM DD, YYYY DEC 31, 1996
SHORT2 DD MMM YYYY 31 DEC 1996
SHORT3 DD MMM YY 31 DEC 96
LONG1 MMMMMMMMMMM DD, YYYY DECEMBER 31, 1996
LONG2 DD MMMMMMMMMMM YYYY 31 DECEMBER 1996
LONG3 DD MMMMMMMMMMM YY 31 DECEMBER 96
Formats Normally Used in Output Files
Q–MM–DD–YY "MM/DD/YY" date in quotation marks. (1) (2) "12/31/96"
Q–MM–DD–YYYY "MM/DD/YYYY" date in quotation marks. (1) (2) "12/31/1996"
Q–MMDDYYYY "MMDDYYYY" date in quotation marks. (2) "12311996"
Q–DD–MM–YYYY "DD/MM/YYYY" date in quotation marks. (1) (2) "31/12/1996"
Q–DDMMYYYY "DDMMYYYY" date in quotation marks. (2) "31121996"
Q–YYMMDD "YYMMDD" date in quotation marks. (2) "961231"
Q–YYYY–MM–DD "YYYY/MM/DD" date in quotation marks. (1) (2) "1996/12/31"
Q–YYYYMMDD "YYYYMMDD" date in quotation marks. (2) "19961231"
H–MMDDYY MMDDYY (hex) X'123196'
H–MMDDYYYY MMDDYYYY (hex) X'12311996'
H–DDMMYY DDMMYY (hex) X'311296'
H–DDMMYYYY DDMMYYYY (hex) X'31121996'
H–YYMMDD YYMMDD (hex) X'961231'
H–YYYYMMDD YYYYMMDD (hex) X'19961231'
H–YYDDD YYDDD (hex, Julian date) X'096366'
H–YYYYDDD YYYYDDD (hex, Julian date) X'01996366'
P–MMDDYY MMDDYY (packed) X'0123196C'
P–MMDDYYYY MMDDYYYY (packed) X'012311996C'
P–DDMMYY DDMMYY (packed) X'0311296C'
P–DDMMYYYY DDMMYYYY (packed) X'031121996C'
P–YYMMDD YYMMDD (packed) X'0961231C'
P–YYYYMMDD YYYYMMDD (packed) X'019961231C'
P–YYDDD YYDDD (packed, Julian date) X'96366C'
P–YYYYDDD YYYYDDD (packed, Julian date) X'1996366C'
P–CYYDDD Packed CYYDDD date (Julian date with century indicator,
as used in SMF records)
X'096366C'
X'196366C'
Notes::
(1) Use the DATEDELIM parm in the OPTIONS statement (page 560) to specify a delimiter other than the slash (/).
(2) Use the QCHAR parm in the OPTIONS statement (page 573) to specify a delimiter other than the double quotatiom mark.

Return to "Working with Dates".

Copyright 2024.
Pacific Systems Group.
All rights reserved.


Spectrum Writer 4GL - the economical alternative to SAS, Easytrieve, DYL-280...

Home | Products | Prices | Documentation | 30-Day Trials | Customer Reviews | Company
Send Your Comments or Questions