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
Here, I used external clause. After, compilation it shows error.
COBOL Copy book
MYLINK
01 LINKAGE_COPY_BOOK EXTERNAL.
...
...
...
Calling Program
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
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
Value clause you can’t use in the Linkage section. But you can give in 88 level variables.
01 MY_GROUP.
88 WS_MALE VALUE '1' to '4'.
88 WS_FEMALE VALUE '5' to '9'
Related Posts
References
Get new content delivered directly to your inbox.
–