Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

AMODE 64 C system() alternative

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
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    Post subject: AMODE 64 C system() alternative
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Wed May 22, 2013 11:59 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Get system time in micro second or cl... lind sh CICS 11 Mon Sep 05, 2016 11:14 pm
No new posts Add system date inside of a PS file a... pramitdas DFSORT/ICETOOL 5 Sun Aug 28, 2016 12:06 am
No new posts System availability in CICS Robert Sample CICS 10 Sat Jun 04, 2016 4:35 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us