× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I find it easier to just tack on a NULL in the CL.  That way I don't
have to make the C procedure CL centric.  

DCL VAR(&NULL) TYPE(*CHAR) LEN(1) VALUE(X'00')

CHGVAR VAR(&STRING) VALUE(&STRING |< &NULL)
      -- OR --
CHGVAR VAR(&STRING) VALUE('what ever you want' |< &NULL)
      -- OR --
SOMECMD VAR('TEXT' |< &NULL)  - Assuming the command allows expressions

If you are going to go to the effort of using a C function, why pad with
NULL?  If you know the length just use this:

char c_str[max_size];

memcpy(c_str, cl_str, len);
c_str[len] = '\0';

8< - - -

If you want to return an int result to CL, you need to make a procedure
call, not a program call.  This means your CL must be CLLE.  Declare a 4
character variable named &RTNVAL and use CALLPRC PRC(C_PGM) PARAM(&PARM)
RTNVAL(%BIN(&RTNVAL)), then test %BIN(&RTNVAL) or move it to an *DEC.  I
have not tried to return a string, I don't know if the return value is
done by reference or value.

C could write EBCDIC to a DB/2 file and CL can open and read that.  You
could also use a *DTAQ or *DTAARA via an API and CL can read either of
those just also.    

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.