Skip to main content

Problem:

I need to call a C subroutine from COBOL and pass a null pointer as one of the arguments.  How can I pass a NULL pointer.

Example -

CALL "routine" USING ARG-1, NULL, ARG-3

Resolution:

Attached to this Knowledgebase article is a tar file containing a working demonstration of how to pass a NULL pointer from COBOL to C.   Un-tar and then just enter "make", and the demo will run.   Note that the COBOL program is only two lines but will compile and run successfully.  In the CALL statement in COBOL, the trick is to declare the parameter as "by value 0 size 4".

Attachments:

NULL_pointer_demo.tar

Old KB# 2215