On 4/10/2012 3:11 PM, Phil Smith wrote:
Steve Comstock wrote:
Slipperier and slipperier. OK, let's try a different approach:

You tell me exactly what you want to see from the PL/I routine calling
your API and I'll see if I can cause PL/I to construct that.

In other words, your routine will see

(R1) ->  ????????

rc = THEFUNCTION(magic,inputbuffer,inputlength)

(R1) ==>  A(magic),A(inputbuffer),A(inputlength)<== high bit set on the third 
fullword

OR (the fully specified case):

rc = THEFUNCTION(magic,inputbuffer,inputlength,outputbuffer,outputlength)

(R1) ==>  
A(magic),A(inputbuffer),A(inputlength),A(outputbuffer),A(outputlength)<== high bit 
set on the fifth fullword

Pretty standard, yes?


Yes. And here's some code:

 psubsrk: proc options(main);

 /*  declare invoked subroutines              */

   dcl thefunction entry external('CATCHER') options(asm retcode);
   dcl pliretv builtin;

 /*  declare data items                       */

   dcl magic  fixed bin(31);
   dcl bufone char(1200);
   dcl lenone fixed bin(31) value (1200);
   dcl buftwo char(1600);
   dcl lentwo fixed bin(31) value (1600);

   dcl rslt fixed bin(31);
   dcl msg  char(16) value('Return value is ');

 /*  actual code begins here                   */

  call thefunction(magic, bufone, lenone);
  call thefunction(magic, bufone, lenone, buftwo,lentwo);

  rslt = pliretv();
  put list (msg, rslt);

 end psubsrk;


_Notes_

1. CATCHER was an old routine I had around that does the following:
    * display an entry message (..In CATCHER)
    * display the first seven words pointed at by R1, in hex
    * returns a value of '7' for its return code (hard coded)
    * display an exit message (..Leaving CATCHER)

2. The output from the run is:

..In CATCHER
..c(R1) = 19C1A4D0
..Seven words at address pointed at by R1 =
....: 19C1A500 19C1A504 99C1B074 0000000B 00000001 000000B0 00000000
..Leaving CATCHER
..In CATCHER
..c(R1) = 19C1A4D0
..Seven words at address pointed at by R1 =
....: 19C1A500 19C1A504 19C1B074 19C1A9B4 99C1B070 000000B0 00000000
..Leaving CATCHER
Return value is                      7


3. Notice the first time in the third word is x'99C1B074' - the
   end of list bit is on

   the second call of thefunction the third word is x'1C1B074'
   - the end of list bit is not on there, but the fifth word
   is x'99C1B070' - the end of list bit is on

4. The strange values after the parm pointers
   (e.g.: 0000000B 00000001 000000B0 00000000 in the first call)
   are just random garbage; the compiler does not clear out
   the storage used for the parmlist: it just changes the words
   that actually have parameter entries

So, I think that's pretty straighforward; it's a CALL
instead of a function reference, but it will work. Now,
if you need a function reference I can look into it some
time.


--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
    for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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

Reply via email to