Microsoft KB Archive/44227

Data Name to Define VALUE OF FILE-ID Must Be in First 64K

PSS ID Number: Q44227 Article last modified on 11-03-1989

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

Summary: Variables used to initialize the DATA DIVISION, such as a variable filename must be defined within the first 64K of the WORKING-STORAGE SECTION. The run-time error 108 “Failure to initialize data division” occurs if the variables are not defined in the first 64K of the WORKING-STORAGE SECTION. This information applies to Microsoft COBOL Compiler Versions 3.00 and 3.00a for MS-DOS and MS OS/2.

More Information: The code example below demonstrates that if a data name is used in the VALUE OF FILE-ID clause, the data name must be declared in the first 64K of the WORKING-STORAGE SECTION. This example is composed of a 70K array and a data item used in the VALUE OF FILE-ID clause. If this data item comes before the array, the program works correctly; but if it comes after the array, the run-time error 108 “Failure to initialize data division” results.

Code Example
IDENTIFICATION DIVISION. ENVIRONMENT DIVISION. SPECIAL-NAMES. CONSOLE IS CRT. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT isam1 ASSIGN TO disk ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC RECORD KEY IS isam1-rec-key. DATA DIVISION. FILE SECTION. FD isam1 VALUE OF FILE-ID IS ws-isam1 DATA RECORD IS isam1-rec. 01 isam1-rec. 05 isam1-rec-key PIC x(20). 05 isam1-rec-not-key PIC x(180). WORKING-STORAGE SECTION. **************************************************** * MOVE THE ASTERISKS FROM THIS WS-ISAM1 TO THE ONE * *              FOLLOWING THE ARRAY                * *77 WS-isam1      PIC X(12)  VALUE 'isam1.DAT'. * ****************************************************   01 work. 02 array OCCURS 70000 TIMES. 04 a1 PIC x.  77  WS-isam1      PIC X(12)  VALUE 'isam1.DAT'. PROCEDURE DIVISION. MAIN-LINE. DISPLAY &quot;hi&quot;. STOP RUN. Copyright Microsoft Corporation 1989.