Hi Frank:
I'm not sure if this will work for all times and in all cases.
Here is my C program simulating a C API that sets errno:
#include <errno.h>
int cfunc()
{
errno = 8;
}
Compiled with no options with z/OS V2.3 XL C/C++
Here is a small COBOL program I wrote
CBL PGMNAME(LongMixed)
Identification Division.
program-id. "FS".
Data Division.
Working-Storage Section.
1 pointer-to-errno usage pointer.
Linkage Section.
1 errno pic S9(9) COMP-5.
Procedure Division.
Display "Calling dummy C API"
Call "cfunc"
Call "__errno" returning pointer-to-errno
Set Address Of errno To pointer-to-errno
Display "errno = " errno
stop run.
End program "FS".
I call my C program to simulate calling a C API. Then, I call __errno which
appears to return the address of errno. I compiled this with V6.2 with no
options other than what is in the CBL card. I compiled, bound and ran on USS.
The result of the run is:
$ ./a.out
Calling dummy C API
errno = 0000000008
$
Try it and if it works, great but put in some comments that say that this
relies on some implementation behaviour. (I'm Canadian and that's how we spell
that last word.)
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN