On Tue, Feb 21, 2017 at 12:15 PM, Ze'ev Atlas <
[email protected]> wrote:

> Hi all,I hope someone can guide me.  I have a C library that I want to
> call from PL/I.  I actually have to create an intrface module for some
> reasons.  If I code it in C using #pragma linkage (..., PLI) I have no
> prlblem communicating between the C and the PL/I, but then the C cannot
> communicate with the rest of the library which is compiled without the
> pragma (because it has to communicate with COBOL and the rest of the
> world).  I am considering doing the interface in Assembler.  Does anybody
> have any experience and would share code snippets.Thank youZA
>
> Sent from Yahoo Mail on Android
>

You might want to look in the PL/I Language Reference manual, starting on
page 151. There is an example of a PL/I program calling the C program
"localtime".

Example 2
The following example defines several named types, a structure type (tm),
and
declares the C function that gets a handle to this typed structure:

define alias int  fixed bin(31);
define alias time_t  fixed bin(31);
define structure
          1   tm
             ,2 tm_sec  type int /* seconds after the minute (0-61) */
             ,2 tm_min  type int /* minutes after the hour (0-59)     */
             ,2 tm_hour type int /* hours since midnight (0-23)*/
             ,2 tm_mday type int /* day of the month (1-31) */
             ,2 tm_mon  type int /* months since January (0-11) */
             ,2 tm_year type int /* years since 1900 */
             ,2 tm_wday type int /* days since Sunday (0-6)*/
             ,2 tm_yday type int /* days since January 1 (0-365)*/
             ,2 tm_isdst type int /* Daylight Saving Time flag */
          ;
dcl localtime  ext(’localtime’)
               entry( nonasgn byaddr type time_t )
               returns( byvalue handle tm );
dcl time       ext(’time’)
               entry( byvalue pointer )
               returns( byvalue type time_t );
dcl Daterec type tm;
dcl ltime type time_t;
dcl ptime handle tm;
ltime = time( null() );
ptime = localtime( ltime );
Daterec = ptime => tm;
display ( edit(Daterec.Hours,’99’) || ’:’ ||
 edit(Daterec.Minutes,’99’) || ’:’ ||
 edit(Daterec.Seconds,’99’));


​ref:
https://www.ibm.com/support/knowledgecenter/en/SSY2V3_5.1.0/com.ibm.ent.pl1.zos.doc/lrm.pdf?view=kc
​


-- 
"Irrigation of the land with seawater desalinated by fusion power is
ancient. It's called 'rain'." -- Michael McClary, in alt.fusion

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to