IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

AMODE 64 C system() alternative


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Eric Olson

New User


Joined: 21 May 2013
Posts: 2
Location: United States

PostPosted: Tue May 21, 2013 8:05 pm
Reply with quote

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?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed May 22, 2013 11:59 am
Reply with quote

Try fetch() with pointer(s).

See chapter 20 in :

z/OS XL C/C++ Programming Guide SC09-4765-13
Back to top
View user's profile Send private message
Eric Olson

New User


Joined: 21 May 2013
Posts: 2
Location: United States

PostPosted: Wed May 29, 2013 10:42 pm
Reply with quote

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.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Sysplex System won't IPL at DR site I... All Other Mainframe Topics 2
No new posts How to delete a user's alias from the... JCL & VSAM 11
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
No new posts JCL Dynamic System Symbols JCL & VSAM 3
No new posts the system or user abend SF0F R=NULL COBOL Programming 0
Search our Forums:

Back to Top