ILE COBOL Programmer's Guide

Procedure Division

Procedure Division

General Considerations

General Considerations

Binary Data Items

In OPM COBOL/400, when you have data in binary data items, where the value in the item exceeds the value described by the picture clause, you will get unpredictable results. In general, when this item is used, it may or may not be truncated to the actual number of digits described by the picture clause. It usually depends on whether a PACKED intermediate is used to copy the value.

In ILE COBOL, you will also get unpredictable results, but they will be different from those generated by OPM COBOL/400.

8-Byte Binary Data Alignment

In OPM COBOL/400, 8-byte binary items are aligned with 4-byte boundaries if the *SYNC option is specified on the GENOPT parameter of the CRTCBLPGM command.

In ILE COBOL, 8-byte binary items are aligned with 8-byte boundaries if the *SYNC option is specified on the OPTION parameter of the CRTCBLMOD or CRTBNDCBL commands.

Duplicate Paragraph Names

When duplicate paragraph names are found in a COBOL program, the OPM COBOL/400 compiler generates a severity 20 message.

In the same situation, the ILE COBOL compiler generates a severity 30 message.

Number of Subscript

When an incorrect number of subscript are specified for an item (too many, two few, none for an item which requires them, or specified for an item which does not require them), a severity 30 message is generated in ILE COBOL.

In the same situation, OPM COBOL/400 generates a severity 20 message.

Segmentation

Segmentation is not supported in ILE COBOL. Consequently, syntax checking of segment numbers is not performed.

Common Phrases

Common Phrases

(NOT) ON EXCEPTION Phrase

The (NOT) ON EXCEPTION PHRASE has been added to the DISPLAY statement. The addition of these phrases could require you to add the END-DISPLAY scope delimiter to prevent compile time errors.

For example:

         ACCEPT B AT LINE 3 COLUMN 1
           ON EXCEPTION
               DISPLAY "IN ON EXCEPTION"
           NOT ON EXCEPTION
               MOVE A TO B
         END-ACCEPT.

Both the ON EXCEPTION and NOT ON EXCEPTION phrases were meant for the ACCEPT statement; however, without an END-DISPLAY as shown below the NOT ON EXCEPTION would be considered part of the DISPLAY statement.

          ACCEPT B AT LINE 3 COLUMN 1
            ON EXCEPTION
               DISPLAY "IN ON EXCEPTION"
               END-DISPLAY
            NOT ON EXCEPTION
               MOVE A TO B
         END-ACCEPT.

INVALID KEY Phrase

In ILE COBOL, the INVALID KEY phrase is not allowed for sequential access of relative files since the meaning of the invalid key would be indeterminate under these circumstances. The ILE COBOL compiler issues a severity 30 error message in this situation.

The OPM COBOL/400 compiler does not issue any error messages in this situation.

ON SIZE ERROR Phrase

For arithmetic operations and conditional expressions in ILE COBOL, when ON SIZE ERROR is not specified and a size error occurs, the results are unpredictable. The results may be different than those that existed in OPM COBOL/400.

For arithmetic operations and conditional expressions in ILE COBOL, when ON SIZE ERROR is not specified and a divide by zero occurs, the results are unpredictable. The results may be different than those that existed in OPM COBOL/400.

DECLARATIVE Procedures

Declarative Implemented as an ILE Procedure

In ILE COBOL, each DECLARATIVE procedure is an ILE procedure. Thus, each DECLARATIVE procedure run in its own invocation separate from other declaratives and separate from the non-declarative part of the ILE COBOL program. As a result, using invocation sensitive system facilities such as sending and receiving messages, RCLRSC CL command, and overrides will be different in ILE COBOL than in OPM COBOL/400.

Invoking a Declarative from Another Declarative

In ILE COBOL, a declarative may be invoked from another declarative due to an I-O error provided that the former declarative is not already invoked for any reason.

OPM COBOL/400 prevents a declarative from being invoked from another declarative due to an I-O error.

Expressions

Class Condition Expressions

In ILE COBOL, the identifier in a class condition expression cannot be a group item containing one or more signed, numeric elementary items.

Abbreviated Conditional Expressions

For ILE COBOL, the use of parentheses in abbreviated combined relational conditions is not valid. OPM COBOL/400 does not enforce this rule.

Comparing Figurative Constants with Figurative Constants

In OPM COBOL/400, when a figurative constant is compared with another figurative constant, a severity 20 error message is issued and the statement is accepted.

In ILE COBOL, when a figurative constant is compared with another figurative constant, a severity 30 error message is issued and the statement is rejected.

