COBOL Linkage section’s prime purpose is to send and receive data from the called program. However, there are some clauses (External, Global, Value), which we need to know if they can use it or not. This post is all about demonstrating these.
1. External Clause
Here, I used external clause. After, compilation it shows error.
COBOL Copy book
01 LINKAGE_COPY_BOOK EXTERNAL.
CALL 'ABC' USING LINKAGE_COPY_BOOK.
Called Program ‘ABC’
PROCEDURE DIVISION USING LINKAGE_COPY_BOOK.
From the ABC program, you’ll get a compilation error. Saying that ‘EXTERNAL is not supported’, but it supports in the working storage section. So, You can’t use ‘EXTERNAL’ in the Linkage section, but you can in Working-storage.
2. Global Clause
You can use the ‘GLOBAL’ clause in the linkage section. The difference between Global and External is – External means any other program that refers to the said copybook. The Global is applicable only in nested programs.
3. Value Clause
You can’t give a Value clause in the Linkage section. But you can give a Value clause for 88 level variables.
88 WS_MALE VALUE '1' to '4'.
88 WS_FEMALE VALUE '5' to '9'
Get new content delivered directly to your inbox.