Hi there.
I'm a newbie in Metal C and I would like to know if the following is feasible.
We currently have a couple of home made 64 bits C routines, with multiple entry points, compiled with the Dignus C compiler.
These routines are called from a pl/1 31 bits application and provide services to store and retrieve data above the bar to the 31 bits pl/1 application.
Migrating the pl/1 application to 64 bits is currently not an option.
Would it be feasible to port the C routines (currently compiling with the Dignus C compiler) to Metal C?
I'm experimenting with very simple test programs and I'm struggling to have a simple pl/1 main program to call a Metal C routine (both in 31 bits mode) and passing some arguments.
I'm used to call standard C runtime functions from pl/1 and assumed it should not be much different but I can not get it to work.
Could someone provide a very simple example of
1. A pl/1 main program calling a Metal C routine. Any specific compile and bind option consideration ?
Here is my test program which is generating a U4083 REASON=0000000F abend when calling the Metal C routine.
TESTA: PROCEDURE() OPTIONS(MAIN);
DCL WRITEMSG ENTRY(BIN FIXED(31) NONASGN BYVALUE
,CHAR(*) NONASGN BYADDR)
OPTIONS(ASM);
CALL WRITEMSG(11,'Hello world');
END TESTA;
2. A Metal C routine callable from pl/1. Any specific compile and bind option consideration ?
Here is my test Metal C routine:
#pragma filetag("IBM-500")
#include <string.h>
extern void WRITEMSG(int lenMsg, char *msg)
{
struct WTO_Parm
{
short int len;
short int mcsflags;
unsigned char message[100];
};
unsigned char wrkArea[512];
struct WTO_Parm Msg;
memset(&Msg,0,sizeof(Msg));
Msg.len = lenMsg+4;
Msg.len = 15;
Msg.mcsflags = 0;
strcpy(Msg.message,msg);
__asm(" WTO MF=(E,(%0))"
:
: "r"(&Msg)
: "r0","r1","r14","r15");
}
And the options I'm using:
For the compile step
CPARM='METAL,NOSEARCH,SEARCH(/usr/include/metal/),NORENT,',
CPARM2='LOCALE(en_BE),LIST',
For the assemble step
PARM='NORENT'
And for the bind step
PARM='AMODE=31,MAP,NORENT,CASE=MIXED,CALL'
Any help will be greatly appreciated!
Cheers,
Renaud.
0HU5_Renaud_Giot