# Configuration Section - COBOL

The Configuration Section deals with the characteristics of the source computer and the object computer. This section is divided into three paragraphs:

1. The SOURCE-COMPUTER paragraph, which describes the computer configuration on which the source program is compiled
2. The OBJECT-COMPUTER paragraph, which describes the computer configuration on which the object program produced by the compiler is to be run.
3. The SPECIAL-NAMES paragraph, which relates names used by the compiler to user-defined words in the source program.

The Configuration Section must not be stated in a program that is contained within another program.

The entries explicitly or implicitly stated in the Configuration Section of a program that contains other programs apply to each contained program

SOURCE-COMPUTER paragraph

The SOURCE-COMPUTER paragraph identifies the computer upon which the program is to be compiled.

computer-name-1 is a user-defined word and is only commentary.

All clauses of the SOURCE-COMPUTER paragraph apply to the program in which they are explicitly or implicitly specified and to any program contained within that program.

If the WITH DEBUGGING MODE clause is used,all debugging lines are compiled as if there were a blank in the indicator area.

If the WITH DEBUGGING MODE clause is not specified, any debugging lines are compiled as if they were comment lines unless the Debug compilation option is specified.

When the Debug compilation option is specified, debugging lines are compiled as if there were a blank in the indicator area whether or not the WITH DEBUGGING MODE phrase is specified in the source programs.

When multiple programs are compiled with one invocation of the compiler without the Debug option, the WITH DEBUGGING MODE phrase may be used in one or more of the source programs without affecting other source programs compiled in the same group.

OBJECT-COMPUTER Paragraph

The OBJECT-COMPUTER paragraph identifies the computer on which the program is to be executed.

computer-name-2 is a user-defined word and is only commentary.

All clauses of the OBJECT-COMPUTER paragraph apply to the program in which they are explicitly or implicitly specified and to any program contained within that program.

The MEMORY SIZE clause is treated as commentary.

The PROGRAM COLLATING SEQUENCE clause specifies the program collating sequence to be used in determining the truth value of any nonnumeric comparisons. If the PROGRAM COLLATING SEQUENCE clause is specified, the program collating sequence is the collating sequence associated withalphabet-name-1. If the PROGRAM COLLATING SEQUENCE clause is not specified, the collating sequence is ASCII.

The program collating sequence established in the OBJECT-COMPUTER paragraph determines the truth value of any nonnumeric comparisons that are as follows:

• Explicitly specified in relation conditions.
• Explicitly specified in condition-name conditions.

The program collating sequence established in the OBJECT-COMPUTER paragraph is applied to any nonnumeric merge or sort keys unless the COLLATING SEQUENCE phrase is specified in the respective SORT or MERGE statement.

The SEGMENT-LIMIT clause allows the user to reduce the number of permanent segments in the program, while still retaining the logical properties of fixed portion segments (segment-numbers 0 through 49). When the SEGMENT-LIMIT clause is specified, only those segments having segment-numbers from 0 up to, but not including, the segment-number designated as the segment-limit, are considered as permanent segments of the object program. segment-number-1 must be an integer from 1 to 49.

If the SEGMENT-LIMIT clause is omitted, all segments having segment-numbers 0 through 49 are considered permanent segments of the object program.

The clauses of the OBJECT-COMPUTER paragraph may appear in any order.

SPECIAL-NAMES Paragraph

The SPECIAL-NAMES paragraph relates names used by the compiler to user-defined words in the source program.

All clauses specified in the SPECIAL-NAMES paragraph for a program also apply to programs contained within that program. The alphabet-names, class-names, condition-names, and symbolic-characters specified in the SPECIAL-NAMES paragraph of the containing program may be referenced from any contained program.

Mnemonic-Name Clause

The mnemonic-name clause provides a means to relate names to switches, features, and low-volume I-O devices available in the implementation.

switch-name may be SWITCH-1, SWITCH-2, . . ., SWITCH-8 or UPSI-0, UPSI-1, . . ., UPSI-7.Switch-names UPSI-0 through UPSI-7 are synonymous with switch-names SWITCH-1 through SWITCH-8.

The status of any switch may be altered by the execution of a Format 3 SET statement that specifies as its operand the mnemonic-name associated with that switch.

Zero, one or two condition-names may be defined with each switch-name entry. Condition-names defined in this way become associated with the ON or OFF status of a switch and may be used in condition-name tests in the Procedure Division to interrogate the current setting of the switch.

feature-name-1 may be any of the channel-names C01, C02, . . ., C12. The feature-name entries may be used to associate mnemonic-names with specific channel-names. The mnemonic-names may then be used in WRITE and SEND statements to control vertical positioning on a hard-copy printing device.

low-volume-I-O-name-1 may be CONSOLE, SYSIN, or SYSOUT.CONSOLE is the primary terminal (keyboard and screen) associated with the run unit of which this program is a part. SYS IN is the standard input file for the run unit that may be the keyboard of the primary terminal. SYS OUT is the standard output file for the run unit, which may be the screen of the primary terminal.

mnemonic-name-1, mnemonic-name-2 and mnemonic-name-3 are user-defined words.Their meaning is defined in the SPECIAL-NAMES paragraph, as shown above. Once defined, they may be used in certain contexts within the Procedure Division, as follows:

• mnemonic-name-1 becomes the name of a particular switch; it may be used only in SET statements.
• mnemonic-name-2 becomes a reference to a feature-name.It may be used only in SEND and WRITE statements.
• mnemonic-name-3 becomes a reference to the associated low-volume-I-O-name. It may be used only in ACCEPT and DISPLAY statements.

ALPHABET Clause

ALPHABET alphabet-name-1 IS

The ALPHABET clause provides a means for relating a name to a specified character code set or collating sequence.When the alphabet-name is referenced in the PROGRAM COLLATING SEQUENCE clause in the OBJECT-COMPUTER paragraph, the COLLATING SEQUENCE clause of an Indexed File Control Entry or the COLLATING SEQUENCE phrase of a SORT or MERGE statement, the ALPHABET clause specifies a collating sequence.When the alphabet-name is referenced in a SYMBOLIC CHARACTERS or CODE-SET clause, the ALPHABET clause specifies a character code set.

If the STANDARD-1 phrase is specified,the character code set or collating sequence identified is that defined in American National Standard X3.4-1977, Code for Information Interchange, usually referred to as ASCII. If the STANDARD-2 phrase is specified, the character code set identified is the International Reference Version of the ISO 7-bit code defined in International Standard 646, 7-bit Coded Character Set for Information Processing Interchange. If the NATIVE phrase is specified,the native character set or collating sequence is used. If the code-name phrase is specified with the code-name EBCDIC, the character code or collating sequence is the extended binary coded decimal interchange code (8 bits, no parity).

If the literal form of the ALPHABET clause is specified, the following rules apply:

1. A given character must not be specified more than once in an ALPHABET clause that is referenced in the PROGRAM COLLATING SEQUENCE clause, the COLLATING SEQUENCE clause in the File-Control entry, the COLLATING SEQUENCE phrase of the SORT and MERGE statements, or that is associated with a code set for a file that is opened in either the extend,I-O or output mode.
2. A given character may be specified more than once in an ALPHABET clause only if alphabet-name-1 is referenced in a SYMBOLIC CHARACTERS clause or is associated with a code set for a file that is opened in the input mode.

literal-1, literal-2, literal-3, literal-4, literal-5 and literal-6 must not specify a symbolic-character figurative constant. When a literal in an ALPHABET clause or CLASS clause is numeric,it must be an unsigned integer and its value must be in the range 1 to 256, inclusive. When a literal in an ALPHABET clause or CLASS clause is nonnumeric and it is in a THROUGH or ALSO phrase, it must be one character in length.

The character that has the highest ordinal position in the current program collating sequence is associated with the figurative constant HIGH-VALUE, except when this figurative constant is specified as a literal in the SPECIAL-NAMES paragraph. If more than one character has the highest position in the program collating sequence, the last character specified is associated with the figurative constant HIGH-VALUE.

The character that has the lowest ordinal position in the current program collating sequence is associated with the figurative constant LOW-VALUE, except when this figurative constant is specified as a literal in the SPECIAL-NAMES paragraph.If more than one character has the lowest position in the program collating sequence, the first character specified is associated with the figurative constant LOW-VALUE.

When specified as literals in the SPECIAL-NAMES paragraph, the figurative constants HIGH-VALUE and LOW-VALUE are associated with those characters having the highest and lowest positions, respectively, in the native collating sequence.

The collating sequence identified is that defined according to the following rules:

1. If the literal is numeric, it specifies the ordinal number of a character within the native character set. If the literal is single-character non numeric, it specifies the actual character within the native character set. If the literal is multiple-character nonnumeric,each character in the literal, starting with the leftmost character, is assigned successive ascending positions in the collating sequence being specified.
2. The order in which the literals appear in the ALPHABET clause specifies, in ascending sequence, the ordinal number of the character within the collating sequence being specified.
3. Any characters within the native collating sequence that are not explicitly specified in the literal phrase assume a position (in the collating sequence being specified) that is greater than any of the explicitly specified characters. The relative order within the set of these unspecified characters is the same as the native collating sequence order.
4. If the THROUGH (or THRU) phrase is specified, the set of contiguous characters in the native character set beginning with the character specified by the value of literal-1 and ending with the character specified by the value of literal-2, is assigned a successive ascending position in the collating sequence being specified. In addition, the set of contiguous characters specified by a given THROUGH phrase may specify characters of the native character set in either ascending or descending sequence.
5. If the ALSO phrase is specified, the characters of the native character set specified by the values of literal-1 and literal-3 are assigned to the same position in the collating sequence being specified.

The ALPHABET clause of the SPECIAL-NAMES paragraph defines three different character set mappings:

1. An output code set mapping of native characters to external characters.
2. An input code set mapping of external characters to native characters.
3. A collating sequence mapping of characters to character positions.

Which of these mappings is intended depends on the use made of the defined alphabet. The input or output code set mapping is indicated by the CODE-SET clause of the SELECT or FD entry; the input code set mapping is indicated by the SYMBOLIC CHARACTERS . . . IN alphabet-name clause of the SPECIAL-NAMES paragraph.The collating sequence mapping is indicated by the PROGRAM COLLATING SEQUENCE clause of the OBJECT-COMPUTER paragraph, the COLLATING SEQUENCE clause of the SORT and MERGE statements, and by the COLLATING SEQUENCE clause of the SELECT entry of an indexed organization file.

Code Name Alphabets

RM/COBOL supports four code-names in the ALPHABET clause: NATIVE, STANDARD-1, STANDARD-2 and EBCDIC.

The NATIVE alphabet always represents the 256 character code values possible in the computer. The graphic equivalents of these character code values may be ASCII or EBCDIC, depending on the source computer. The chosen native code set is recorded in the object program.

The STANDARD-1 alphabet contains 128 characters in the range 00h to 7Fh.This alphabet is defined in the documentAmerican National Standard X3.4-1977, Code for Information Interchange and is commonly referred to as ASCII. If the native character set is ASCII,the 128 ASCII characters are represented by the identical values 00h to 7Fh in the native character set, and native characters 80h to FFh have no STANDARD-1 equivalent. If the native character set is EBCDIC, the 128 ASCII characters are represented by the corresponding 128 native EBCDIC values,and the remaining 128 EBCDIC values have no STANDARD-1 equivalent.

The STANDARD-2 alphabet is the same as the STANDARD-1 alphabet except for the currency symbol character.

The EBCDIC alphabet contains 256 characters,128 of which have widely accepted standard ASCII equivalents. For the purpose of processing the SYMBOLIC CHARACTERS clause when the native code set is based on ASCII, all 256 EBCDIC character codes are assigned ASCII equivalents.

Literal Alphabets

