*Process MARGINS(2,132) DLLINIT; jniCommon:package exports(jniCommon01,jniCommon02); Dcl (null,addr,trim, string) builtin; jniCommon01:Proc( JNIEnv , thisObject ) external("_Java_jniCommon_jniCommon01") returns( pointer byvalue ) options( linkage(stdcall) byvalue ); /* no input parameter, reply single string */ /* Include jni.cpy which includes jni_md.cpy */ %noprint; %include jni; %print; /* JNIEnv points to the Java environment. */ /* thisObject is the 'this' pointer of the caller. */ Dcl thisObject type jobject; Dcl my1string type jstring; /* EXT_DATE */ Dcl my2int type jlong; /* INT_DATE */ Dcl my3int type jint; /* PERIOD */ Dcl my4int type jint; /* FUNCTION */ Dcl myClazz type jclass; Dcl myBool type jboolean; Dcl (i,j,k,l,m,n) fixed bin(31); Dcl (p,q,nullptr) pointer; Dcl pliStringPtr Pointer ; Dcl tempStr Char(132) varz; Dcl inMessage Char(256) varz based(pliStringPtr ) ; Dcl myRcm pointer; put skip edit("Test jniCommon01 starting at ",datetime())(2 a); myRcm = _initRcommon(); if myRcm = null then tempStr = "Null Rcommon ptr"; else tempStr = "OK"; pliStringPtr = jniNativeInterface_.NewStringUTF(JNIenv, tempStr); return(pliStringPtr); end jniCommon01; jniCommon02:Proc( JNIEnv , thisObject , my1string , my2string ) external("_Java_jniCommon_jniCommon02") returns( pointer byvalue ) options( linkage(stdcall) byvalue ); /* no input parameter, reply single string */ /* Include jni.cpy which includes jni_md.cpy */ %noprint; %include jni; %print; /* JNIEnv points to the Java environment. */ /* thisObject is the 'this' pointer of the caller. */ Dcl thisObject type jobject; Dcl my1string type jstring; Dcl my2string type jstring; Dcl myClazz type jclass; Dcl myBool type jboolean; Dcl (i,j,k,l,m,n,r) fixed bin(31); Dcl (p,q,nullptr) pointer; Dcl pliStringPtr Pointer ; Dcl tempStr Char(132) varz; Dcl inMessage Char(256) varz based(pliStringPtr ) ; Dcl c16 char(16), c64 char(64); Dcl (dbname1,dbname2,dbname3) char(16); Dcl (fname1,fname2,fname3) char(32); Dcl (dsname1,dsname2,dsname3) char(64); Dcl (myRcm,myDcm1) pointer; /* Get the Java Class for String. */ myClazz = jniNativeInterface_.FindClass(JNIEnv, "java/lang/String"); /* Unpack param 1 - Java String Object - into a string the PL/I can understand. */ pliStringPtr = jniNativeInterface_.GetStringUTFChars(JNIEnv, my1string, myBool ); dbname1 = inMessage; /* Unpack param 2 - Java String Object - into a string the PL/I can understand. */ pliStringPtr = jniNativeInterface_.GetStringUTFChars(JNIEnv, my2string, myBool ); dsname1 = inMessage; display("DLL:jniCommon02("||trim(dbname1)||","||trim(dsname1)||")"); myRcm = _initRcommon(); myDcm1 = _initDcommon(dbname1); tempStr = "NOK"; if myDcm1^=null then do; r = _setDcommonC(myDcm1,"DB_DSNAME",dsname1); if r=0 then do; c64 = _getDcommonC(myDcm1,"DB_NAME"); c16=substr(c64,1,16); c64 = _getDcommonC(myDcm1,"DB_DSNAME"); tempStr="DCOMMON("||trim(c16)||") = "||trim(c64); display(tempStr); end; else tempStr="*Failed* to set dbname dsname"; end; else tempStr="*Failed* to create dcommon "||dbname1; pliStringPtr = jniNativeInterface_.NewStringUTF(JNIenv, tempStr); return(pliStringPtr); end jniCommon02; %include _Rcommon, _Dcommon; end jniCommon; /* package */