>> Is it possible to statically call a C routine from a COBOL pgm?
Nothing more simple than that...

>> If yes can we also return the result of the C routine(statically
>> called) to the COBOL pgm.
Yes, but not through the RETURN-CODE special register.

>> Do i need to use #pragma for this?
I use #pragma linkage (NSBCGDRV,COBOL) where NSBCGDRV is the name of the 
function as well as of the load module. That tends to make things easy. 

>> Can i return a string from the C routine to my COBOl pgm?
No sweat. But do pay attention to the fact that your average C string will 
be null-terminated, where the common COBOL practice is to have fixed-
length, blank-padded fields to hold character data. A conversion routine is 
easily written, either in C or in COBOL (UNSTRING is a COBOL statement, the 
power of which is very underestimated...)

>> Copied below is my COBOL pgm and C routine.Can anyone please help me
>> with this?

The prototype of my C function is:
void NSBCGDRV(void *PARM, void *rc);

The COBOL call looks like this:

01  W00-NATSTAR-PARM.
    05  PARM-RET-CODE           PIC S9(4) COMP.
    05  PARM-VALUE              PIC X(255).

CALL 'NSBCGDRV' USING PARM-VALUE PARM-RET-CODE


Cheers,

Jantje.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to