IBM extension (1) - figurative constants
AliceYing 27000649CQ Visits (1553)
IBM® extensions are features, syntax rules, or behavior defined by IBM rather than by the COBOL standards.
In the Appendix of COBOL Language Reference, a table lists IBM extensions with a brief description. If an item is listed as an extension, all related rules are also extensions. For example, USAGE DISPLAY-1 for DBCS characters is listed as an extension; its many uses in statements and clauses are also extensions, but are not listed separately.
This blog entry and the folloing ones aim to introduce these IBM extensions by language area. We will start with figurative constants, and two extension elements fall into this category:
Selection of apostrophe (') as the value of the figurative constant QUOTE
In Enterprise COBOL, the LITCHAR option affects whether the QUOTE figurative constant represents quotation marks or apostrophes.
Use APOST if you want the figurative constant [ALL] QUOTE or [ALL] QUOTES to represent one or more apostrophe (') characters.
Use QUOTE if you want the figurative constant [ALL] QUOTE or [ALL] QUOTES to represent one or more quotation mark (") characters. QUOTE conforms to the COBOL 85 Standard.
QUOTE or QUOTES represents an alphanumeric character when used in a context that requires an alphanumeric character, and represents a national character when used in a context that requires a national character. The national character value of quotation mark is NX'0022'. The national character value of apostrophe is NX'0027'.QUOTE and QUOTES cannot be used in place of a quotation mark or an apostrophe to enclose an alphanumeric literal.
Literals can be delimited with either quotes or apostrophes regardless of whether APOST or QUOTES is in effect. If APOST is used, the figurative constant QUOTE/QUOTES represents one or more apostrophe (') characters.
NULL and NULLS for pointers and object references
NULL and NULLS represents a value used to indicate that data items defined with USAGE POINTER, USAGE PROCEDURE-POINTER, USAGE FUNCTION-POINTER, USAGE OBJECT REFERENCE, or the ADDRESS OF special register do not contain a valid address. NULL can be used only where explicitly allowed in the syntax formats. NULL has the value zero. See the following references for the extenson element: