PreviousData General Interactive COBOL V1.3 Syntax Support

Chapter 13: Siemens BS2000 COBOL Syntax Support

When the DIALECT Compiler directive is set to BS2000 or BS2000-OFFLOAD, the syntax listed in this chapter is accepted by your COBOL system for compatibility with Siemens BS2000 COBOL. Many features found in Siemens BS2000 COBOL exist already in this COBOL implementation. These are documented in your Language Reference and include the features marked in that document as ANS85. Some of the compatibility syntax listed in this chapter is identical to standard COBOL syntax, but behaves differently if you set the DIALECT Compiler directive to BS2000 or BS2000-OFFLOAD when you submit your source code to your COBOL system. See the COBOL85 (BS2000) COBOL Compiler Reference Manual for a full description of the Siemens BS2000 COBOL syntax.

This chapter is organized in the same order as the Language Reference, which differs from the order of presentation in the Siemens documentation.

13.1 Concepts

13.1.1 Indicator Area

A comment line may appear anywhere in the compilation group.

13.1.2 Areas A and B

The level number 01 may begin in either area A or area B.

13.1.3 Special Registers

The special registers SORT-CORE-SIZE, SORT-FILE-SIZE, SORT-MODE-SIZE, SORT-RETURN and TALLY are supported as described in the Language Reference. The special register RETURN-CODE is also supported, but it has the description PIC S9(8) COMP-5 SYNC.

13.1.4 Nonnumeric Literals

Nonnumeric literals may be from 1 to 180 characters in length.

13.1.5 Floating-point Literals

Floating-point literals are supported as described in the Language Reference.

13.1.6 Function-Identifier

A function-identifier that references an integer or numeric function can be used as the source of a MOVE statement, as well as in an arithmetic expression.

13.1.7 Representation of Numeric Items

13.1.7.1 The BINARY, COMPUTATIONAL and COMPUTATIONAL-5 phrases

Syntax Rules
  1. These phrases specify binary data items.

  2. The PICTURE clause of a binary data item must contain only 9s, the operational sign S, the assumed decimal point V, and one or more Ps (see The PICTURE Clause in the Language Reference).

  3. The data items are stored in a halfword, fullword, or doubleword, and are aligned only if the SYNCHRONIZED clause is specified.

  4. If a data item described with USAGE IS BINARY is used as a receiving data item, a check is made to determine whether the value to be transferred to this data item exceeds the maximum possible value indicated by the PICTURE character-string. If this is the case, the value is made to conform by truncation. If a receiving data item is described with USAGE IS COMPUTATIONAL or COMPUTATIONAL- 5, this check and any subsequent truncation which may be required is not performed.

General Rules
  1. 1. The storage requirements for binary items vary depending on the number of decimal digits specified in the PICTURE clause, as follows:

    Decimal digits in
    the PICTURE clause
    Bytes required in
    computer storage
    Alignment
    1-4
    5-9
    10-18
    2
    4
    8
    halfword
    fullword
    fullword

  2. The leftmost bit of a binary data item is the operational sign. The remaining bits represent the value.

13.1.8 File Concepts

The line sequential file organization is supported as described in the Language Reference. This support is consistent with the X/Open Portability Guide.

13.1.9 Subscripts

A subscript may be an arithmetic expression that has the value of a positive integer.

As specified in the standard, the value of an index should correspond to a valid occurrence number of the associated table. This compiler also permits corresponding occurrence numbers for 0, negative numbers, and values beyond the maximum permissible occurrence number, but the binary value of the index must remain within the range that is representable in 4 bytes, i.e. -2 ** 31 to 2 ** 31 -1. In these cases, the index must be set to a valid occurrence number before it is used (e.g. with SET UP or SET DOWN), or relative indexing must be used to ensure that only valid table elements are addressed.

13.2 Identification Division

13.2.1 Identification Division Header

The following additional format of the Identification Division header is supported:

	ID DIVISION.

13.2.2 Identification Division Structure

The paragraphs of the Identification Division can be written in any order.

13.3 Environment Division

13.3.1 The Special-Names Paragraph

ARGUMENT-NAME, ARGUMENT-VALUE, ENVIRONMENT-NAME and ENVIRONMENT-VALUE may be specified in the Special-Names paragraph for use in ACCEPT and DISPLAY statements. Their use is consistent with the X/Open Portability Guide and the MERANT Micro Focus implementation.

An implementor-name is a system-name and must be a name from the left column of the following table. The implementor-names and their meanings are:

Implementor-name Meaning
COMPILER-INFO used in ACCEPT statement
CONSOLE System or main console or subconsole; used in ACCEPT and DISPLAY statements
CPU-TIME used in ACCEPT statement
DATE-ISO4 used in ACCEPT statement
JV_jobvariable-name used in ACCEPT and DISPLAY statements
PRINTER System logical printer; used in DISPLAY statement
PRINTER01
...
PRINTER99
treated as PRINTER-1
PROCESS-INFO used in ACCEPT statement
SYSIPT
SYSOPT
treated as comment
TERMINAL used in ACCEPT and DISPLAY statements; same as CONSOLE
TERMINAL-INFO used in ACCEPT statement
TSW-0 ... TSW-31 task switches, used in SET statement and in compares
USW-0 ... USW-31 user switches, used in SET statement and in compares

The mnemonic-name can be the same as the implementor-name. For example:

	TERMINAL IS TERMINAL

JV_jobvariable-name, TSW-n, and USW-n only work when the BS/2000 add-on is present to provide the necessary run-time support.

13.3.2 The File-Control Entry

For all file organizations, the data-name-1 phrase in the ASSIGN clause is supported as described in the Language Reference.

For all file organizations, a second data-name may be specified in the FILE STATUS clause, but it is treated as commentary only.

The LINE SEQUENTIAL phrase is supported in the ORGANIZATION clause as described in the Language Reference.

13.4 Data Division

13.4.1 The File Description Entry

The RECORDING MODE clause may be specified as documented in the Language Reference. The S phrase is not permitted.

Data-name-1 may be specified in the LABEL RECORDS clause as documented in the Language Reference.

13.4.2 The Sort-File Description Entry

The RECORDING MODE clause is permitted, however, there is no need for it since the compiler can determine the information from the associated record descriptions.

The LABEL RECORDS clause may be specified.

13.4.3 The DYNAMIC Clause

General Format

The following clause is accepted in level-01 entries in the Working-Storage Section:

		IS DYNAMIC 

General Rules

  1. This clause is treated as documentary.

13.4.4 The OCCURS Clause

In an OCCURS clause with the DEPENDING phrase, the lower bound (integer-1) may be omitted.

13.4.5 The PICTURE Clause

External floating-point data items are supported as described in the Language Reference

13.4.6 The REDEFINES Clause

Data-name-2 may qualified, however, the qualification is ignored since the required placement of the REDEFINES clause determines the item that is redefined.

13.4.7 The SYNCHRONIZED Clause

The SYNCHRONIZED clause may be specified on a group item. The clause applies to the items subordinate to that group.

The SYNCHRONIZED clause may be specified for a data item whose usage is index, in addition to the usages allowed by the standard.

13.4.8 The USAGE Clause

The additional usages COMPUTATIONAL-1 (COMP-1), COMPUTATIONAL-2 (COMP-2) and COMPUTATIONAL-3 (COMP-3) are supported as described in the Language Reference.

The additional usage COMPUTATIONAL-5 (COMP-5) is described in Representation of Numeric Items in this document.

13.4.9 The VALUE Clause

Format 1 - Additional Syntax Rules
  1. The VALUE clause is prohibited for external floating-point data items.
Format 2

The WHEN SET TO FALSE phrase is supported, as described in the Language Reference.

Format 3

The VALUE clause may be used to initialize the elements of a table.

Format 4

Syntax Rules

Format 4
  1. Format 3 of the VALUE clause must be used only in the Working-Storage section.

  2. All numeric literals in a VALUE clause of an item must have a value which is within the range of values indicated by the associated PICTURE clause, and must not have a value which would require truncation of non-zero digits.

  3. Nonnumeric literals in a VALUE clause of an item must not exceed the size indicated by the associated PICTURE clause.

  4. If the VALUE clause is used in an entry at the group level, the literal must be a figurative constant or a nonnumeric literal, and the group area is initialized without consideration for the individual elementary or group items contained within this group. The VALUE clause must not be stated at the subordinate levels within this group.

  5. The VALUE clause must not be specified for a group item containing items subordinate to it with descriptions including JUSTIFIED or USAGE (other than USAGE IS DISPLAY).

  6. When format 3 is specified, the data description entry must contain an OCCURS clause or be subordinate to a data description entry that contains an OCCURS clause.

  7. Subscript-1 must be a numeric literal that is an integer. If all subscripts have the value 1, no subscripts need be specified; otherwise, all subscripts required to reference an individual element in a table must be specified.

  8. The number of table elements to be initialized is determined as follows:

    1. If integer-1 is not specified, it is the number of repetitions of literal-2.

    2. If integer-1 is specified, it is the number of repetitions of literal-2 times integer-1.

    The number of table elements to be initialized must not exceed the maximum number of occurrences in the table from the point of reference to the end of the table.

  9. If multiple format 3 VALUE clauses are specified in an entry, the TO END phrase may be specified only once.

General Rules

Format 4
  1. All formats of the VALUE clause can be used in one table.

  2. Within the same data description entry, if more than one VALUE clause references the same table element, the value defined by the last specified VALUE clause in the data description entry is assigned to the table element.

  3. A format 3 VALUE clause initializes a table element to the value of literal-2. The table element initialized is identified by subscript-1. Consecutive table elements are initialized, in turn, to the successive occurrences of the value of literal-2. Consecutive table elements are referenced by augmenting by 1 the subscript that represents the least inclusive dimension of the table. When any reference to a subscript, prior to augmenting it, is equal to the maximum number of occurrences specified by its corresponding OCCURS clause, that subscript is set to 1 and the subscript for the next most inclusive dimension of the table is augmented by 1.

  4. If the REPEATED phrase is specified, all occurrences of literal-2 are reused, in the order specified.

    If the TO END phrase is specified, this reuse occurs until the end of the table is reached.

    If the integer-1 TIMES phrase is specified, the occurrences of literal-2 are reused, in the order specified, integer-1 times.

    If the REPEATED phrase is not specified, the occurrences of literal-2 are used, in the order specified, only once.

  5. If a VALUE clause is specified in a data description entry of a data item which is associated with a variable-occurrence data item, the initialization of the data item behaves as if the value of the data item referenced by the DEPENDING ON phrase in the OCCURS clause specified for the variable-occurrence data item is set to the maximum number of occurrences as specified by that OCCURS clause. A data item is associated with a variable-occurrence data item in any of the following cases:

    1. It is a group data item which contains a variable-occurrence data item.

    2. It is a variable-occurrence data item.

    3. It is a data item that is subordinate to a variable-occurrence data item.

  6. The VALUE clause must not conflict with other clauses in the data description of the item or in the data description within the hierarchy of the item. The following rules apply:

    If the category of the item is numeric, all literals in the VALUE clause must be numeric. The literal is aligned in the data item according to the standard alignment rules.

    If the category of the item is alphabetic or alphanumeric, all literals in the VALUE clause must be nonnumeric literals. The literal is aligned in the data item as if the data item had been described as alphanumeric.

    Initialization is not affected by any BLANK WHEN ZERO or JUSTIFIED clause that was specified.

13.5 Procedure Division

13.5.1 Class Condition

The identifier in the class condition can be of usage COMPUTATIONAL-3, as well as the usages DISPLAY and PACKED-DECIMAL that are allowed by the standard.

13.5.2 Intrinsic Functions

In addition to the intrinsic functions specified in the standard, the following intrinsic functions are supported: ADDR, DATE-TO-YYYYMMDD, DAY-TO-YYYYDDD, and YEAR-TO-YYYY. The ADDR function is described below. The other intrinsic functions are described in the Language Reference.

13.5.2.1 The ADDR Function

Description

The ADDR function returns an integer representing the address of argument-1. The type of this function is integer

General Format
FUNCTION ADDR (argument-1)
Arguments
  1. Argument-1 can be a literal or a data-item of any class or category.

Returned Values
  1. The returned value is an integer representing the address of argument-1 at run time.

13.5.3 The ACCEPT Statement

Mnemonic-names associated with the implementor-names ARGUMENT-NUMBER, ARGUMENT-VALUE, ENVIRONMENT-NAME and ENVIRONMENT-VALUE are supported as described in the Language Reference.

Mnemonic-name may be associated with one of the following implementor-names: COMPILER-INFO, CONSOLE, CPU-TIME, DATE-ISO4, job-variable-name (BS2000 job variable), PROCESS-INFO, SYSIPT, TERMINAL or TERMINAL-INFO.

