Dynamic call between AMODE 31 and AMODE 64 programs
Calls between AMODE 64 programs and AMODE 31 programs (when a subprogram has a different AMODE from the caller) can only be done via dynamic CALL. The caller can be AMODE 31 or 64. No indication in the CALL statement is needed. The dynamic call handler in the COBOL runtime determines the AMODE of the subprogram and processes accordingly.
The programs must be compiled by COBOL 6.3 or above. If the RETURNING phrase in the CALL statement is not used, the AMODE 31 program can be compiled with COBOL 5.1 and later releases. Non-COBOL programs are not supported by mixed AMODE 31/64 COBOL dynamic call.
The user program needs to make sure data items passed in parameters, directly or indirectly, are accessible by the subprogram. The DATA directive can be used to specify the storage location as required.
Both CALL ... USING BY REFERENCE and CALL ... USING BY CONTENT are supported.
CALL ... USING BY VALUE parameter is not supported.
If the CALL ... RETURNING phrase is used, the returning data item must not be larger then 24 bytes.
- zoned decimal
- COMP-3 (packed-decimal)
- COMP (BINARY)
Subprogram in dynamic call
When compiling the caller program, the DLL option is not needed. This is to facilitate mixed AMODE usage when the subprogram of an existing pure AMODE 31 application is recompiled with LP(64) while the caller program can remain in AMODE 31. The subprogram can be called by the caller program without recompiling the caller program with the DLL compiler option.
The subprogram must be a DLL.
- When building a DLL, specify the compiler options EXPORTALL and DLL, and the binder options RENT and DYNAM=DLL.
- The program-id in the DLL program must be the same as the DLL module name. Otherwise the DLL cannot be called using dynamic call.
The same external file can not be accessed by programs with different AMODE settings.