Microsoft KB Archive/40857

From BetaArchive Wiki

EXEPACK.EXE Causes Lost Values When CHAINing COBOL 3.0

PSS ID Number: Q40857 Article last modified on 04-20-1993

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

The information in this article applies to:
- Microsoft COBOL for MS-DOS and OS/2, versions 3.0 and 3.0a

Summary: Data items passed between CHAINed programs lose their values if the EXEPACK.EXE program was used to compact the COBOL executable files. The values of the data items are unreadable when they are received in the CHAINed-to program. The same program runs correctly if the COBOL executable files are not packed. The solution at this time is to not use EXEPACK.EXE on executable files that need to share variables. The programs below demonstrate the problem. The following is Program 1: Compile step: COBOL prog1; Link step: LINK prog1; Pack step: EXEPACK prog1.exe chain1.exe DATA DIVISION. WORKING-STORAGE SECTION. 77 FIELD-4 PIC 9(6)V99 VALUE 0. 77 FIELD-5 PIC 9(6)V99 VALUE 0. 77 FIELD-6 PIC X(40) VALUE “HELLO FROM PROGRAM 2”. PROCEDURE DIVISION. MOVE 99 TO FIELD-4. MOVE 999 TO FIELD-5. CHAIN “CHAIN2” USING FIELD-4,FIELD-5,FIELD-6. STOP RUN. The following is Program 2: Compile step: COBOL prog2; Link step: LINK prog2; Pack step: EXEPACK prog2.exe chain2.exe IDENTIFICATION DIVISION. PROGRAM-ID. CHAIN2. DATA DIVISION. WORKING-STORAGE SECTION. 77 FIELD-4 PIC 9(6)V99 VALUE 0. 77 FIELD-5 PIC 9(6)V99 VALUE 0. 77 FIELD-6 PIC X(40) VALUE “HELLO FROM PROGRAM 2”. PROCEDURE DIVISION USING FIELD-4,FIELD-5,FIELD-6. DISPLAY FIELD-4. DISPLAY FIELD-5. DISPLAY FIELD-6. STOP RUN.

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.