Job-variable-names only work when the BS/2000 add-on is present to provide the necessary run-time support.

SYSIPT, TERMINAL, or CONSOLE specifies the system file from which data is to be read. SYSIPT refers to the system file of that name. TERMINAL refers to the system file SYSDTA (normally assigned to the data terminal). CONSOLE refers to the system console.

When a mnemonic-name is associated with a job-variable-name, it references the associated operating system job variable which is to be read in. If the job variable cannot be read in for some reason, the runtime system issues an error message, and the program is then either continued or aborted, as determined by a compiler directive. In the former case, /* is assumed as the value of identifier.

When mnemonic-name is associated with COMPILER-INFO, CPU-TIME, PROCESS-INFO, or TERMINAL-INFO, it specifies the information which is to be requested. COMPILER-INFO refers to information provided by the compiler. CPU-TIME, PROCESS-INFO, TERMINAL-INFO and DATE-ISO4 refer to information provided by the operating system.

CPU-TIME is moved in accordance with the rules of the MOVE statement from a field with the description PIC 9(6)V9(4).

13.5.4 The CALL Statement

Identifiers in the USING phrase may be groups or elementary items and may have any level number except 88.

BY VALUE identifier may be specified in the USING phrase. Additional details are specified in the Language Reference.

BY CONTENT literal may be specified in the USING phrase. Additional details are specified in the Language Reference.

13.5.5 The CLOSE Statement

13.5.5.1 Sequential Files

The REEL and UNIT phrases are treated as commentary.

The only optional phrase permitted for a line sequential file is the WITH LOCK phrase.

13.5.6 The DISPLAY Statement

Mnemonic-names associated with the implementor-names ARGUMENT-NUMBER, ENVIRONMENT-NAME and ENVIRONMENT-VALUE are supported as described in the Language Reference.

Mnemonic-name may be associated with one of the following implementor-names: CONSOLE, PRINTER, PRINTER01 - PRINTER99, SYSOPT, TERMINAL, job-variable-name (BS2000 job variable).

Job-variable-names only work when the BS/2000 add-on is present to provide the necessary run-time support.

A mnemonic-name associated with CONSOLE, SYSOPT or TERMINAL specifies that the data is to be written to the system operator console.

A mnemonic-name associated with PRINTER or PRINTER01 - PRINTER99 specifies that the data is to be written to the printer.

A mnemonic-name associated with a job-variable-name references a job variable which has a maximum record length of 256 characters. If the total number of characters in the sending operands exceeds the maximum record length, the record will be truncated to the maximum length.

13.5.7 The ENTRY Statement

The ENTRY statement is supported as documented in the Language Reference.

13.5.8 The EVALUATE Statement

Partial expressions are supported in the WHEN and ALSO phrases of the EVALUATE statement as described in the Language Reference.

13.5.9 The EXIT Statement

The EXIT PERFORM statement makes it possible to branch to the end of the PERFORM statement or to a repetition of the loop from an in-line PERFORM statement.

General Formats

	EXIT [TO TEST OF] PERFORM

Syntax Rules

  1. An EXIT [TO TEST OF] PERFORM statement can only be specified within an in-line PERFORM.

  2. An EXIT TO TEST OF PERFORM statement can only refer to format 2, 3, or 4 PERFORM statements (see The PERFORM Statement in the Language Reference).

General Rules

  1. The associated in-line PERFORM statement is exited by the execution of an EXIT PERFORM.

  2. Depending on the format of the PERFORM statement, different branches are made as the result of EXIT TO TEST OF PERFORM:

    1. In a format 2 PERFORM, control passes to the test of "end of loop".

    2. In a format 3 PERFORM, control passes to the test of "UNTIL condition".

    3. When TEST AFTER is specified in format 4, control passes to the test of "UNTIL condition". If the condition is satisfied, the PERFORM statement is terminated. If the condition is not satisfied, augmentation is carried out.

    4. When TEST BEFORE is specified in format 4, control is passed to the increment counter. The test of "UNTIL condition" then follows.

13.5.10 The GOBACK Statement

The GOBACK statement is supported as documented in the Language Reference.

13.5.11 The INSPECT Statement

Identifier-3 ... identifier-n may reference a group item, as well as the elementary items allowed by the standard.

13.5.12 The MERGE Statement

The optional word KEY in the ASCENDING or DESCENDING phrase may be replaced by the word KEY-YY. When KEY-YY is specified, the behavior of the MERGE statement is not changed.

13.5.13 The MOVE Statement

Multiple receiving identifiers may be specified in a MOVE statement with the CORRESPONDING phrase.

13.5.14 The OPEN Statement

13.5.14.1 Sequential Files

For line sequential files, the only permissible open modes are INPUT and OUTPUT; and the REVERSED and NO REWIND phrases must not be specified.

13.5.15 The READ Statement

13.5.15.1 Relative and Indexed Files

The NO LOCK phrase may be specified in both formats of the READ statement. The effect of the NO LOCK phrase is described in the Language Reference. The placement of the phrase differs from the placement in the MF dialect, here the NO LOCK phrase immediately follows the file-name.

In a format 1 READ statement in which the AT END phrase or the NOT AT END phrase is specified, the NEXT phrase is implied and may be omitted.

13.5.16 The REWRITE Statement

The REWRITE statement is not permitted for line sequential files.

13.5.17 The SEARCH Statement

The key (data-name-1 or data-name-2) in a format 2 SEARCH statement (SEARCH ALL) may be specified on either the right hand side or the left hand side of the equality operator in the WHEN phrase. This is shown in the general format of the Language Reference as an OSVS extension.

13.5.18 The SET Statement

The FALSE phrase is supported in a format 2 SET statement, as specified in the Language Reference.

The value of an index-name after the execution of a format 5 or format 6 SET statement need not be a valid occurrence number in the corresponding table, but must be within the range of permissible values for the index as specified in Subscripts earlier in this chapter.

13.5.19 The SORT Statement

13.5.19.1 Sorting of Tables

Format 2 of the SORT statement (table sort) is supported. Most of the details are given in the Language Reference. Additional details are contained in this section.

General format

Syntax Rules
  1. For data-name-3, the same rules apply as for data-name-2.

  2. If the USING phrase is used, data-name-2 and data-name-3 must be described as alphanumeric data items.

General Rules
  1. Data-name-3, if specified, is the table to be sorted; otherwise, the table specified by data-name-2 is sorted.

  2. By specifying USING data-name-3, a second table is used for sort processing. In this case, the elements of the table specified by data-name-3 are transferred to the table specified by data-name-2 and then sorted in the table specified by data-name-2. The individual table elements are transferred in accordance with the rules for the MOVE statement:

  3. Transfer of the data-name-3 table elements to the data-name-2 table ends with the last table element of data-name-3 or on reaching the number of table elements for data-name-2. This means that if the data-name-3 table contains more elements than the data-name-2 table, the excess elements are not transferred. If it contains fewer elements, the excess elements of the data-name-2 table are retained unchanged.

  4. Sort processing does not change the contents of the data-name-3 table.

13.5.19.2 Sorting Two-digit Years with a Century Window

In both formats 1 and 2 of the SORT statement, the optional word KEY in the ASCENDING or DESCENDING phrase may be replaced by the word KEY-YY. When KEY-YY is specified, the behavior of the SORT statement is not changed.

13.5.20 The START Statement

13.5.20.1 Relative and Indexed Files

The NO LOCK phrase may be specified immediatly after START file-name, but is treated as a comment.

The relational operators LESS, LESS OR EQUAL, NOT GREATER and their equivalents are supported as specified in the Language Reference.

13.5.21 The STRING Statement

As in the Micro Focus dialect, the following extension is supported:

The DELIMITED phrase may be omitted only immediately preceding the INTO phrase. If it is omitted, DELIMITED BY SIZE is implied.

13.5.22 The USE Statement

A PERFORM statement within a declarative procedure may reference a nondeclarative procedure, as well as a declarative procedure.

Formats 2 and 3 are supported as specified in the Language Reference.

13.5.23 The WRITE Statement

13.5.23.1 Sequential Files

The identifier in the ADVANCING phrase of the WRITE statement may be an elementary one-character nonnumeric item, as well as an elementary integer data item. If a nonnumeric item is specified, the ADVANCING phrase is treated as a comment.

13.6 Compiler-directing Statements

13.6.1 The COPY Statement

The SUPPRESS phrase of the COPY statement is supported as described in the Language Reference.

COPY statements may be nested as described in the Language Reference.


Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousData General Interactive COBOL V1.3 Syntax Support