Search code examples
cmainframezosmetalc

problems with memset in Metal C


I’m trying to initialize the Metal C environment with the following code, but get the following errors on the memset line. ERROR CCN3275 IMIJWS0.METAL.SAMPLIB(MEM):6 Unexpected text ')' encountered. ERROR CCN3045 IMIJWS0.METAL.SAMPLIB(MEM):6 Undeclared identifier ___MEMSET. ERROR CCN3277 IMIJWS0.METAL.SAMPLIB(MEM):6 Syntax error: possible missing ')' or ','? CCN0793(I) Compilation failed for file //'IMIJWS0.METAL.SAMPLIB(MEM)'. Object file not created. Below is my code


   #include < string.h>
   #include < stdlib.h>
   #include < metal.h>
   void mymtlfcn(void)  {
   struct __csysenv_s mysysenv;
   memset ( &mysysenv, 0, sizeof ( mysysenv ) );
   mysysenv.__cseversion = __CSE_VERSION_1;
   mysysenv.__csesubpool = 129;
   mysysenv.__cseheap31initsize = 131072;
   mysysenv.__cseheap31incrsize = 8192;
   mysysenv.__cseheap64initsize = 20;
   mysysenv.__cseheap64incrsize = 1;


Solution

  • The issue was with the search order. Although I did search(/usr/metal/include) from with in my JCL I didn't proceed it with a nosearch option, so string.h was getting picked up from the standard system librarys instead of the version included with Metal C. I've pasted my optfile dataset I passed to the CPARM below for refference.

    //OPTIONS DD *
     SO
     LIST
     LONG
     NOXREF
     CSECT
     METAL
     LP64
     NOSEARCH
     search(/usr/include/metal/)