Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Rexx and C on OS/390

24 views
Skip to first unread message

AJS

unread,
Sep 3, 2002, 11:43:28 AM9/3/02
to
Has anyone successfully called a C module from Rexx, and passed it
parms that C could update and that Rexx can see?

If so how? any sample code?

AJS

Stuart Grace

unread,
Sep 3, 2002, 2:06:39 PM9/3/02
to
I don't have much experience with C on OS/390, but I can point you in
the right direction. You should be able to find REXX documentation at
http://publibz.boulder.ibm.com/cgi-bin/bookmgr/LIBRARY. The manual
OS/390 V2R10.0 TSO/E REXX Reference contains information about TSO REXX
programming services.

I can't remember the author, but the following is an example of calling
IRXEXCOM to update a REXX variable from a C program.

/*********************************************************************
C/370 example of calling IRXEXCOM.
This program can be called as a subroutine/function or as a command.
It sets the variable FOOBAR to 12345
**********************************************************************/
#include <stdio.h>
#include <stdlib.h>

/*********************************************************************
declares for calling TSO/E REXX routines
**********************************************************************/
typedef long IRXRTN_TYP ();
#pragma linkage(IRXRTN_TYP,OS)

/*********************************************************************
useful constants
**********************************************************************/
#define HIBIT 0x80000000

/*********************************************************************
declares for calling IRXEXCOM
**********************************************************************/
struct IRXEXCOM_PARMS {
char * parm1;
long parm2;
long parm3;
struct SHVBLOCK * parm4;
struct ENVBLOCK * parm5;
long * parm6;
};
IRXRTN_TYP * irxexcom;
#define IRXEXCOM "IRXEXCOM"

/*********************************************************************
declares for SHVBLOCK
**********************************************************************/
struct SHVBLOCK {
struct SHVBLOCK * shvnext;
long shvuser;
char shvcode;
char shvret;
long shvbufl;
char * shvnama;
long shvnaml;
char * shvvala;
long shvvall;
};

#define SHVBLEN 32

#define SHVFETCH 'F'
#define SHVSTORE 'S'
#define SHVDROPV 'D'
#define SHVSYSET 's'
#define SHVSYFET 'f'
#define SHVSYDRO 'd'
#define SHVNEXTV 'N'
#define SHVPRIV 'P'

#define SHVCLEAN 0x00
#define SHVNEWV 0x01
#define SHVLVAR 0x02
#define SHVTRUNC 0x04
#define SHVBADN 0x08
#define SHVBADV 0x10
#define SHVBADF 0x80

main()
{
long int retcode;
char * irxexcom_id = IRXEXCOM;
struct IRXEXCOM_PARMS parameter_list;
struct SHVBLOCK localshvblock;
struct SHVBLOCK * localshvblockaddr;
char * variablename = "FOOBAR";
char * variablevalue = "12345";

localshvblockaddr = &localshvblock;
localshvblock.shvnext = NULL;
localshvblock.shvuser = 0;
localshvblock.shvcode = SHVSYSET;
localshvblock.shvret = SHVCLEAN;
localshvblock.shvbufl = 0;
localshvblock.shvnama = &variablename??(0??);
localshvblock.shvnaml = strlen(variablename);
localshvblock.shvvala = &variablevalue??(0??);
localshvblock.shvvall = strlen(variablevalue);

parameter_list.parm1 = &irxexcom_id??(0??);
parameter_list.parm2 = 0;
parameter_list.parm3 = 0;
parameter_list.parm4 = (struct SHVBLOCK *)
((long int) localshvblockaddr | HIBIT);

irxexcom = (IRXRTN_TYP *) fetch(IRXEXCOM);

retcode = irxexcom(parameter_list.parm1,
&parameter_list.parm2,
&parameter_list.parm2,
parameter_list.parm4);
printf("Return code from IRXEXCOM=%d\n",retcode);
printf("SHVRET =0x%x\n",localshvblock.shvret);

AJS

unread,
Sep 5, 2002, 9:53:26 AM9/5/02
to
Thanks, I'll give it a try.

AJS

Stuart Grace <Stug...@att.com> wrote in message news:<3D74FA2E...@att.com>...

0 new messages