RM/COBOL supports user-defined literal alphabets for file code sets and for program, sort-merge, and indexed file collating sequences. One use for a literal code set would be to map all lowercase letters to uppercase on input or output to a file. Another would be to specify a different ASCII to EBCDIC mapping than that built into RM/COBOL. A literal collating sequence could be used to cause lowercase letters in indexed file keys to be treated as uppercase, or to cause numbers to follow letters in indexed file keys. Europeans might use a literal collating sequence to cause the correct ordering of keys that contain letters not in the English alphabet.

The syntax for defining a literal alphabet is:

The value of literal-1 is the ordinal position or value of a native character. The ordinal position of literal-1in the list of literals is the collating position when the alphabet is used as a collating sequence, and is one greater than the binary value of the external character code when used as a code set. The ALSO phrase allows more than one native character to have the same collating position or be translated to the same external character.

For example, the following alphabet causes lowercase and uppercase native characters to be collated to the same position:

The alphabet OUT-UPPER, when used as a code set of a file opened for output, causes lowercase characters in the records being written to be replaced by uppercase characters.

The final phrase—124 THRU 128—is redundant when the alphabet is used as a collating sequence, since unspecified characters are collated in their natural order following the last specified character.If any characters are omitted from the definition of the alphabet and the characters occur in a record being written, a file status 97 will result. The following alphabet causes lowercase external characters to be converted to uppercase native characters on file input:

An alphabet in which a native character occurs more than once may be used only on a file opened for input or in the SYMBOLIC CHARACTERS clause. Such an alphabet is an illegal collating sequence and is an illegal code set on a file opened for output,extend or I-O.

Indexed File Alphabets

RM/COBOL accepts both the CODE-SET and COLLATING SEQUENCE clauses when defining an indexed organization file. The CODE-SET clause can be used on an ASCII object computer to read an IBM EBCDIC ISAM file; the runtime system then performs EBCDIC to ASCII translation of data read and ASCII to EBCDIC translation of data written. The COLLATING SEQUENCE clause can be used to force lowercase and uppercase key values to be treated identically, or to cause a more natural ordering of European characters with diacritical marks.

When the CODE-SET clause is specified and the COLLATING SEQUENCE clause is omitted, the natural collating sequence of the external character set is used. To put it another way:if the COLLATING SEQUENCE is omitted,the alphabet referred to in the CODE-SET clause is used, and the native collating sequence is used if the CODE-SET clause is also omitted.

EBCDIC Translation

The RM/COBOL User Guide contains an appendix that defines the translation between the ASCII and EBCDIC character sets. The ASCII to EBCDIC translation is identical to that described by IBM in the document Systems Network Architecture Format and Protocol Reference Manual: Architecture Logic (SC30-3112-0, March 1976). The EBCDIC to ASCII translation is the inverse of the ASCII to EBCDIC mapping, with the addition that EBCDIC characters with no ASCII equivalent are assigned values in the range 80h to FFh.

SYMBOLIC CHARACTERS Clause

The SYMBOLIC CHARACTERS clause provides the ability to define named figurative constants above and beyond those that are standard in the language. Such additional figurative constants are named by the symbolic-character, which is a user-defined word. A given symbolic-character may not be defined more than once in a program.In the SYMBOLIC CHARACTERS clause, the relationship between each symbolic-character and the corresponding integer is by position; that is,the first symbolic-character-1 is paired with the first integer-1, the second symbolic-character-1 is paired with the second integer-1 , and so on. There must be a one-to-one correspondence between occurrences of symbolic-character-1 and occurrences of integer-1.

If there is no IN alphabet-name-2 clause immediately following integer-1, integer-1 specifies the ordinal position of symbolic-character-1 in the native character set; otherwise, integer-1 specifies the ordinal position of symbolic-character-1in the character set identified by alphabet-name-2.

The ordinal position specified by integer-1 must exist in the native character set. If the IN phrase is specified,the ordinal position must exist in the character set named by alphabet-name-2.

The internal representation of symbolic-character-1 is the internal representation of the character represented in the native character set.

The SYMBOLIC CHARACTERS clause without the IN alphabet phrase associates an identifier with a native character. integer-1 of the format is the position of the ASCII or EBCDIC code rather than the code itself. Position has an offset of 1 from the value of the code. The RM/COBOL User Guide contains an appendix that shows the ASCII and EBCDIC character positions.

For example:

SYMBOLIC CHARACTERS NAK-CHARACTER IS 22;

This clause achieves its intended result only if the native character set is ASCII. If the native character set is EBCDIC, NAK-CHARACTER still receives the value of position 22, but the value is interpreted as a newline character.

The following clauses define an EBCDIC NAK character:

ALPHABET EBCDIC-ALPHABET IS EBCDIC;
SYMBOLIC CHARACTERS NAK-CHARACTER IS 62 IN EBCDIC-ALPHABET;

If the native character set is EBCDIC, the identifier EBCDIC-NAK is associated with the value 62 (3Dh plus 1). If the native character set is ASCII, the identifier EBCDIC-NAK is associated with the value 22.

CLASS Clause

The CLASS clause provides a means of assigning a name to the specified set of characters listed in that clause.class-name can be referenced only in a class condition in the Procedure Division. The characters specified by the values of the literals in this clause define the exclusive set of characters of which this class-name consists. The CLASS clause defines class conditions other than those that are standard to the language.

For each numeric literal in the list,the value of the literal specifies the ordinal number of a character within the native character set. This value must not exceed the value that represents the number of characters in the native character set.

For each nonnumeric literal in the list,the value of the character or characters in the literal specifies the actual character or characters within the native character set. When a nonnumeric literal is used in a THROUGH phrase, it must be a single-character literal.

If the THROUGH phrase is specified, the contiguous characters in the native character set beginning with the character specified by the value of literal-5, and ending with the character specified by the value of literal-6, are included in the set of characters identified by class-name. In addition, the contiguous characters specified by a given THROUGH phrase may specify characters of the native character set in either ascending or descending order.

CURRENCY SIGN Clause

CURRENCY SIGN IS literal-7

The literal that appears in the CURRENCY SIGN clause is used in the PICTURE clause to represent the currency symbol. The literal must be nonnumeric and is limited to a single character. The value of the literal must not be any of the following characters:

• Alphabetic characters A, B, C, D, P, R, S, V, X, Z or the space
• Digits 0 through 9
• Special characters: * + - , . ; () " / =

If the CURRENCY SIGN clause is specified,then both the default currency sign ($)and the currency symbol (cs)specified in the CURRENCY SIGN clause may be used in PICTURE character-strings in that source program, although they are mutually exclusive in any one PICTURE character-string.The values of the currency sign and currency symbol may be changed at execution time by runtime configuration as explained in the RM/COBOL User Guide. If CURRENCY SIGN IS$ is specified, then $is the currency symbol and there is no currency sign. If the CURRENCY SIGN clause is not specified, only the currency sign ($) is used in PICTURE character-strings and there is no currency symbol.

DECIMAL-POINT Clause

DECIMAL-POINT IS COMMA

The DECIMAL-POINT IS COMMA clause declares that the function of the comma and period are exchanged in the character-string of the PICTURE clause, in numeric literals, and in conversion of numeric data for the ACCEPT and DISPLAY statements. The value of the decimal point and comma characters may be changed at execution time by runtime configuration regardless of the presence of this clause as explained in the RM/COBOL User Guide.

NUMERIC SIGN Clause

The NUMERIC SIGN clause declares the default operational sign format for signed numeric display data items described without a SIGN clause in their data description entry. If this clause is not specified, the default is as if NUMERIC SIGN IS TRAILING were specified. However, if the S (Separate Sign) Compile Command Option is specified, the default is modified to be as if SIGN IS TRAILING SEPARATE were specified.

Note Specifying the NUMERIC SIGN IS TRAILING SEPARATE clause in the Special-Names paragraph avoids having to remember to specify the S Compile Command Option on each compile of a source program that requires this option.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd

COBOL Topics