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.
Figurative constants is an IBM extension, and two extension elements fall into this category:
- Selection of apostrophe (') as the value of the figurative constant QUOTE
- NULL and NULLS for pointers and object references
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.
Syntax:
. -QUOTE- .
>>-LITCHAR=- -+-- -+-- +-APOST- +--- ---- ---- ---- ---- ---- ---- ---- ---> <
'-*-'
APOST
Use APOST if you want the figurative constant [ALL] QUOTE or [ALL] QUOTES to represent one or more apostrophe (') characters.
QUOTE
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 extension element:
- Object-reference relation conditions: A VALUE clause for an object-reference data item can contain only NULL or NULLS.
- Data pointer relation conditions: NULL and NULLS can be used only if the other operand is defined as USAGE POINTER. That is, NULL=NULL is not allowed.
- Procedure-pointer and function-pointer relation conditions: NULL and NULLS can be used only if the other operand is defined as USAGE FUNCTION-POINTER or USAGE PROCEDURE-POINTER. That is, NULL=NULL is not allowed.
-
FUNCTION-POINTER phrase: A VALUE clause for a function-pointer data item can contain only NULL or NULLS.
-
PROCEDURE-POINTER phrase: A VALUE clause for a procedure-pointer data item can contain only NULL or NULLS.
-
POINTER phrase: A VALUE clause for a pointer data item can contain only NULL or NULLS.