Eric Olson
New User
Joined: 21 May 2013 Posts: 2 Location: United States
|
|
|
|
I am in the process of porting an existing 32 bit C application to 64 bit. There are some assembler modules which I am trying to rewrite in C, as I am not well versed in assembler. The current process uses fetch() to load and then execute the (assembler) entry point which performs the equivalent of this C code:
system("PGM=user_pgm1, PARM='1234 abcd xyz'");
However, the manual states (and I have confirmed), that this will not function in AMODE 64.
Is there any C code to do this? Or am I compelled to figure out how to port the assembler module? |
|
Eric Olson
New User
Joined: 21 May 2013 Posts: 2 Location: United States
|
|
|
|
This didn't work, unfortunately.
The code I'm working on is designed to load any entry point, but in particular an assembly which is simply a shell program designed to call DFSORT.
The documentation from the C/C++ guide states:
fetch() also supports AMODE switching: when the function call is made, AMODE will be switched; upon return, the AMODE will be restored.
However, my AMODE 64 C application attempting to fetch the AMODE 31 bit assembly always returns 0, and sets errno to 256, which I haven't found any documentation for. I have tried (referring to the linkage for the function to be fetched):
#pragma linkage (..., OS_NOSTACK) (results in fetch returning 0)
#pragma linkage (..., OS) (results in fetch returning 0)
#pragma linkage (..., OS_UPSTACK) (results in link of C application failing)
I gather OS_NOSTACK to be correct, as the assembler module is not LE compliant from reading the comments.
If I change the assembly JCL to create an AMODE 64 assembler module (by putting AMODE=64 on the link), then my AMODE 64 application can successfully fetch the assembler module. Attempting to use the fetched entry point then abends with OC4 (which is understandable, since it's not been changed to be AMODE 64).
I am working on z/OS 1.8, which I realize is old, but appears to fully support AMODE 64 applications. I can successfully use dllload/dllqueryfn to get entry points from applications which are properly built with AMODE 64. |
|