Comparison of Zoned and Non-numeric Items

When comparing zoned items to a non-numeric item, OPM COBOL/400 issues a severity 20 message. ILE COBOL does not issue such a message.

NOT in a Relational Expression

The expression " A NOT NOT = B " is accepted by OPM COBOL/400 but a severity 20 message is generated.

In the same situation, ILE COBOL generates a severity 30 message.

NOT LESS THAN OR EQUAL TO

ILE COBOL allows some forms of conditional expression that are not permitted by OPM COBOL/400. In particular, these include NOT LESS THAN OR EQUAL and NOT GREATER THAN OR EQUAL.

Special Registers

DEBUG-ITEM Special Register

ILE COBOL no longer supports the DEBUG-ITEM special register. When encountered, it is syntax-checked only.

LINAGE-COUNTER Special Register

In OPM COBOL/400, when an integer occurs in the LINAGE clause, the LINAGE-COUNTER is defined as a 2-byte, 5-digit binary item.

In ILE COBOL, when an integer occurs in the LINAGE clause, the LINAGE-COUNTER is defined as a 4-byte, 9-digit binary item.

WHEN-COMPILED Special Register

In OPM COBOL/400, the WHEN-COMPILED special register can be used with just the MOVE statement.

In ILE COBOL, the WHEN-COMPILED special register can be used with any statement.

Extended ACCEPT and DISPLAY Statements

Compile Time Considerations

OPM COBOL/400 requires a value of EXTACCDSP in the GENOPT parameter of the CRTCBLPGM command in order to enable the extended ACCEPT and DISPLAY statements. The EXTACCDSP option does not exist in the CRTCBLMOD/CRTBNDCBL commands for ILE COBOL. In ILE COBOL, extended ACCEPT and DISPLAY statements are always enabled. Since the EXTACCDSP option no longer exists on the PROCESS statement for ILE COBOL, any OPM COBOL/400 program that specifies this option on its PROCESS statement may behave differently when it is compiled using the ILE COBOL compiler. The ILE COBOL compiler determines whether an ACCEPT or DISPLAY statement is extended by looking for CONSOLE IS CRT in the SPECIAL NAMES paragraph or by looking for phrases found in the Format 7 ACCEPT statement or the Format 3 DISPLAY statement.

In ILE COBOL, the following are COBOL reserved words at all times:

In OPM COBOL/400, only fixed tables are supported by the DISPLAY statement. In ILE COBOL, any table is supported by both the ACCEPT and DISPLAY statements.

Reference modified data is supported in the extended ACCEPT and DISPLAY statements for ILE COBOL. It is not supported in OPM COBOL/400.

In OPM COBOL/400 you have to use the *NOUNDSPCHR option to be able to use the extended character set in addition to the basic DBCS character set. In ILE COBOL, you can use either the *NOUNDSPCHR or *UNDSPCHR and still manage DBCS characters properly.

The OPM COBOL/400 compiler issues a severity 30 error message when it encounters a data item whose length is longer than the screen's capacity. The ILE COBOL compiler does not issue such an error.

In ILE COBOL, a severity 30 error message is issued when an identifier or integer on the COLUMN phrase exceeds 8 digits. OPM COBOL/400 does not issue an error.

For syntax checked only phrases in the extended DISPLAY statement, the ILE COBOL compiler performs complete syntax checking of the PROMPT, BACKGROUND-COLOR, and FOREGROUND-COLOR phrases. If any of these phrases are coded incorrectly, the ILE COBOL compiler issues severity 30 error messages. The OPM COBOL/400 compiler does not perform complete syntax checking on the PROMPT, BACKGROUND-COLOR, and FOREGROUND-COLOR phrases and does not issue any compile time error messages.

Run Time Considerations

In OPM COBOL/400, the PRINT key is disabled during the extend ACCEPT operation. In ILE COBOL, the PRINT KEY will be enabled at all times, unconditionally.

In OPM COBOL/400, the SIZE phrase is supported in the DISPLAY statement only. In ILE COBOL, the SIZE phrase is supported in both the ACCEPT and DISPLAY statements. When the specified size is greater than the size implied by the PICTURE clause data length, then OPM COBOL/400 pads blanks to the left when alphanumeric data is justified. ILE COBOL always pads blanks to the right.

In OPM COBOL/400, error message LBE7208 is issued when the data item cannot fit within the screen. In ILE COBOL, alphanumeric data that does not fit within the screen is truncated and numeric data that does not fit within the screen is not displayed. No runtime errors are issued.

When the HELP and CLEAR keys are used to complete the ACCEPT operation on a workstation attached to a 3174 or 3274 remote controller, a runtime error will be issued by ILE COBOL. OPM COBOL/400 will successfully complete this ACCEPT operation without issuing a runtime error.

OPM COBOL/400 always updates all the fields which are handled by the ACCEPT statement. ILE COBOL updates only the fields that the user has changed before pressing the ENTER key for one ACCEPT statement. As a result, the two compilers behave differently in three situations:

CALL Statement

CALL Statement

Lower Case Characters in CALL/CANCEL Literal or Identifier

OPM COBOL/400 allows the CALL/CANCEL literal or identifier to contain lower case characters; however, a program object name that is not a quoted system name (extended name) does not allow lower case characters,. This means the resulting the CALL/CANCEL operation will fail.

ILE COBOL supports two new values on the OPTION parameter of the CRTCBLMOD and CRTBNDCBL commands: *MONOPRC and *NOMONOPRC. The default value, *MONOPRC, causes any lower case letters in the CALL/CANCEL literal or identifier to be converted to upper case. The *NOMONOPRC value specifies that the CALL/CANCEL literal or identifier is not to be converted to upper case.

Passing a File-Name on the USING Phrase

Both OPM COBOL/400 and ILE COBOL allow a file-name to be passed on the USING phrase of the CALL statement; however, OPM COBOL/400 passes a pointer to a FIB (file information block), whereas ILE COBOL passes a pointer to a NULL pointer.

Recursive Calls

ILE COBOL allows recursive programs to be called recursively. ILE COBOL generates a runtime error message when recursion is detected in a non recursive program..

OPM COBOL/400 does not prevent recursion. However, if recursion is attempted with OPM COBOL/400 the results may be unpredictable.

CANCEL Statement

In ILE COBOL, the CANCEL statement will only cancel ILE COBOL programs within the same activation group. In ILE COBOL, a list of called program objects is maintained at the activation group (run unit) level. If the program to cancel does not appear in this list, the cancel is ignored.

In OPM COBOL/400, the CANCEL statement will issue an error message if the program to cancel does not exist in the library list.

COMPUTE Statement

In some cases, the result of exponentiation in ILE COBOL may be slightly different than the results of exponentiation in OPM COBOL/400.

When a COMPUTE statement of an exponentiation expression with a negative value for the mantissa and a negative fractional value for the exponent is performed, OPM COBOL/400 yields undefined results. In the same situation, ILE COBOL generates a CEE2020 exception.

DELETE Statement

In OPM COBOL/400, file status is set to 90 when a record format that is not valid for a file is use on the DELETE statement.

In ILE COBOL, file status is set to 9K when a record format that is not valid for a file is use on the DELETE statement.

EVALUATE Statement

In OPM COBOL/400, when the WHEN phrase is specified with ZERO THRU alphabetic-identifier, the statement is allowed and no diagnostic message is issued.

In the same situation, ILE COBOL issues a severity 30 error message.

Note:
ILE COBOL has relaxed this rule in the case of alphanumeric-identifier THRU alphabetic-identifier since the alphanumeric-identifier can contain only alphabetic characters.

IF Statement

OPM COBOL/400 has a limit of 30 for the nesting depth of IF statements.

ILE COBOL has no practical limit to the nesting depth of IF statements.

In OPM COBOL/400, when the NEXT SENTENCE phrase is used in the same IF statement as the END-IF phrase, control passes to the statement following the END-IF phrase.

In the same situation in ILE COBOL, control passes to the statement following the next separator period, that is, to the first statement of the next sentence.

Note:
The OPM COBOL/400 Reference manual states that the expected behaviour is the same as what actually occurs for ILE COBOL.

INSPECT Statement

ILE COBOL supports reference modification in the INSPECT statement.

OPM COBOL/400 does not include this support.

MOVE Statement

MOVE Statement

Alphanumeric Literals and Index Names

When an alphanumeric literal is moved to an index name, OPM COBOL/400 issues a severity 20 error message. In the same situation, ILE COBOL issues a severity 30 error message.

Alphanumeric Values and Numeric-Edited Literals

When an alphanumeric value containing only numeric characters is moved to a numeric-edited literal (for example, MOVE "12.34" TO NUMEDIT), OPM COBOL/400 defaults the literal to 0. In the same situation, ILE COBOL issues a severity 30 error message.

Boolean Values

OPM COBOL/400 allows a Boolean value to be moved to a reference-modified alphabetic identifier. ILE COBOL does not allow this and issues a severity 30 error message.

