Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


Using currency signs

Many programs need to process financial information and present that information using the appropriate currency signs. With COBOL currency support (and the appropriate code page for your printer or display unit), you can use several currency signs in a program.

You can use one or more of the following signs:

To specify the symbols for displaying financial information, use the CURRENCY SIGN clause (in the SPECIAL-NAMES paragraph in the CONFIGURATION SECTION) with the PICTURE characters that relate to those symbols. In the following example, the PICTURE character $ indicates that the currency sign $US is to be used:

    Currency Sign is “$US” with Picture Symbol “$”.
    . . .
77  Invoice-Amount      Pic $$,$$9.99.
. . .
    Display “Invoice amount is ” Invoice-Amount.

In this example, if Invoice-Amount contained 1500.00, the display output would be:

Invoice amount is  $US1,500.00

By using more than one CURRENCY SIGN clause in your program, you can allow for multiple currency signs to be displayed.

You can use a hexadecimal literal to indicate the currency sign value. Using a hexadecimal literal could be useful if the data-entry method for the source program does not allow the entry of the intended characters easily. The following example shows the hexadecimal value X'D5' used as the currency sign:

    Currency Sign X'D5' with Picture Symbol 'U'.
    . . .
01  Deposit-Amount       Pic UUUUU9.99.

If there is no corresponding character for the euro sign on your keyboard, you need to specify it as a hexadecimal value in the CURRENCY SIGN clause.

The hexadecimal value for the euro sign is either X'80' or X'88' depending on the code page in use, as shown in the following table.

Table 8. Hexadecimal value of the euro sign
Code page Euro sign
1250 (Latin 2) X'80'
1251 (Cyrillic) X'88'
1252 (Latin 1) X'80'
1253 (Greek) X'80'
1254 (Turkish) X'80'
1255 (Hebrew) X'80'
1256 (Arabic) X'80'
1257 (Baltic) X'80'
874 (Thai) X'80'

Example: multiple currency signs


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)