You can use QMF's edit codes to specify how to punctuate the values in a column. An edit code is a set of characters that tells QMF how to format and punctuate the data in a specific column of a report. You specify edit codes on the FORM.COLUMNS panel. QMF assigns a default edit code that is based on the data type of the column to each column in a report. You can change the default. For example, you can use an edit code to specify a currency symbol, a decimal point, and commas for numeric data.
You can follow a numeric data edit code (such as L, D, P, or K) with a number that indicates the number of decimal places to use for that data. This number can range from 0 to 99. For example, L2 means to display a numeric value by using the L edit code, and allow 2 digits after a decimal.
Here are some common edit codes:
Note: If the column length of specified form width is less than the amount needed to display the complete Descriptor Area, the Descriptor Area will be truncated to fit into the column space. Edit code 'M' will not alter the width of the column. If the user changes to or from edit code 'M' within the form, the unaltered normal result set will be displayed. Edit code 'M' does not modify the data row.
If a user wants to view the actual LOB data, he can modify FORM.MAIN or FORM.COLUMNS, and change the column edit code to 'C' or 'CW' to display character data. The maximum horizontal width of a report is 32 KB. If the user wants to display LOB data greater than 32 KB, he must specify a column wrapping edit code. If a wrapping edit code is not specified, the LOB data that does not fit within the report will not be displayed; no message will be issued. if a column with the 'M' edit code is null, no metadata will be displayed, and a null indicator will be displayed.
With numeric data edit codes, you can also choose to use a Z edit code in the second position to suppress zero values in a report. For example, DZ indicates numeric data, zero suppression, with a currency symbol, a separator for groups of three digits, and a decimal point and negative sign, if they occur.
With the D edit code, you can also choose to use a C edit code in the second or third position. The C edit code causes QMF to use the currency symbol that you specify with the DSQDC_CURRENCY global variable.
For example, DC indicates numeric data, with the currency symbol that is specified with the DSQDC_CURRENCY global variable, a separator for groups of three digits, and a decimal point and negative sign, if they occur.
Note that if you use both Z and C with the D edit code, C must follow Z.
For additional information about edit codes, see DB2 QMF Reference.
In this example, you will change the edit codes for the SALARY, COMMISSIONS, and TOTAL_EARNINGS columns to display the values as dollar amounts.
To change edit codes:
In this example, type D2 in the SALARY, COMMISSIONS, and TOTAL_EARNINGS columns. The D2 edit code tells QMF to punctuate the values in these columns with a currency symbol, and to allow two digits after the decimal.
FORM.COLUMNS MODIFIED Total Width of Report Columns: 73 NUM COLUMN HEADING USAGE INDENT WIDTH EDIT SEQ --- ---------------------------------------- ------- ------ ----- ----- --- 1 EMPLOYEE_NAME 4 9 C 3 2 DEPT._NUMBER 2 6 L 1 3 JOB 4 5 C 2 4 SALARY 2 12 D2 4 5 COMMISSIONS 2 11 D2 5 6 TOTAL_EARNINGS 4 12 D2 6 *** END ***
DEPT. EMPLOYEE TOTAL NUMBER JOB NAME SALARY COMMISSIONS EARNINGS ------ ----- --------- ------------ ----------- ------------ 15 CLERK KERMISCH $12,258.50 $110.10 $12,368.60 15 CLERK NGAN $12,508.20 $206.60 $12,714.80 15 SALES ROTHMAN $16,502.83 $1,152.00 $17,654.83 20 CLERK JAMES $13,504.60 $128.20 $13,632.80 20 SALES PERNAL $18,171.25 $612.45 $18,783.70 20 CLERK SNEIDER $14,252.75 $126.50 $14,379.25 38 CLERK ABRAHAMS $12,009.75 $236.50 $12,246.25 38 CLERK NAUGHTON $12,954.75 $180.00 $13,134.75 38 SALES O'BRIEN $18,006.00 $846.55 $18,852.55 38 SALES QUIGLEY $16,808.30 $650.25 $17,458.55
The default currency symbol displays. You can specify a different currency symbol to use in the report by using the currency symbol edit code.
To change the currency symbol:
SET GLOBAL (DSQDC_CURRENCY = DM
where DM is the currency symbol you want to use.
The currency symbol can be a string with a length from 1 to 18 bytes.
DEPT. EMPLOYEE TOTAL NUMBER JOB NAME SALARY COMMISSIONS EARNINGS ------ ----- --------- ------------ ----------- ------------- 15 CLERK KERMISCH $12,258.50 $110.10 DM12,368.60 15 CLERK NGAN $12,508.20 $206.60 DM12,714.80 15 SALES ROTHMAN $16,502.83 $1,152.00 DM17,654.83 20 CLERK JAMES $13,504.60 $128.20 DM13,632.80 20 SALES PERNAL $18,171.25 $612.45 DM18,783.70 20 CLERK SNEIDER $14,252.75 $126.50 DM14,379.25 38 CLERK ABRAHAMS $12,009.75 $236.50 DM12,246.25 38 CLERK NAUGHTON $12,954.75 $180.00 DM13,134.75 38 SALES O'BRIEN $18,006.00 $846.55 DM18,852.55 38 SALES QUIGLEY $16,808.30 $650.25 DM17,458.55
If you want a space between the DM currency symbol and the currency values, reissue the SET GLOBAL command as follows:
SET GLOBAL (DSQDC_CURRENCY = 'DM '
DEPT. EMPLOYEE TOTAL NUMBER JOB NAME SALARY COMMISSIONS EARNINGS ------ ----- --------- ------------ ----------- ------------- 15 CLERK KERMISCH $12,258.50 $110.10 DM 12,368.60 15 CLERK NGAN $12,508.20 $206.60 DM 12,714.80 15 SALES ROTHMAN $16,502.83 $1,152.00 DM 17,654.83 20 CLERK JAMES $13,504.60 $128.20 DM 13,632.80 20 SALES PERNAL $18,171.25 $612.45 DM 18,783.70 20 CLERK SNEIDER $14,252.75 $126.50 DM 14,379.25 38 CLERK ABRAHAMS $12,009.75 $236.50 DM 12,246.25 38 CLERK NAUGHTON $12,954.75 $180.00 DM 13,134.75 38 SALES O'BRIEN $18,006.00 $846.55 DM 18,852.55 38 SALES QUIGLEY $16,808.30 $650.25 DM 17,458.55
To change the currency symbol to a dollar sign, issue this command:
SET GLOBAL (DSQDC_CURRENCY = $