On 3/30/2012 7:35 AM, McKown, John wrote:
This question is the outgrowth from my writing UNIX programs which are
designed to be run from a UNIX shell prompt in HLASM. The first "outgrowth" was
LE enabling all my UNIX HLASM code. The main reason was to be able to easily use
some selected C language routines, especially sprintf(). Normally, in HLASM, if
we want to dynamically invoke a subroutine, we do with with a LOAD/BALR or LINK
function. However, that does not work well for UNIX programs because, as best as
I can tell, you cannot LOAD or LINK to a program which resides in a UNIX file.
You must put the subroutine in a PDS or PDSE which is accessable to the UNIX
process. Which normally means the LINKLIST or via a dataset referenced in the
STEPLIB environment variable. I am a bit of a "purist". When I'm wrting a UNIX
command, I want everything to be accessable via normal UNIX facilities.

I have written a "do nothing" dll in HLASM just to try to learn how to write
a
DLL in HLASM. I have something that appears to work. Now, I need to write some
HLASM which attempts to actually use that code.

Has anybody else done anything with DLLs in HLASM? If so, what did you think
of it? Another use for DLLs that I find interesting is to have data fields in
them be EXPORTed and referenced from other programs. What is interesting, to me,
is that all references to a DLL in an LE enclave refer to the same copy. So any
data which is EXPORTed is, in effect, "global" to the LE enclave. This seems a
reason way to share data. What say ye?

--
John McKown
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)


Yes, well we cover writing and using DLLs written in Assembler
in our course "Creating and Using DLLs in z/OS"; the course
is multi-lingual in that it discusses creating and invoking
DLLs with C, PL/I, COBOL, and Assembler.

See http://www.trainersfriend.com/Language_Environment_courses/m525descr.htm
for details.

But it seems to be a non-starter: no one has ever requested
that we teach it. Judging by that, I would say there is not
much interest. But, there may be pockets of usage out there.


Note that you can load a module from the HFS using the
BPX1LOD callable service, which may be a simpler solution
to the problem you are describing.

As for invoking a DLL from Assembler, here's some snippets from
code in that course:

LOAD   alias c'dllload'
QUERYF alias c'dllqueryfn'
QUERYV alias c'dllqueryvar
.
.
.

* Load DLL load module CDLL12
*
CALL LOAD,(DLL_NAME),MF=(E,GENCALL)
.
.
.
* Locate DLL function CDSUB4; if successful, call the function
*
        l     2,dll_tok
        CALL  QUERYF,((2),F2_NAME),MF=(E,GENCALL)
        st    15,f2_ptr
        c     15,f0
        be    outa_here
        CALL  (15),(STRING),MF=(E,GENCALL)
.
.
.
* Locate DLL variable data_area; if successful, change it
        l    2,dll_tok
        CALL QUERYV,((2),VAR_NAME),MF=(E,GENCALL)
        st   15,v_ptr
        c    15,f0
        be   outa_here
        mvc  0(l'new_str+1,15),new_str - change value
.
.
.
GENCALL  CALL ,(,,,),MF=L

dll_tok  ds   f

dll_name dc   c'CDLL12'
         dc   x'00'

f2_name  dc   c'CDSUB4'
         dc   x'00'

var_name dc   c'data_area'
         dc   x'00'

string   dc   c'Data from me'
         dc   x'00'

new_str  dc   c'funny little string'
         dc   x'00'


--

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

Reply via email to