Representation of currency sign in output data:

advertisement
OWG-1/29-0072
6 May 2019
Page 1 of 7
Subject:
Refinements to currency sign and currency symbol rules
Author:
Charles C. Stevens
Document references:
1) ISO/IEC 1989:20xx CD 1.2
2) PL22.4/02-0128, Defect report – multiple currency signs (Jones).
3) PL22.4/06-0135, Currency Sign, String, and Symbol Issues with
related (and not so related) problems (Klein)
4) PL22.4/09-0121, Currency sign (et al) Follow Up (Paper 1 of 3)
(Klein)
5) PL22.4/09-0122, Currency sign (et al) Follow Up (Paper 2 of 3)
(Klein)
6) PL22.4/09-0152, 02-0128 / 06-0135 / Currency sign (et al) [D-53]
(Bennett)
7) PL22.4/10-0014, Multiple currency strings [D-5.3] (Stevens)
8) PL22.4/10-0015, Currency sign, string, and symbol issues [D-53.1]
(Stevens)
9) OWG-1/29-0049, Currency sign, string and symbol issues
(Stevens)
10) OWG-1/29-0055, Non-COBOL characters in text-words [D-59]
(Stevens)
11) OWG-1/29-0061, Restore case-mapping tables (Takagi)
Discussion:
The original issue precipitating this effort is described in Reference 2,and a
number of related issues were raised in References 3 throuogh 6. Reference 7
is the PL22.4 response to Reference 2, and Reference 8 is the PL22.4 response
to References 3 through 6.
The relationship between the details of those issues and the proposed changes
in this document are left to a separate response document. The intent of this
document is to provide the actual changes for incorporation into the next revision.
The change to PICTURE character-string syntax rule 3 will be discussed further
at the next OWG-1 meeting.
Changes recommended for the revision:
1)
Page 8, 4, Terms and definitions, add the following two entries after 4.25:
6 May 2019
OWG-1/29-0072
Page 2 of 7
4.25a Case-insensitive: Of, or relating to, the treatment of uppercase
letters and their corresponding lowercase letters as having meanings or
interpretations that are equivalent.
.
4.25b Case-sensitive: Of, or relating to, the treatment of uppercase
letters and their corresponding lowercase letters as having meanings or
interpretations that are distinct from each other.
2)
Page 61, 8.1.1, Computer's coded character set: Add a new paragraph after
all text as follows:
When the computer's compile-time coded character set includes
characters that are not also included in the COBOL character repertoire,
the implementor shall specify any such additional characters that are
prohibited from use as a currency symbol.
3)
Page 63, 8.1.2.1, COBOL character repertoire, general rule 3: Replace
subrule a) with the following
COBOL basic letters are interpreted in a case-insensitive manner, except
when specific rules require the interpretation to be case-sensitive.
NOTE Except as noted in specific rules, character equivalence is
not applicable to the content of alphanumeric and national literals.
For example, in currency strings, uppercase and lowercase
characters are not equivalent, but in currency symbols, they are
equivalent. Thus,' M' and 'm' used as currency strings are not
equivalent, but 'M' and 'm' used as currency symbols are
equivalent.
4)
Page 63, 8.1.2.1, COBOL character repertoire, General rule 4c, as modified
by Reference 11, change to read in part "… Annex C, if any, except when
specific rules require the uppercase and lowercase characters to be
considered distinct from each other."
5)
Page 221, 12.3.6.2, SPECIAL-NAMES paragraph: Add three new syntax
rules immediately after SR18 (renumbering the remainder accordingly:
6 May 2019
OWG-1/29-0072
Page 3 of 7
18a) If literal-7 is an alphanumeric or national literal in hexadecimal
format, the PICTURE SYMBOL phrase shall be present in the
CURRENCY SIGN clause.
NOTE Literals in hexadecimal format specified as literal-7
represent characters from the computer’s runtime coded character
set, and therefore the content of such literals is used at run time
exactly as specified by the user. The limitations as to which
characters may appear in a currency string at compile time do not
apply to the alphanumeric or national characters represented by
hexadecimal literals used as currency strings.
18b) If the character specified as the currency symbol is not a
character in the COBOL character repertoire, any equivalence
between that character and any other character in the computer’s
compile-time coded character set is defined by the implementor. In
all other cases, compile-time equivalence to that currency symbol is
determined as specified in 8.1.2.1, COBOL character repertoire,
general rules.
18c) No two occurrences of a currency symbol in a source unit shall
be equivalent, unless they are associated with identical currency
strings.
NOTE For example, N'M', N'm', 'M' and 'm' [specified as? or] used
as currency symbols are all equivalent.
6)
Page 221, 12.3.6.2, SPECIAL-NAMES paragraph, (existing) syntax rule 19,
introductory sentence: Change to read "If the PICTURE SYMBOL phrase is
not specified, literal-7 is both the currency string and the currency symbol. .
It shall consist of a single character from the computer's coded character set
that is neither the same as nor equivalent to any of the following:". Add an
index entry for "Currency string" and "Currency symbol".
7)
Page 221, 12.3.6.2, SPECIAL-NAMES paragraph: Add the following rule
after (existing) syntax rule 21:
21a) If a source unit contains no CURRENCY SIGN clause that specifies ‘$’
as the currency symbol (either as literal-7 or literal-8), the clause
CURRENCY SIGN ‘$’ PICTURE SYMBOL ‘$’ is implied for that source unit.
6 May 2019
OWG-1/29-0072
Page 4 of 7
8)
Page 221, 12.3.6.2, SPECIAL-NAMES paragraph, (existing) syntax rule 22:
Change to read "Literal-8 shall be an alphanumeric or national literal
consisting of a single character from the computer's compile-time coded
character set. It shall be neither a figurative constant nor a hexadecimal
literal. Literal-8, when specified, is the currency symbol associated with the
currency string specified in literal-7 in the CURRENCY SIGN clause." Add
an index entry for “Currency symbol”.
9)
Page 226, 12.3.6.3, SPECIAL-NAMES paragraph, general rule 13: Change
the second paragraph to read "The runtime value of literal-7 is the currency
string."
10)
Page 226, 12.3.6.3, SPECIAL-NAMES paragraph, DELETE the last
paragraph of general rule 13. The intent of this rule has been incorporated
into the syntax rules (see Item 5 new syntax rule 18b above). .
11)
Page 338, 13.18.39.2, PICTURE clause, Syntax Rule 2:
Change the first sentence in part to read “.. combination of characters used
as picture symbols.” Add the following NOTE after all text associated with
syntax rule 2:
NOTE: The currency symbol may be selected from among any of the
allowable characters from the computer's compile-time coded character
set.
12)
Page 338, 13.18.39.2, PICTURE clause, Syntax Rule 3: Change to read
"The equivalence between an uppercase and a lowercase letter appearing
as a currency symbol in character-string-1 is as specified in 12.3.6.2,
SPECIAL-NAMES, syntax rule [new] 18b. The equivalence between
uppercase and lowercase letters appearing elsewhere in character-string-1
is as specified in 8.1.2.1, COBOL character repertoire, syntax rule 3."
13)
Page 715, A.1, Implementor-defined language element list: Add new
entries after entry 38 as follows:
38a) Currency symbol (equivalence of non-COBOL characters). This
item is required. This item shall be documented in the implementor's user
documentation. (12.3.6.2, SPECIAL-NAMES paragraph, [new] syntax
rule 18b)
6 May 2019
OWG-1/29-0072
Page 5 of 7
38b) Currency symbol (implementor-defined prohibition of characters).
This item is required. This item shall be documented in the implementor's
user documentation. ( 8.1.1, Computer's coded character set)
14)
Page 788. C.13.1, Culturally-specific applications: Add the following
headings and text immediately before the second full paragraph, which
begins "To define a multiple-character currency symbol …":
C.13.1.1, Currency string vs. currency symbol
The currency string is used at run time in input and output data.
The currency string is always specified in the object of the CURRENCY
SIGN clause. It is used exactly as specified therein, subject only to
conversion from the computer's compile-time character set to the computer's
run-time character set.
The currency symbol is used at compile time in PICTURE character-strings
to indicate where and how to place the currency string in output data and
where and how to expect it in input data.
When the PICTURE SYMBOL phrase is specified, the object of that phrase
is the currency symbol; when it is not, the object of the CURRENCY SIGN
clause is the currency symbol (as well as the currency string).
When comparing currency symbols, uppercase and lowercase basic letters
are equivalent, uppercase and lowercase extended letters may be
equivalent, and basic and extended letters may be equivalent.
For example, if the currency sign clause were to be specified as
'CURRENCY SIGN 'm' ', the currency string 'm' appears as 'm' in the output
data, and is expected to be 'm' when appearing in input data (e.g., de-editing
MOVE statements). When no PICTURE SYMBOL phrase is specified for
this currency string, 'm' serves both as the currency string and the currency
symbol, and when used as the currency symbol the characters 'M', N'M' and
N'm' appearing in picture character-strings are all considered equivalent to it.
C.13.1.2, Class test for characters in a particular alphabet.
15)
Page 857, D.2, Substantive changes potentially affecting existing
programs: Add the following entries:
6 May 2019
OWG-1/29-0072
Page 6 of 7
CURRENCY SIGN clause, equivalent currency symbols disallowed: No
two CURRENCY SIGN clauses may specify the same currency symbol, or
currency symbols that are equivalent. Equivalence among basic letters,
extended letters, and basic special characters is determined according to the
general rules for the COBOL character repertoire. Equivalence
determination for other characters is defined by the implementor.
Justification:
When two currency symbols had the same or equivalent values, it was
undefined which was used for the purpose of matching to characters in a
PICTURE character-string. When one or more of such symbols were
associated with different currency strings, it was undefined which would
appear in the output.
It is believed that few programs will be affected by this change.
CURRENCY SIGN clause, hexadecimal literal restrictions: A hexadecimal
literal can only be specified as a currency string if the PICTURE SYMBOL
phrase is specified in the associated CURRENCY SIGN clause. A
hexadecimal literal shall not be specified as a currency symbol.
Justification:
The meaning of a hexadecimal literal is determined at run time. The
prohibition against the use of a hexadecimal literal as a currency symbol, and
the restriction on the use of a hexadecimal literal as a currency string, are
necessary because the meaning of the currency symbol must be known at
compile time.
It is believed that few programs will be affected by these changes. .
16)
Page 857. D.3, Substantive changes not affecting existing programs: Add
the following entries after entry 3:
COBOL character repertoire, equivalence of characters in literals.
There are cases in which a literal represents a letter that has syntactic effect,
and the rules for the context of that literal allow uppercase-to-lowercase
equivalence as well as basic-to-extended-letter equivalence. The rule that no
case mapping occurs for non-hexadecimal alphanumeric and national literals
6 May 2019
OWG-1/29-0072
Page 7 of 7
has been revised to allow for exceptions to be described in the rules for the
particular context in which the literal is specified.
Currency symbol characters: A currency symbol may consist of any
character from the computer's coded character set; it is not limited to the
COBOL character repertoire.
Currency symbol and PICTURE character mapping: A currency symbol
that is a basic letter, an extended letter, or a basic special character from
within the COBOL character repertoire is considered equivalent to a character
in a PICTURE character-string if the two characters are considered equivalent
according to the general rules for the COBOL character repertoire.
Equivalence of characters other than basic letters, extended letters, and basic
special characters is defined by the implementor.
17)
Page 858, D.3, Substantive changes not affecting existing programs: Add
the following three entries after entry 14:
PICTURE character case mapping: For all characters except the currency
symbol, uppercase characters are considered equivalent to their
corresponding lowercase representations for compilation purposes. For
those characters that appear in the result of editing, the individual rules
already specify the form in which they appear in that result.
PICTURE character currency symbol equivalence mapping: For currency
symbols that are basic letters, extended letters, or basic special characters
from within the COBOL character repertoire, equivalence between the symbol
appearing in the PICTURE character-string and the character appearing in
the CURRENCY SIGN clause is determined according to the general rules for
the COBOL character repertoire. Equivalence rules for all other characters in
this context shall be defined by the implementor.
PICTURE character repertoire: The set of characters for a PICTURE
character-string is explicitly expanded to include currency symbols, which
may be characters from outside the COBOL character repertoire.
Download