To match simple C external variables or passed data items, you must choose the appropriate USAGE type. For example, to share an integer variable with a C routine, declare it in COBOL as:
77 MY-SHARED-INT SIGNED-INT, EXTERNAL.
In C, this item is then declared as:
int my_shared_int;
You must also name my_shared_int in the table of external identifiers, as described in the "direct.c" file.
Here is an example of passing an "int" value in a portable fashion to a C routine:
77 MY-INT SIGNED-INT. MOVE 123 TO MY-INT. CALL "C-ROUTINE" USING, BY VALUE, MY-INT.
The ANSI C routine could then read:
void c_routine( int param1 ) { printf( "This should be '123': %d\n", param1 ); }