This attribute, which is also known as FORMAT, describes how to format a field when displaying it in a report or using it in a calculation.
How to: |
Reference: |
For FOCUS data sources, which do not use the ACTUAL attribute, USAGE also specifies how to store the field. For other types of data sources, assign a USAGE value that corresponds to the ACTUAL value, to identify the field as the same data type used to store it in the data source. If the data is store as alphanumeric, assign the USAGE based on how the field will be displayed in your reports. The conversion is done automatically. For instructions on which ACTUAL values correspond to which USAGE values, see the documentation for the specific data adapter. For sequential, VSAM, and ISAM data sources, see Describing a Sequential, VSAM, or ISAM Data Source. For other types of data sources, see your adapter documentation.
In addition to selecting the data type and length, you can also specify display options, such as date formatting, floating dollar signs, and zero suppression. Use these options to customize how the field appears in reports.
USAGE = tl[d]
where:
Is the data type. Valid values are A (alphanumeric), F (floating-point single-precision), D (floating-point double-precision), X extended decimal precision floating-point), I (integer), P (packed decimal), D, W, M, Q, or Y used in a valid combination (date), and TX (text).
Is a length specification. The specification varies according to the data type. See the section for each data type for more information. Note that you do not specify a length for date format fields.
Is one or more display options. Different data types offer different display options. See the section for each data type for more information.
The complete USAGE value cannot exceed eight characters.
The values that you specify for type and field length determine the number of print positions allocated for displaying or storing the field. Display options only affect displayed or printed fields. They are not active for non-display retrievals, such as extract files.
Note: If a numeric field cannot display with the USAGE format given (for example, the result of aggregation is too large), asterisks appear.
See the sections for each format type for examples and additional information.
Note the following rules when using USAGE:
For FOCUS data sources, you cannot change the type specification. You can change the length specification for I, F, D, and P fields, because this affects only display, not storage. You cannot change the decimal part of the length specification for P fields. You can change the length specification of A (alphanumeric) fields only if you use the REBUILD facility. You can change display options at any time.
You can specify several types of formats:
Note that for some applications, such as assigning a date value using the DECODE function, you may wish instead to use alphanumeric, integer, or packed-decimal fields with date display options, which provide partial date functionality.
You can use integer format for whole numbers. An integer is any value composed of the digits zero to nine, without a decimal point.
You can also use integer fields with date display options to provide limited date support. This use of integer fields is described in the Alphanumeric and Numeric Formats with Date Display Options.
The integer USAGE type is I. See Numeric Display Options. The format of the length specification is:
n
where:
Is the number of digits to display. The maximum length is 11 for 32-bit versions of WebFOCUS and 22 for 64-bit versions, which must include the digits and a leading minus sign if the field contains a negative value. You can also specify a number of decimal places (up to n - 1), and the number will display with a decimal point before that number of digits.
For example:
Format |
Display |
---|---|
I6 |
4316 |
I6.2 |
43.16 |
I2 |
22 |
I4 |
-617 |
You can use floating-point double-precision format for any value composed of the digits zero to nine and an optional decimal point.
The floating-point double-precision USAGE type is D. See Numeric Display Options for the compatible display options. The length specification format is:
t[.s]
where:
Is the number of characters to display up to a maximum of 33, including the numeric digits, an optional decimal point, and a leading minus sign if the field contains a negative value. The number of significant digits supported varies with the operating environment.
Is the number of digits that follow the decimal point. It can be a maximum of 31 and must be less than t.
For example:
Format |
Display |
---|---|
D8.2 |
3,187.54 |
D8 |
416 |
In the case of D8.2, the 8 represents the maximum number of places, including the decimal point and decimal places. The 2 represents how many of these eight places are decimal places. The commas are automatically included in the display, and are not counted in the total.
You can use floating-point single-precision format for any number, including numbers with decimal positions. The number is composed of the digits 0 to 9, including an optional decimal point. This format is intended for use with smaller decimal numbers. Unlike floating-point double-precision format, its length cannot exceed nine positions.
The floating-point single-precision USAGE type is F. Compatible display options are described in Numeric Display Options. The length specification format is:
t[.s]
where:
Is the number of characters to display, up to a maximum of 33, including the numeric digits, an optional decimal point, and a leading minus sign if the field contains a negative value. The number of significant digits supported varies with the operating environment.
Is the number of digits that follow the decimal point. It can be up to 31 digits and must be less than t.
For example:
Format |
Display |
---|---|
F5.1 |
614.2 |
F4 |
318 |
You can use extended decimal precision floating-point format for any number, including numbers with decimal positions. The number is composed of the digits 0 to 9, including an optional decimal point. Its length cannot exceed 37 significant digits. An extended decimal precision floating-point value is stored as a base 10 number, unlike double-precision and single-precision floating-point values, which are stored as binary numbers. By default, all numeric processing is done using double-precision floating-point. You can change this default using the SET FLOATMAPPING command.
The extended decimal precision floating-point USAGE type is X. Compatible display options are described in Numeric Display Options. The length specification format is:
t[.s]
where:
Is the number of characters to display, up to a maximum of 44, including the numeric digits, an optional decimal point, and a leading minus sign if the field contains a negative value. The number of significant digits supported varies with the operating environment.
Is the number of digits that follow the decimal point. It can be up to 37 digits and must be less than t.
For example:
Format |
Display |
---|---|
X5.1 |
614.2 |
X4 |
318 |
You can use decimal precision floating-point format for any number, including numbers with decimal positions. The number is composed of the digits 0 to 9, including an optional decimal point. This format is intended for use with smaller decimal numbers. Unlike extended decimal precision floating-point format, its length cannot exceed 15 significant digits. A decimal precision floating-point value is stored as a base 10 number, unlike double-precision and single-precision floating-point values, which are stored as binary numbers. By default, all numeric processing is done using double-precision floating-point. You can change this default using the SET FLOATMAPPING command.
The decimal precision floating-point USAGE type is M. Compatible display options are described in Numeric Display Options. The length specification format is:
t[.s]
where:
Is the number of characters to display, up to a maximum of 34, including the numeric digits, an optional decimal point, and a leading minus sign if the field contains a negative value. The number of significant digits supported varies with the operating environment.
Is the number of digits that follow the decimal point. It can be up to 31 digits and must be less than t.
For example:
Format |
Display |
---|---|
M5.1 |
614.2 |
M4 |
318 |
You can use packed-decimal format for any number, including decimal numbers. A decimal number is any value composed of the digits zero to nine, including an optional decimal point.
You can also use packed-decimal fields with date display options to provide limited date support. See Alphanumeric and Numeric Formats with Date Display Options.
The packed-decimal USAGE type is P. The compatible display options are described in Numeric Display Options.
The length specification format is:
t[.s]
where:
Is the number of characters to display, up to 33, including a maximum of 31 digits, an optional decimal point, and a leading minus sign if the field contains a negative value.
Is the number of digits that follow the decimal point. It can be up to 31 digits and must be less than t.
For example:
Format |
Display |
---|---|
P9.3 |
4168.368 |
P7 |
617542 |
P fields have two internal lengths, 8 bytes (which supports up to 15 digits) and 16 bytes (which supports up to 33 digits). A USAGE of P1 through P15 is automatically assigned an internal storage consisting of 8 bytes. A USAGE of P16 or greater is assigned an internal storage consisting of 16 bytes.
If your USAGE does not account for the number of digits required to display the stored number, asterisks display instead of a number. This does not necessarily indicate an overflow of the field, just that you did not account for displaying the number of digits that are stored in the field.
Overflow occurs if you attempt to store a number with more digits than can actually fit in the internal storage assigned. Overflow such as this is indicated by storing a number consisting of all 9's, in all operating environments except z/OS. On z/OS, the value 0 (zero) is used. Therefore, if you try to store a number consisting of 16 digits in a packed field assigned 8 bytes of internal storage, the number 999999999999999 (the digit 9 repeated 15 times), or the number zero on z/OS, will be stored in the field instead.
If you assign a USAGE of P1 through P14 to such a field, the 15 digits stored in the field will not be able to be displayed, and you will see asterisks. However, if you assign the USAGE P15 to the field, it will be able to display the 15-digit number stored in the field, so you will see the value 999999999999999 (zero on z/OS). If you see that number for a P15 field, it could be the actual number that was required or it could be a replacement for a number that could not fit.
Display options may be used to edit numeric formats. These options only affect how the data in the field is printed or appears on the screen, not how it is stored in your data source.
Edit Option |
Meaning |
Effect |
---|---|---|
- |
Minus sign |
Displays a minus sign to the right of negative numeric data. Note: Not supported with format options B, E, R, T, DMY, MDY, and YMD. |
% |
Percent sign |
Displays a percent sign (%), along with numeric data. Does not calculate the percent. |
p |
Percentage |
Converts a number to a percentage by multiplying it by 100, and displays it followed by a percent sign (%). Not supported with formats I and P. |
A |
Negative suppression |
Displays the absolute value of the number, but does not affect the stored value.
|
a |
Automatic abbreviation |
Calculates the appropriate abbreviation (K, M, B, or T) to use for displaying the number based on the magnitude of the number. This option uses the appropriate abbreviation for the specific value on the current row and, therefore, each row may have a different abbreviation. For example, 1234567890 displays as 1.23B, while 1234567890000 displays as 1.23T. |
b |
Billions abbreviation |
Displays numeric values in terms of billions. For example, 1234567890 displays as 1.23B. |
B |
Bracket negative |
Encloses negative numbers in parentheses. |
c |
Comma suppress |
Suppresses the display of commas. Used with numeric format options M and N (floating and non-floating dollar sign) and data format D (floating-point double-precision). |
C |
Comma edit |
Inserts a comma after every third significant digit, or a period instead of a comma if continental decimal notation is in use. |
DMY |
Day-Month-Year |
Displays alphanumeric or integer data as a date in the form day/month/year. |
E |
Scientific notation |
Displays only significant digits. |
k |
Thousands abbreviation |
Displays numeric values in terms of thousands. For example, 12345 displays as 12.35K. |
L |
Leading zeroes |
Adds leading zeroes. |
m |
Millions abbreviation |
Displays numeric values in terms of millions. For example, 1234567 displays as 1.23M. |
M |
Floating currency symbol ($ for US code page) |
Places a floating currency symbol to the left of the highest significant digit. The default currency symbol depends on the code page. You can use the SET CURRSYMB=symbol command to specify up to four characters as the currency symbol or one of the following currency codes: USD or '$' specifies U. S. dollars. GBP specifies the British pound. JPY specifies the Japanese yen or Chinese yuan. EUR specifies the Euro. |
MDY |
Month-Day-Year |
Displays alphanumeric or integer data as a date in the form month/day/year. |
N |
Fixed currency symbol ($ for US code page) |
Places a currency symbol to the left of the field. The symbol appears only on the first detail line of each page. The default currency symbol depends on the code page. You can use the SET CURRSYMB=symbol command to specify up to four characters as the currency symbol or one of the following currency codes: USD or '$' specifies U. S. dollars. GBP specifies the British pound. JPY specifies the Japanese yen or Chinese yuan. EUR specifies the Euro. |
R |
Credit (CR) negative |
Places CR after negative numbers. |
S |
Zero suppress |
If the data value is zero, prints a blank in its place. |
t |
Trillions abbreviation |
Displays numeric values in terms of trillions. For example, 1234567890000 displays as 1.23T. |
T |
Month translation |
Displays the month as a three-character abbreviation. |
YMD |
Year-Month-Day |
Displays alphanumeric or integer data as a date in the form year/month/day. |
Note: For abbreviation options k, m, b, t, and a.
The following table shows examples of the display options that are available for numeric fields.
Option |
Format |
Data |
Display |
---|---|---|---|
Minus sign |
I2- D7- F7.2- |
-21 -6148 -8878 |
21- 6148- 8878.00- |
Percent sign |
I2% D7% F3.2% |
21 6148 48 |
21% 6,148% 48.00% |
Comma suppression |
D6c D7Mc D7Nc |
41376 6148 6148 |
41376 $6148 $ 6148 |
Comma inclusion |
I6C |
41376 |
41,376 |
Zero suppression |
D6S |
0 |
|
Bracket negative |
I6B |
-64187 |
(64187) |
Credit negative |
I8R |
-3167 |
3167 CR |
Leading zeroes |
F4L |
31 |
0031 |
Floating dollar |
D7M |
6148 |
$6,148 |
Non-floating dollar |
D7N |
5432 |
$ 5,432 |
Scientific notation |
D12.5E |
1234.5 |
0.12345D+04 |
Year/month/day |
I6YMD I8YYMD |
980421 19980421 |
98/04/21 1998/04/21 |
Month/day/year |
I6MDY I8MDYY |
042198 04211998 |
04/21/98 04/21/1998 |
Day/month/year |
I6DMY I8DMYY |
210498 21041998 |
21/04/98 21/04/1998 |
Month translation |
I2MT |
07 |
JUL |
Several display options can be combined, as shown:
Format |
Data |
Display |
---|---|---|
I5CB |
-61874 |
(61,874) |
All of the options may be specified in any order. Options M and N (floating and non-floating dollar sign) and data format D (floating-point double-precision) automatically invoke option C (comma). Options L and S cannot be used together. Option T (Translate) can be included anywhere in an alphanumeric or integer USAGE specification that includes the M (month) display option. Date display options (D, M, T, and Y), which cannot be used with floating-point fields, are described in Alphanumeric and Numeric Formats with Date Display Options.
The International System standard provides numeric abbreviations for very large and very small numbers.
WebFOCUS supports the following SI-compliant numeric abbreviations. The SI-compliant format uses a two-character display code that consists of a lowercase n followed by the SI abbreviation.
Prefix |
WebFOCUS Format Code |
Size |
Example |
English Name (American/British) |
---|---|---|---|---|
yotta |
nY |
10**24 |
1000000000000000000000000 |
septillion/quadrillion |
zetta |
nZ |
10**21 |
1000000000000000000000 |
sextillion/trilliard |
exa |
nE |
10**18 |
1000000000000000000 |
quintillion/trillion |
peta |
nP |
10**15 |
1000000000000000 |
quadrillion/billiard |
tera |
nT |
10**12 |
1000000000000 |
trillion/billion |
giga |
nG |
10**9 |
1000000000 |
billion/milliard |
mega |
nM |
10**6 |
1000000 |
million |
kilo |
nK |
10**3 |
1000 |
thousand |
milli |
nm |
10**(-3) |
0.001 |
thousandth |
micro |
nu |
10**(-6) |
0.000001 |
millionth |
nano |
nn |
10**(-9) |
0.000000001 |
billionth/milliardth |
pico |
np |
10**(-12) |
0.000000000001 |
trillionth/billionth |
femto |
nf |
10**(-15) |
0.000000000000001 |
quadrillionth/billiardth |
atto |
na |
10**(-18) |
0.000000000000000001 |
quintillionth/trillionth |
zepto |
nz |
10**(-21) |
0.000000000000000001 |
sextillionth/trilliardth |
yocto |
ny |
10**(-24) |
0.000000000000000000000001 |
septillionth/quadrillionth |
The following request uses the mega and giga format options. The decimal precision is controlled by the format which, in this case, is a reformat specified in the SUM command.
DEFINE FILE GGSALES NEWDOLL/D12.2 = DOLLARS * 100; END TABLE FILE GGSALES SUM DOLLARS NEWDOLL/D12.5nM AS Millions NEWDOLL/D12.3nG AS Billions BY CATEGORY ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF,$ ENDSTYLE END
The output is shown in the following image.
How to: |
Reference: |
You can select a currency symbol for display in report output regardless of the default currency symbol configured for National Language Support (NLS). Use the extended currency symbol format in place of the floating dollar (M) or non-floating dollar (N) display option. When you use the floating dollar (M) or non-floating dollar (N) display option, the currency symbol associated with the default code page is displayed. For example, when you use an American English code page, the dollar sign is displayed.
The extended currency symbol format allows you to display a symbol other than the dollar sign. For example, you can display the symbol for a United States dollar, a British pound, a Japanese yen or Chinese yuan, or the euro. Extended currency symbol support is available for numeric formats (I, D, F, and P).
The extended currency symbol formats are specified as two-character combinations in the last positions of any numeric display format. The first character in the combination can be either an exclamation point (!) or a colon (:). The colon is the recommended character because it will work in all ASCII and EBCDIC code pages. The exclamation point is not consistent on all EBCDIC code pages and may produce unexpected behavior if the code page you are using translates the exclamation point differently.
In addition, you can use the SET commands SET CURSYM_D, SET CURSYM_E, SET CURSYM_F, SET CURSYM_G, SET CURSYM_L, and SET CURSYM_Y to redefine the default display characters for the extended currency symbol formats. For example, you can display a euro symbol on the right of the number and add a space between the number and the euro symbol by issuing the SET CURSYM_F command and using the extended currency symbol format :F in the request or Master File.
SET CURSYM_F = ' €'
For more information, see the Developing Reporting Applications manual.
The following table lists the supported extended currency display options:
Display Option |
Description |
Example |
---|---|---|
:C or !C |
The currency symbol is determined by the locale settings. Its display is controlled by the following parameters:
|
D12.2:C |
:d or !d |
Fixed dollar sign. |
D12.2:d |
:D or !D |
Floating dollar sign. |
D12.2:D |
:e or !e |
Fixed euro symbol. |
F9.2:e |
:E or !E |
Floating euro symbol on the left side. |
F9.2:E |
:F or !F |
Floating euro symbol on the right side. |
F9.2:F |
:G or !G |
Floating dollar symbol on the right side. |
F9.2:G |
:l or !l |
Fixed British pound sign. |
D12.1:l |
:L or !L |
Floating British pound sign. |
D12.1:L |
:y or !y |
Fixed Japanese yen or Chinese yuan symbol. |
I9:y |
:Y or !Y |
Floating Japanese yen or Chinese yuan symbol. |
I9:Y |
The following guidelines apply:
numeric_format {:|!}option
where:
Is a valid numeric format (data type I, D, F, or P).
Is required. The exclamation point is not consistent on all EBCDIC code pages and may produce unexpected behavior if the code page you are using translates the exclamation point differently. The colon does not vary across code pages, so it is the recommended symbol to use.
Determines the currency symbol that is displayed, and whether the symbol is floating or non-floating. Possible values are:
The extended currency option must be in the last positions in the format.
The following request displays the euro symbol.
SET PAGE-NUM = OFF TABLE FILE CENTORD PRINT PRODNAME QUANTITY PRICE/D10.2!E BY ORDER_DATE WHERE QUANTITY GT 700; ON TABLE SET STYLE * TYPE = REPORT, GRID = OFF,$ ENDSTYLE END
The output is:
The CURRENCY_ISO_CODE and CURRENCY_DISPLAY parameters can be applied on the field level as display parameters in a Master File DEFINE, a DEFINE command, or in a COMPUTE using the :C display option.
Note: These parameters are not supported with FORMAT EXL2K report output.
The syntax is:
fld/fmt:C(CURRENCY_DISPLAY='pos', CURRENCY_ISO_CODE='iso')= expression;
where:
Is the field to which the parameters are to be applied.
Is a numeric format that supports a currency value.
Defines the position of the currency symbol relative to a number. The default value is default, which uses the position for the format and currency symbol in effect. Valid values are:
Is a standard three-character currency code, such as USD for US dollars or JPY for Japanese yen. The default value is default, which uses the currency code for the configured language code.
Is the expression that creates the virtual field.
Note: If currency parameters are specified at multiple levels, the order of precedence is:
The following request creates a virtual field named Currency_parms that displays the currency symbol on the right using the ISO code for Japanese yen, 'JPY'.
DEFINE FILE WF_RETAIL_LITE Currency_parms/D20.2:C(CURRENCY_DISPLAY='TRAILING',CURRENCY_ISO_CODE='JPY') = COGS_US; END TABLE FILE WF_RETAIL_LITE SUM COGS_US Currency_parms BY BUSINESS_REGION AS 'Region' ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF,$ END
The output is shown in the following image.
When a value with decimal places is assigned to a numeric field, if there are more decimal places in the value than are specified in the field length description, the value is rounded to an acceptable size before either storing or displaying it. The value is rounded down when the first extra decimal digit is less than five, and rounded up when it is five or greater (although an additional consideration is introduced for floating-point values).
For example, consider a packed-decimal field with two decimal places
FIELDNAME = PRESSURE, FORMAT = P8.2, $
to which you assign a value with four decimal places:
PRESSURE = 746.1289
The first extra digit (that is, the first one past the specified length of two decimal places), is 8. Since 8 is greater than or equal to five, the value is rounded up, and PRESSURE becomes:
746.13
The details of rounding are handled in the following ways for the following numeric formats:
Note that if the decimal portion of a floating-point value as it is internally represented in hexadecimal floating-point notation is repeating (that is, non-terminating), the repeating hexadecimal number is resolved as a non-repeating slightly lower number, and this lower number is stored as the field value. In these situations, if in the original value of the digit to be rounded had been a five (which would be rounded up), in the stored lower value, it would become a four (which is rounded down).
For example, consider a floating-point double-precision field with one decimal place
FIELDNAME = VELOCITY, FORMAT = D5.1, $
to which you assign a value with two decimal places:
VELOCITY = 1.15
This value is stored as a slightly smaller number due to the special circumstances of floating-point arithmetic, as previously described:
1.149999
While the original number, 1.15, would have been rounded upward to 1.2 (since the first extra digit was 5 or greater), the number as stored is slightly less than 1.15 (1.149999) and, as the first extra digit is now less than 5 (4 in this case), it is rounded down to 1.1. To summarize the process:
format: D5.1 entered: 1.15 stored: 1.149999 rounded: 1.1 displayed: 1.1
Reference: |
You can use alphanumeric format for any value to be interpreted as a sequence of characters and composed of any combination of digits, letters, and other characters.
You can also use alphanumeric fields with date display options to provide limited date support. This use of alphanumeric fields is described in Alphanumeric and Numeric Formats with Date Display Options.
The alphanumeric USAGE type is A. The format of the length specification is n, where n is the maximum number of characters in the field. You can have up to 3968 bytes in an alphanumeric field in a FOCUS file segment, and up to 4096 bytes in an XFOCUS file segment. You can have up to 4095 bytes in a fixed-format sequential data source. You may define the length in the Master File, a DEFINE FILE command, or a COMPUTE command.
For example:
Format |
Display |
---|---|
A522 |
The minutes of today's meeting were submitted... |
A2 |
B3 |
A24 |
127-A429-BYQ-49 |
Standard numeric display options are not available for the alphanumeric data format. However, alphanumeric data can be printed under the control of a pattern that is supplied at run time. For instance, if you are displaying a product code in parts, with each part separated by a "-", include the following in a DEFINE command:
PRODCODE/A11 = EDIT (fieldname,'999-999-999') ;
where:
Is the existing field name, not the newly defined field name.
If the value is 716431014, the PRODCODE appears as 716-431-014. See the Creating Reports With TIBCO WebFOCUS® Language manual for more information.
You can use the USAGE format Un to display the hexadecimal representation of alphanumeric data. The corresponding ACTUAL format is A with two times the length of the USAGE format.
The following operations are supported for hexadecimal format:
For example, the following request prints the hexadecimal representation of the alphanumeric Category field:
TABLE FILE GGSALES SUM CATEGORY/U10 AS Hex,Category DOLLARS UNITS BY CATEGORY ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF,$ ENDSTYLE END
The output is shown in the following image.
The following version of the request creates the hexadecimal field in a DEFINE command and adds a HOLD command:
APP HOLD baseapp DEFINE FILE GGSALES HEXCAT/U10 = CATEGORY; END TABLE FILE GGSALES SUM HEXCAT DOLLARS UNITS BY CATEGORY ON TABLE HOLD AS HOLDHEX FORMAT ALPHA ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF,$ ENDSTYLE END
The generated Master File follows. The HEXCAT field has USAGE=U10 and ACTUAL=A20.
FILENAME=HOLDHEX , SUFFIX=FIX , IOTYPE=STREAM, $ SEGMENT=HOLDHEX, SEGTYPE=S1, $ FIELDNAME=CATEGORY, ALIAS=E01, USAGE=A11, ACTUAL=A11, $ FIELDNAME=HEXCAT, ALIAS=E02, USAGE=U10, ACTUAL=A20, $ FIELDNAME=DOLLARS, ALIAS=E03, USAGE=I08, ACTUAL=A08, $ FIELDNAME=UNITS, ALIAS=E04, USAGE=I08, ACTUAL=A08, $
Certain relational data sources support a data type called STRING to store alphanumeric data that has an unlimited length. This type of data can be mapped to the TX data type. However, text fields have limitations on their use in WebFOCUS sort and selection phrases.
The format specification for a STRING field has no length specification. The length is determined on retrieval. For example:
FIELD1/STRING
The STRING data type has all of the functionality of alphanumeric data types in WebFOCUS. The limit to a STRING field value length is 2 GB. It can be propagated to relational data sources that have the STRING data type and to delimited HOLD files, where both the USAGE and ACTUAL formats are generated as STRING.
Date format enables you to define a field as a date, then manipulate the field value and display that value in ways appropriate to a date. Using date format, you can:
Reference: |
The date format does not specify type or length. Instead, it specifies date component options (D, W, M, Q, Y, and YY) and display options. These options are shown in the following chart.
Display Option |
Meaning |
Effect |
---|---|---|
D |
Day |
Prints a value from 1 to 31 for the day. |
M |
Month |
Prints a value from 1 to 12 for the month. |
Y |
Year |
Prints a two-digit year. |
YY |
Four-digit year |
Prints a four-digit year. |
T |
Translate month or day |
Prints a three-letter abbreviation for months in uppercase, if M is included in the USAGE specification. Otherwise, it prints day of week. |
t |
Translate month or day |
Functions the same as uppercase T (described above), except that the first letter of the month or day is uppercase and the following letters are lowercase.* |
TR |
Translate month or day |
Functions the same as uppercase T (described above), except that the entire month or day name is printed instead of an abbreviation. |
tr |
Translate month or day |
Functions the same as lowercase t (described above), except that the entire month or day name is printed instead of an abbreviation.* |
Q |
Quarter |
Prints Q1 - Q4. |
W |
Day-of-Week |
If it is included in a USAGE specification with other date component options, prints a three-letter abbreviation of the day of the week in uppercase. If it is the only date component option in the USAGE specification, it prints the number of the day of the week (1-7; Mon=1). |
w |
Day-of-Week |
Functions the same as uppercase W (described above), except that the first letter is uppercase and the following letters are lowercase.* |
WR |
Day-of-Week |
Functions the same as uppercase W (described above), except that the entire day name is printed instead of an abbreviation. |
wr |
Day-of-Week |
Functions the same as lowercase w (described above), except that the entire day name is printed instead of an abbreviation.* |
J[UL]or JULIAN |
Julian format |
Prints date in Julian format. |
YYJ[UL] |
Julian format |
Prints a Julian format date in the format YYYYDDD. The 7-digit format displays the four-digit year and the number of days counting from January 1. For example, January 3, 2001 in Julian format is 2001003. |
Note: When using these display options, be sure they are actually stored in the Master File as lowercase letters.
The following combinations of date components are not supported in date formats:
I2M, A2M, I2MD, A2MD
The Y, YY, and M formats are not smart dates. Smart date formats YMD and YYMD are stored as an offset from the base date of 12/31/1900. Smart date formats YM, YQ, YYM, and YYQ are stored as an offset from the base date 01/1901 on z/OS and 12/1900 on other platforms. W formats are stored as integers with a display length of one, containing values 1-7 representing the days of the week. Y, YY, and M formats are stored as integers. Y and M have display lengths of two. YY has a display length of four. When using Y and YY field formats, keep in mind these two important points:
This table illustrates the behavior of date formats. The columns indicate the number of input digits for a date format. The rows indicate the usage or format of the field. The intersection of row and column describes the result of input and format.
Date Format |
1 |
2 |
3 |
4 |
---|---|---|---|---|
YYMD |
* |
* |
CC00/0m/dd |
CC00/mm/dd |
MDYY |
* |
* |
* |
* |
DMYY |
* |
* |
* |
* |
YMD |
* |
* |
CC00/0m/dd |
CC00/mm/dd |
MDY |
* |
* |
* |
* |
DMY |
* |
* |
* |
* |
YYM |
CC00/0m |
CC00/mm |
CC0y/mm |
CCyy/mm |
MYY |
* |
* |
* |
* |
YM |
CC00/0m |
CC00/mm |
CC0y/mm |
CCyy/mm |
MY |
* |
* |
0m/CCyy |
mm/CCyy |
M |
0m |
mm |
* |
* |
YYQ |
CC00/q |
CC0y/q |
CCyy/q |
0yyy/q |
QYY |
* |
* |
q/CCyy |
* |
YQ |
CC00/q |
CC0y/q |
CCyy/q |
0yyy/q |
QY |
* |
* |
q/CCyy |
* |
Q |
q |
* |
* |
* |
JUL |
00/00d |
00/0dd |
00/ddd |
0y/ddd |
YYJUL |
CC00/00d |
CC00/0dd |
CC00/ddd |
CC0y/ddd |
YY |
000y |
00yy |
0yyy |
yyyy |
Y |
0y |
yy |
* |
* |
D |
0d |
dd |
* |
* |
W |
w |
* |
* |
* |
Date Format |
5 |
6 |
7 |
8 |
---|---|---|---|---|
YYMD |
CC0y/mm/dd |
CCyy/mm/dd |
0yyy/mm/dd |
yyyy/mm/dd |
MDYY |
0m/dd/CCyy |
mm/dd/CCyy |
0m/dd/yyyy |
mm/dd/yyyy |
DMYY |
0d/mm/CCyy |
dd/mm/CCyy |
0d/mm/yyyy |
dd/mm/yyyy |
YMD |
CC0y/mm/dd |
CCyy/mm/dd |
0yyy/mm/dd |
yyyy/mm/dd |
MDY |
0m/dd/CCyy |
mm/dd/CCyy |
0m/dd/yyyy |
mm/dd/yyyy |
DMY |
0d/mm/CCyy |
dd/mm/CCyy |
0d/mm/yyyy |
dd/mm/yyyy |
YYM |
0yyy/mm |
yyyy/mm |
* |
* |
MYY |
0m/yyyy |
mm/yyyy |
* |
* |
YM |
0yyy/mm |
yyyy/mm |
* |
* |
MY |
0m/yyyy |
mm/yyyy |
* |
* |
M |
* |
* |
* |
* |
YYQ |
yyyy/q |
* |
* |
* |
QYY |
q/yyyy |
* |
* |
* |
YQ |
yyyy/q |
* |
* |
* |
QY |
q/yyyy |
* |
* |
* |
Q |
* |
* |
* |
* |
JUL |
yy/ddd |
* |
* |
* |
YYJUL |
CCyy/ddd |
0yyy/ddd |
yyyy/ddd |
* |
YY |
* |
* |
* |
* |
Y |
* |
* |
* |
* |
D |
* |
* |
* |
* |
W |
* |
* |
* |
* |
Note:
You can control the date separators when the date appears. In basic date format, such as YMD and MDYY, the date components appear separated by a slash character (/). The same is true for the year-month format, which appears with the year and quarter separated by a blank (for example, 94 Q3 or Q3 1994). The single component formats display just the single number or name.
The separating character can also be a period, a dash, or a blank, or can even be eliminated entirely. The following table shows the USAGE specifications for changing the separating character.
Format |
Display |
---|---|
YMD |
93/12/24 |
Y.M.D |
93.12.24 |
Y-M |
93-12 |
YBMBD |
93 12 24 (The letter B signifies blank spaces.) |
Y|M|D |
931224 (The concatenation symbol (|) eliminates the separation character.) |
Note:
Numeric months and days can be replaced by a translation, such as JAN, January, Wed, or Wednesday. The translated month or day can be abbreviated to three characters or fully spelled out. It can appear in either uppercase or lowercase. In addition, the day of the week (for example, Monday) can be appended to the beginning or end of the date. All of these options are independent of each other.
Translation |
Display |
---|---|
MT |
JAN |
Mt |
Jan |
MTR |
JANUARY |
Mtr |
January |
WR |
MONDAY |
wr |
Monday |
The following chart shows sample USAGE and ACTUAL formats for data stored in a non-FOCUS data source. The Value column shows the actual data value, and the Display column shows how the data appears.
USAGE |
ACTUAL |
Value |
Display |
---|---|---|---|
wrMtrDYY |
A6YMD |
990315 |
Monday, March 15 1999 |
YQ |
A6YMD |
990315 |
99 Q1 |
QYY |
A6YMD |
990315 |
Q1 1999 |
YMD |
A6 |
990315 |
99/03/15 |
MDYY |
A6YMD |
990315 |
03/15/1999 |
Note that the date attributes in the ACTUAL format specify the order in which the date is stored in the non-FOCUS data source. If the ACTUAL format does not specify the order of the month, day, and year, it is inferred from the USAGE format.
A field formatted as a date is automatically validated when entered. It can be entered as a natural date literal (for example, JAN 12 1999) or as a numeric date literal (for example, 011299).
Natural date literals enable you to specify a date in a natural, easily understandable way, by including spaces between date components and using abbreviations of month names. For example, April 25, 1999 can be specified as any of the following natural date literals:
APR 25 1999 25 APR 1999 1999 APR 25
Natural date literals can be used in all date computations, and all methods of data source updating. The following code shows examples:
In WHERE screening WHERE MYDATE IS 'APR 25 1999' In arithmetic expressions MYDATE - '1999 APR 25' In computational date comparisons IF MYDATE GT '25 APR 1999' In comma-delimited data ...,MYDATE = APR 25 1999, ...
The following chart describes the format of natural date literals.
Literal |
Format |
---|---|
Year-month-day |
Four-digit year, uppercase three-character abbreviation, or uppercase full name, of the month, and one-digit or two-digit day of the month (for example, 1999 APR 25 or APRIL 25 1999). |
Year-month |
Year and month as described above. |
Year-quarter |
Year as described above, Q plus quarter number for the quarter (for example, 1999 Q3). |
Month |
Month as described above. |
Quarter |
Quarter as described above. |
Day of week |
Three-character, uppercase abbreviation, or full, uppercase name, of the day (for example, MON or MONDAY). |
The date components of a natural date literal can be specified in any order, regardless of their order in the USAGE specification of the target field. Date components are separated by one or more blanks.
For example, if a USAGE specification for a date field is YM, a natural date literal written to that field can include the year and month in any order. MAY 1999 and 1990 APR are both valid literals.
Numeric date literals differ from natural date literals in that they are simple strings of digits. The order of the date components in a numeric date literal must match the order of the date components in the corresponding USAGE specification. In addition, the numeric date literal must include all of the date components included in the USAGE specification. For example, if the USAGE specification is DMY, then April 25 1999 must be represented as:
250499
Numeric date literals can be used in all date computations and all methods of data source updating.
The general rule for manipulating date fields in arithmetic expressions is that date fields in the same expression must specify the same date components. The date components can be specified in any order, and display options are ignored. Y or YY, Q, M, W, and D are valid components.
Note that arithmetic expressions assigned to quarters, months, or days of the week are computed modulo 4, 12, and 7, respectively, so that anomalies like fifth quarters and thirteenth months are avoided.
For example, if NEWQUARTER and THISQUARTER both have USAGE specifications of Q, and the value of THISQUARTER is 2, then the following statement gives NEWQUARTER a value of 1 (that is, the remainder of 5 divided by 4):
NEWQUARTER = THISQUARTER + 3
How to: |
Two types of conversion are possible: format conversion and date component conversion. In the first case, the value of a date format field can be assigned to an alphanumeric or integer field that uses date display options (see the following section). The reverse conversion is also possible.
In the second case, a field whose USAGE specifies one set of date components can be assigned to another field specifying different date components.
For example, the value of REPORTDATE (DMY) can be assigned to ORDERDATE (Y). In this case, the year is being extracted from REPORTDATE. If REPORTDATE is Apr 27 99, ORDERDATE is 99.
You can also assign the value of ORDERDATE to REPORTDATE. If the value of ORDERDATE is 99, the value of REPORTDATE is Jan 1 99. In this case, REPORTDATE is given values for the missing date components.
field1/format = field2;
where:
Is a date format field, or an alphanumeric or integer format field using date display options.
Is the USAGE (or FORMAT) specification of field1 (the target field).
Is a date format field, or an alphanumeric or integer format field using date display options. The format types (alphanumeric, integer, or date) and the date components (YY, Y, Q, M, W, D) of field1 and field2 do not need to match.
Date fields are represented internally as four-byte binary integers indicating the time elapsed since the date format base date. For each field, the unit of elapsed time is that field smallest date component.
For example, if the USAGE specification of REPORTDATE is MDY, then elapsed time is measured in days, and internally the field contains the number of days elapsed between the entered date and the base date. If you enter the numeric literal for February 13, 1964 (that is, 021364), and then print the field in a report, 02/13/64 appears. If you use it in the equation:
NEWDATE = 'FEB 28 1964' - REPORTDATE ; DAYS/D = NEWDATE ;
then the value of DAYS is 15. However, the internal representation of REPORTDATE is a four byte binary integer representing the number of days between December 31, 1900 and February 13, 1964.
Just as the unit of elapsed time is based on a field smallest date component, so too is the base date. For example, for a YQ field, elapsed time is measured in quarters, and the base date is the first quarter of 1901 on z/OS and the last quarter of 1900 on other platforms. For a YM field, elapsed time is measured in months, and the base date is the first month of 1901 on z/OS and the last month of 1900 on other platforms.
To display blanks or the actual base date in a report, use the SET DATEDISPLAY command described in the Developing Reporting Applications manual. The default value, OFF, displays blanks when a date matches the base date. ON displays the actual base date value.
You do not need to be concerned with the date format internal representation, except to note that all dates set to the base date appear as blanks, and all date fields that are entered blank or as all zeroes are accepted during validation and interpreted as the base date. They appear as blanks, but are interpreted as the base date in date computations and expressions.
There are several types of formats you can use to represent date components, and the different types do not represent the same values or offsets.
The following request retrieves the current date as a full date field named FULLDATE. It creates a partial date field named PARTIALDATE with format YYM, and a component date field named FULLCOMPONENT with format YYMDm, from the full date field. It then creates two new full dates FULLDATE2 and FULLDATE3 by assigning the partial date to one and the component date to the other.
DEFINE FILE GGSALES FULLDATE/YYMD = '2017/09/12'; PARTIALDATE/YYM =FULLDATE; FULLCOMPONENT/YYMDm = FULLDATE; FULLDATE2/YYMD = FULLCOMPONENT; FULLDATE3/YYMD = PARTIALDATE; END TABLE FILE GGSALES PRINT FULLDATE PARTIALDATE FULLCOMPONENT FULLDATE2 FULLDATE3 BY CATEGORY WHERE RECORDLIMIT EQ 1 ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF,$ ENDSTYLE END
The output is shown in the following image. Note that when the partial and component dates are assigned to FULLDATE2 and FULLDATE3, the day assigned is 01 in both cases.
How to: |
By default, if a date field in a non-FOCUS data source contains an invalid date, a message appears and the entire record fails to appear in a report. For example, if a date field contains '980450' with an ACTUAL of A6 and a USAGE of YMD, the record containing that field does not appear. The SET ALLOWCVTERR command enables you to display the rest of the record that contains the incorrect date.
Note: The ALLOWCVTERR parameter is not supported for virtual fields.
SET ALLOWCVTERR = {ON|OFF}
where:
Enables you to display a field containing an incorrect date.
Generates a diagnostic message if incorrect data is encountered, and does not display the record containing the bad data. OFF is the default value.
When a bad date is encountered, ALLOWCVTERR sets the value of the field to either MISSING or to the base date, depending on whether MISSING=ON.
The following chart shows the results of interaction between DATEDISPLAY and MISSING, assuming ALLOWCVTERR=ON and the presence of a bad date.
|
MISSING=OFF |
MISSING=ON |
---|---|---|
DATEDISPLAY=ON |
Displays Base Date 19001231 or 1901/1 |
. |
DATEDISPLAY=OFF |
Displays Blanks |
. |
DATEDISPLAY affects only how the base date appears. See the Developing Reporting Applications manual for a description of DATEDISPLAY.
Date format fields are used in special ways with the following facilities:
-SET &NOW = 'APR 25 1960' ; -SET &LATER = '1990 25 APR' ; -SET &DELAY = &LATER - &NOW ;
In this case, the value of &DELAY is the difference between the two dates, measured in days: 10,957.
In addition to the standard date format, you can also represent a date by using an alphanumeric, integer, or packed-decimal field with date display options (D, M, Y, and T). Note, however, that this does not offer the full date support that is provided by the standard date format.
Alphanumeric and integer fields used with date display options have some date functionality when used with special date functions, as described in the Creating Reports With TIBCO WebFOCUS® Language manual.
When representing dates as alphanumeric or integer fields with date display options, you can specify the year, month, and day. If all three of these elements are present, then the date has six digits (or eight if the year is presented as four digits), and the USAGE can be:
Format |
Display |
---|---|
I6MDY |
04/21/98 |
I6YMD |
98/04/21 |
P6DMY |
21/04/98 |
I8DMYY |
21/04/1998 |
The number of a month (1 to 12) can be translated to the corresponding month name by adding the letter T to the format, immediately after the M. For instance:
Format |
Data |
Display |
---|---|---|
I6MTDY |
05/21/98 |
MAY 21 98 |
I4MTY |
0698 |
JUN 98 |
I2MT |
07 |
JUL |
If the date has only the month element, a format of I2MT displays the value 4 as APR, for example. This is particularly useful in reports where columns or rows are sorted by month. They then appear in correct calendar order. For example, JAN, FEB, MAR, because the sorting is based on the numeric, not alphabetical, values. (Note that without the T display option, I2M is interpreted as an integer with a floating dollar sign.)
How to: |
The date-time data type supports both the date and time, similar to the timestamp data types available in many relational data sources.
Date-time fields are stored in eight, ten, or 12 bytes: four bytes for date and either four, six, or eight bytes for time, depending on whether the format specifies a microsecond or nanosecond.
Computations only allow direct assignment within data types: alpha to alpha, numeric to numeric, date to date, and date-time to date-time. All other operations are accomplished through a set of date-time functions. See the Using Functions manual for information on subroutines for manipulating date-time fields.
Date-time formats can also produce output values and accept input values that are compatible with the ISO 8601:2000 date-time notation standard. A SET parameter and specific formatting options enable this notation.
SET DTSTANDARD = {OFF|ON|STANDARD|STANDARDU}
where:
Does not provide compatibility with the ISO 8601:2000 date-time notation standard. OFF is the default value.
Enables recognition and output of the ISO standard formats, including use of T as the delimiter between date and time, use of period or comma as the delimiter of fractional seconds, use of Z at the end of universal times, and acceptance of inputs with time zone information. STANDARD is a synonym for ON.
Enables ISO standard formats (like STANDARD) and also, where possible, converts input strings to the equivalent universal time (formerly known as Greenwich Mean Time), thus enabling applications to store all date-time values in a consistent way.
The following request displays date-time values input in ISO 8601:2000 date-time standard formats. With SET DTSTANDARD=OFF, the request terminates with a (FOC177): INVALID DATE CONSTANT:
SET DTSTANDARD = &STAND DEFINE FILE EMPLOYEE -* The following input is format YYYY-MM-DDThh:mm:ss.sTZD DT1/HYYMDs = DT(2004-06-01T19:20:30.45+01:00); -* The following input has comma as the decimal separator DT2/HYYMDs = DT(2004-06-01T19:20:30,45+01:00); DT3/HYYMDs = DT(20040601T19:20:30,45); DT4/HYYMDUs = DT(2004-06-01T19:20:30,45+01:00); END TABLE FILE EMPLOYEE HEADING CENTER "DTSANDARD = &STAND " " " SUM CURR_SAL NOPRINT DT1 AS 'DT1: INPUT = 2004-06-01T19:20:30.45+01:00' OVER DT2 AS 'DT2: INPUT = 2004-06-01T19:20:30,45+01:00' OVER DT3 AS 'DT3: INPUT = 20040601T19:20:30,45' OVER DT4 AS 'DT4: OUTPUT FORMAT HYYMDUs' END
With DTSTANDARD= STANDARD, the output shows that the input values were accepted, but the time zone offsets in DT1, DT2, and DT4 (+01:00) were ignored on output. The character U in the format for DT4 causes the T separator to be used between the date and the time:
DTSANDARD = STANDARD DT1: INPUT = 2004-06-01T19:20:30.45+01:00 2004-06-01 19:20:30.450 DT2: INPUT = 2004-06-01T19:20:30,45+01:00 2004-06-01 19:20:30.450 DT3: INPUT = 20040601T19:20:30,45 2004-06-01 19:20:30.450 DT4: OUTPUT FORMAT HYYMDUs 2004-06-01T19:20:30.450
With DTSTANDARD= STANDARDU, the output shows that the values DT1, DT2, and DT4 were converted to universal time by subtracting the time zone offsets (+01:00):
DTSANDARD = STANDARDU DT1: INPUT = 2004-06-01T19:20:30.45+01:00 2004-06-01 18:20:30.450 DT2: INPUT = 2004-06-01T19:20:30,45+01:00 2004-06-01 18:20:30.450 DT3: INPUT = 20040601T19:20:30,45 2004-06-01 19:20:30.450 DT4: OUTPUT FORMAT HYYMDUs 2004-06-01T18:20:30.450
How to: |
Reference: |
In a Master File, the USAGE (or FORMAT) attribute determines how date-time field values appear in report output and forms, and how they behave in expressions and functions. For FOCUS data sources, it also determines how they are stored.
Format type H describes date-time fields. The USAGE attribute for a date-time field contains the H format code and can identify either the length of the field or the relevant date-time display options.
The MISSING attribute for date-time fields can be ON or OFF. If it is OFF, and the date-time field has no value, it defaults to blank.
This format is appropriate for alphanumeric HOLD files or transaction files.
USAGE = Hn
where:
Is the field length, from 1 to 23, including up to eight characters for displaying the date and up to nine, 12, or 15 characters for the time. For lengths less than 20, the date is truncated on the right.
An eight-character date includes four digits for the year, two for the month, and two for the day of the month, YYYYMMDD.
A nine-character time includes two digits for the hour, two for the minute, two for the second, and three for the millisecond, HHMMSSsss. The millisecond component represents the decimal portion of the second to three places.
A twelve-character time includes two digits for the hour, two for the minute, two for the second, three for the millisecond, and three for the microsecond, HHMMSSsssmmm. The millisecond component represents the decimal portion of the second value to three places. The microsecond component represents three additional decimal places beyond the millisecond value.
A fifteen-character time includes two digits for the hour, two for the minute, two for the second, three for the millisecond, three for the microsecond and three for the nanosecond, HHMMSSsssmmmnnn. The millisecond component represents the decimal portion of the second value to three places. The microsecond component represents three additional decimal places beyond the millisecond value. The nanosecond component represents three additional decimal places beyond the microsecond value.
With this format, there are no spaces between the date and time components, no decimal points, and no spaces or separator characters within either component. The time must be entered using the 24-hour system. For example, the value 19991231225725333444 represents 1999/12/31 10:57:25.333444PM.
USAGE = Htimefmt1
where:
Is the USAGE format for displaying time only. Hour, minute, and second components are always separated by colons (:), with no intervening blanks. A time value can have a blank immediately preceding an am/pm indicator. For information, see Display Options for a Time-Only Value.
The following table lists the valid time display options for a time-only USAGE attribute. Assume the time value is 2:05:27.123456444 a.m.
Option |
Meaning |
Effect |
---|---|---|
H |
Hour (two digits). If the format includes the option a, b, A, or B, the hour value is from 01 to 12. Otherwise, the hour value is from 00 to 23, with 00 representing midnight. |
Prints a two-digit hour. For example: USAGE = HH prints 02 |
h |
Hour with zero suppression. If the format includes the option a, b, A, or B, the hour value is from 1 to 12. Otherwise, the hour is from 0 to 23. |
Displays the hour with zero suppression. For example: USAGE = Hh prints 2 |
I |
Minute (two digits). The minute value is from 00 to 59. |
Prints the two-digit minute. For example: USAGE = HHI prints 02:05 |
i |
Minute with zero suppression. The minute value is from 0 to 59. |
Prints the minute with zero suppression. This cannot be used together with an hour format (H or h). For example: USAGE = Hi prints 5 |
S |
Second (two digits). S: 00 to 59 |
Prints the two-digit second. For example: USAGE = HHIS prints 02:05:27 |
s |
Millisecond (three digits, after the decimal point in the second). 000 to 999 |
Prints the second to three decimal places. For example: USAGE = HHISs prints 02:05:27.123 |
m |
Microsecond (three additional digits after the millisecond). 000 through 999 |
Prints the second to six decimal places. For example: USAGE = HSsm prints 27.123456 |
n |
Nanosecond (three additional digits after the microsecond). 000 through 999 |
Prints the second to nine decimal places. For example: USAGE = HSsn prints 27.123456444 |
x |
Instead of using S, s, m, or n, you can specify up to nine decimal places for seconds using the x option, where x is a number from 1 to 9. Alternatively, you can use the s, m, and n formats to display three, six, or nine decimal places. |
USAGE = HHI1 prints 02:05:27.1 |
A |
12-hour time display with AM or PM in uppercase. |
Prints the hour from 01 to 12, followed by AM or PM. For example: USAGE = HHISA prints 02:05:27AM |
a |
12-hour time display with am or pm in lowercase. |
Prints the hour from 01 to 12, followed by am or pm. For example: USAGE = HHISa prints 02:05:27am |
B |
12-hour time display with AM or PM in uppercase, with a blank space before the AM or PM. |
Prints the hour from 01 to 12, followed by a space and then AM or PM. For example: USAGE = HHISB prints 02:05:27 AM |
b |
12-hour time display with am or pm in lowercase, with a blank space before the am or pm. |
Prints the hour from 01 to 12, followed by a space followed by am or pm. For example: USAGE = HHISb prints 02:05:27 am |
Z |
24-hour time display with Z to indicate universal time. Z is incompatible with AM/PM output. |
Prints the hour from 01 to 24, followed by Z. For example: USAGE = HHISZ prints 14:30[:20.99]Z |
When the format includes more than one time display option:
Note: Unless you specify one of the AM/PM time display options, the time component appears using the 24-hour system.
USAGE = Hdatefmt [separator] [timefmt2]
where:
Is the USAGE format for displaying the date portion of the date-time field. For information, see Display Options for the Date Component of a Date-Time Field.
Is a separator between the date components. The default separator is a slash (/). Other valid separators are: period (.), hyphen (-), blank (B), or none (N). With translated months, these separators can only be specified when the k option is not used.
With the STANDARD and STANDARDU settings, the separator for dates is always hyphen. The separator between date and time is blank by default. However, if you specify the character U as the separator option, the date and time will be separated by the character T.
Is the format for a time that follows a date. Time is separated from the date by a blank. Time components are separated from each other by colons. Unlike the format for time alone, a time format that follows a date format consists of at most two characters: a single character to represent all of the time components that appear and, optionally, one character for an AM/PM option. For information, see Display Options for the Time Component of a Date-Time Field.
The date format can include the following display options, as long as they conform to the allowed combinations. In the following table, assume the date is February 5, 1999.
Option |
Meaning |
Example |
---|---|---|
Y |
2-digit year |
99 |
YY |
4-digit year |
1999 |
M |
2-digit month (01 - 12) |
02 |
MT |
Full month name |
February |
Mt |
Short month name |
Feb |
D |
2-digit day |
05 |
d |
Zero-suppressed day. A blank space replaces the zero. |
5 |
e |
Zero-removed day. The day number is shifted to the left, and any components to the right of this are shifted to the left. Requires a date separator. |
5 |
o |
Zero-removed month. Automatically implements the e option for a zero-removed day. The month and day numbers are shifted to the left, and any components to the right of these are also shifted. Required a date separator. |
5 |
k |
For formats in which month or day is followed by year, and month is translated to a short or full name, k separates the year from the day with a comma and blank. Otherwise, the separator is a blank. |
USAGE = HMtDkYY prints Feb 05, 1999 |
Note: Unless you specify one of the AM/PM time display options, the time component uses the 24-hour system.
The following request creates the date-time value 01/01/2013. It then displays this value using:
DEFINE FILE GGSALES DATE1A/HMDYY = DT(01/01/2013); DATE1B/HoeYY = DATE1A; DATE1C/HodYY = DATE1A; DATE1D/HMeYY = DATE1A; END TABLE FILE GGSALES SUM DOLLARS NOPRINT DATE1A AS 'HMDYY' DATE1B AS 'HoeYY' DATE1C AS 'HodYY' DATE1D AS 'HMeYY' ON TABLE SET PAGE NOPAGE END
The output is:
HMDYY HoeYY HodYY HMeYY ----- ----- ----- ----- 01/01/2013 1/1/2013 1/1/2013 01/1/2013
The following request creates two dates with date-time formats in which the date component has a leading zero (01). In the first date, the day component is the first component and displays on the left. In the second date, the day component is the second component and displays in the middle. The request prints these dates:
DEFINE FILE GGSALES DATE1A/HDMYY = DT(01/12/2012); DATE2A/HMDYY = DT(12/01/2012); DATE1B/HdMYY = DATE1A; DATE2B/HMdYY = DATE2A; DATE1C/HeMYY = DATE1A; DATE2C/HMeYY = DATE2A; END TABLE FILE GGSALES SUM DOLLARS NOPRINT DATE1A AS 'HDMYY' DATE2A AS '' OVER DATE1B AS 'HdMYY' DATE2B AS '' OVER DATE1C AS 'HeMYY' DATE2C AS '' ON TABLE SET PAGE NOPAGE
On the output, the first row shows the date with all zeros displayed. The second row shows zero suppression of the day number, where the zero has been replaced by a blank space so that all the components are aligned with the components on row 1. The last row shows zero removal, where the zero has been removed from the day number, and all of the remaining characters have been shifted over to the left:
HDMYY 01/12/2012 12/01/2012 HdMYY 1/12/2012 12/ 1/2012 HeMYY 1/12/2012 12/1/2012
The following table lists the valid options. Assume the date is February 5, 1999 and the time is 02:05:25.444555333 a.m.
Option |
Meaning |
Example |
---|---|---|
H |
Prints hour. |
USAGE = HYYMDH prints 1999/02/05 02 |
I |
Prints hour:minute. |
USAGE = HYYMDI prints 1999/02/05 02:05 |
S |
Prints hour:minute:second. |
USAGE = HYYMDS prints 1999/02/05 02:05:25 |
s |
Prints hour:minute:second.millisecond. |
USAGE = HYYMDs prints 1999/02/05 02:05:25.444 |
m |
Prints hour:minute:second.microsecond. |
USAGE = HYYMDm prints 1999/02/05 02:05:25.444555 |
n |
Prints hour:minute:second.nanosecond. |
USAGE = HYYMDn prints 1999/02/05 02:05:25.444555333 |
x |
Instead of using S, s, m, or n, you can specify up to nine decimal places for seconds using the x option, where x is a number from 1 to 9. Alternatively, you can use the s, m, and n formats to display three, six, or nine decimal places. |
USAGE = HYYMD1 prints 1999/02/05 02:05:25.4 |
A |
Prints AM or PM. This uses the 12-hour system and causes the hour to be printed with zero suppression. |
USAGE = HYYMDSA prints 1999/02/05 2:05:25AM |
a |
Prints am or pm. This uses the 12-hour system and causes the hour to be printed with zero suppression. |
USAGE = HYYMDSa prints 1999/02/05 2:05:25am |
B |
Prints AM or PM, preceded by a blank space. This uses the 12-hour system and causes the hour to be printed with zero suppression. |
USAGE = HYYMDSB prints 1999/02/05 2:05:25 AM |
b |
Prints am or pm, preceded by a blank space. This uses the 12-hour system and causes the hour to be printed with zero suppression. |
USAGE = HYYMDSb prints 1999/02/05 2:05:25 am |
Z |
Prints Z to indicate universal time. This uses the 24-hour system. Z is incompatible with AM/PM output. |
USAGE = HHISZ prints 14:30[:20.99]Z |
The date components can be in any of the following combinations and order:
How to: |
Reference: |
The character format AnV is supported in Master Files for FOCUS, XFOCUS, and relational data sources. This format is used to represent the VARCHAR (variable length character) data types supported by relational database management systems.
For relational data sources, AnV keeps track of the actual length of a VARCHAR column. This information is important when the value is used to populate a VARCHAR column in a different RDBMS. It affects whether trailing blanks are retained in string concatenation and, for Oracle, string comparisons (the other relational engines ignore trailing blanks in string comparisons).
In a FOCUS or XFOCUS data source, AnV does not provide true variable length character support. It is a fixed-length character field with two extra leading bytes to contain the actual length of the data stored in the field. This length is stored as a short integer value occupying two bytes. Trailing blanks entered as part of an AnV field count in its length.
Note: Because of the two bytes of overhead and the additional processing required to strip them, AnV format is not recommended for use in non-relational data sources.
FIELD=name, ALIAS=alias, USAGE=AnV [,ACTUAL=AnV] , $
where:
Is the size (maximum length) of the field. It can be from 1 to 4093. Note that because of the additional two bytes used to store the length, an A4093V field is actually 4095 bytes long. A size of zero (A0V) is not supported. The length of an instance of the field can be zero.
Note: HOLD FORMAT ALPHA creates an ACTUAL format of AnW in the Master File. See Propagating an AnV Field to a HOLD File.
The following represents a VARCHAR field in a Master File for a Db2 data source with size 200:
$ VARCHAR FIELD USING AnV FIELD=VARCHAR200, ALIAS=VC200, USAGE=A200V, ACTUAL=A200V,MISSING=ON ,$
The following represents an AnV field in a Master File for a FOCUS data source with size 200:
FIELD=ALPHAV, ALIAS=AV200, USAGE=A200V, MISSING=ON ,$
If a data source has an AnV field, specify the following in order to create a HOLD FORMAT ALPHA file without the length designator:
FIELD=ALPHA, USAGE=A25, ACTUAL=A25V, $
or
DEFINE ... ALPHA/A25 = VARCHAR ; END
or
COMPUTE ALPHA/A25 = VARCHAR ;
In order to alter or create a Master File to include AnV, the data must be converted and the length added to the beginning of the field. For example, issue a HOLD command when the field is described as follows:
FIELD=VARCHAR, ,USAGE=A25V, ACTUAL=A25, $
or
DEFINE ... VARCHAR/A25V = ALPHA ; END
or
COMPUTE VARCHAR/A25V = ALPHA ;
When a user propagates an AnV field to a sequential data source using the HOLD FORMAT ALPHA command, the two-byte integer length is converted to a six-digit alphanumeric length. The field in the HOLD file consists of this six-digit number followed by the character data. The format attributes for this field are:
... USAGE=AnV, ACTUAL=AnW
AnW is created as a by-product of HOLD FORMAT ALPHA. However, it can be read and used for input as necessary. The number of bytes occupied by this field in the HOLD file is 6+n.
The A39V field named TITLEV, is propagated to the HOLD file as:
FIELDNAME = TITLEV ,E03 ,A39V ,A39W ,$
In a binary HOLD file, the USAGE and ACTUAL formats are AnV, although the ACTUAL format may be padded to a full 4-byte word. The number of bytes occupied by this field in the HOLD file is 2+n.
When an AnV field is input into a data source, all bytes in the input field beyond the given length are ignored. These bytes are set to blanks as part of the input process.
When a user creates a relational data source using the HOLD FORMAT sqlengine command, the AnV field generates a VARCHAR column in the relational data source.
For example, the A39V field named TITLEV, is propagated to a HOLD FORMAT DB2 file as:
FIELDNAME = 'TITLEV', 'TITLEV', A39V, A39V ,$
How to: |
You can store any combination of characters as a text field.
FIELD = fieldname, ALIAS = aliasname, USAGE = TXn[F],$
where:
Is the name you assign the text field.
Is an alternate name for the field name.
Is the output display length in TABLE for the text field. The display length may be between 1 and 256 characters.
All letters, digits, and special characters can be stored with this format. The following are some sample text field formats.
Format |
Display |
---|---|
TX50 |
This course provides the DP professional with the skills needed to create, maintain, and report from FOCUS data sources. |
TX35 |
This course provides the DP professional with the skills needed to create, maintain, and report from FOCUS data sources. |
The standard edit options are not available for the text field format.