CORRESPONDING Phrase

The MOVE, ADD, and SUBTRACT CORRESPONDING statements in ILE COBOL use a difference algorithm from OPM COBOL/400 to determine which items correspond. ILE COBOL could generate a severity 30 error message where in OPM COBOL/400, no message would be issued.

     01 A.
        05  B.
          10  C PIC X(5).
        05  C PIC X(5).
     01 D.
        05  B.
          10  C PIC X(5).
        05  C PIC X(5).
MOVE CORRESPONDING A TO D.

OPM COBOL/400 issues no message; ILE COBOL will issue message LNC1463.

Overlapping Source and Target Strings

If source and target strings are overlapping for a MOVE statement, the result is unpredictable. The move may not behave as it did for OPM COBOL/400 in the same situation.

OPEN Statement

OPEN Statement

Dynamic File Creation

There are two compatibility issues regarding dynamic file creation:

Opening FORMATFILEs

In ILE COBOL, FORMATFILEs can only be opened for OUTPUT. The WRITE statement can be used to write output records to the FORMATFILE.

In OPM COBOL/400, FORMATFILEs can be opened for INPUT, I-O, and OUTPUT.

OPEN OUTPUT or OPEN I-O for OPTIONAL Files

In ILE COBOL, OPEN OUTPUT or OPEN I-O for OPTIONAL files will not create the file, if it does not exist, when the file's organization is INDEXED.

In OPM COBOL/400, the file is created.

PERFORM Statement

In ILE COBOL, within the VARYING...AFTER phrase of the PERFORM statement, identifier-2 is augmented before identifier-5 is set. In OPM COBOL/400, identifier-5 is set before identifier-2 is augmented.

The results of the Format 4 PERFORM statement with the AFTER phrase is different in ILE COBOL compared to OPM COBOL/400. Consider the following example:

     PERFORM PARAGRAPH-NAME-1
             VARYING X FROM 1 BY 1 UNTIL X > 3
                     AFTER Y FROM X BY 1 UNTIL Y > 3.

In OPM COBOL/400, PARAGRAPH-NAME-1 is performed with (X,Y) values of (1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,2), (3,3).

In ILE COBOL, PARAGRAPH-NAME-1 is performed with (X,Y) values of (1,1), (1,2), (1,3), (2,2), (2,3), (3,3).

READ Statement

READ Statement

AT END Not Allowed for Random Reads of Relative Files

In ILE COBOL, the AT END phrase is not allowed for random reads of relative files since the meaning of the random read would be indeterminate under these circumstances. The ILE COBOL compiler issues a severity 30 error message in this situation.

The OPM COBOL/400 compiler does not issue any error messages in this situation.

Error Messages

For ILE COBOL, error message LNC1408, not LNC0651, is issued for the FORMAT phrase when a READ statement is to be performed on a FORMATFILE.

Error message LNC1408 is issued when the device to be read is something other than DATABASE. Error message LNC0651 is issued when the device is DATABASE, but ORGANIZATION is not indexed.

REWRITE Statement

In OPM COBOL/400, file status is set to 90 when a record format that is not valid for a file is used on the REWRITE statement.

In ILE COBOL, file status is set to 9K when a record format that is not valid for a file is used on the REWRITE statement.

SET Statement

When setting a condition-name to TRUE and the associated condition variable is an edited item, OPM COBOL/400 edits the value of the condition-name when it is moved to the condition variable.

ILE COBOL does not perform any editing when the value of the condition-name is moved to the condition variable.

SORT/MERGE Statements

SORT/MERGE Statements

GIVING Phrase and the SAME AREA/SAME RECORD AREA Clauses

In ILE COBOL, file-names associated with the GIVING phrase may not be specified in the same SAME AREA or SAME RECORD AREA clauses. The ILE COBOL compiler issues a severity 30 error message if this situation is encountered.

The OPM COBOL/400 compiler does not issue any messages in this situation.

STOP RUN Statement

When STOP RUN is issued in an ILE activation group, it will cause an implicit COMMIT to take place, which is not the case in OPM COBOL/400.

Note:
A STOP RUN issued in the job default activation group (*DFTACTGRP) will not cause an implicit COMMIT.

STRING/UNSTRING Statements

In OPM COBOL/400, the PROGRAM COLLATING SEQUENCE is used to determine the truth value of the implicit relational conditions in STRING/UNSTRING operations.

In ILE COBOL, the PROGRAM COLLATING SEQUENCE is ignored when determining the truth value of the implicit relational conditions in STRING/UNSTRING operations.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]