Last year I asked how you can call zEDC functions from a high-level language
other than C. The point was that the Callable Service for High Level Language
manual says you can use it from COBOL, but there's no information how to do it.
Peter Farley posted that IBM provides a sample of a COBOL program calling zEDC
in the COBOL Programmers Guide.
That's true, and it is helpful, but before someone else spends a lot of time
trying to figure out exactly how the sample program works, let me give an
easier way.
The sample program is demonstrating a series of zlib functions:
- defaultInit2 (a more complicated version of the deflateInit function)
- deflate
- deflateEnd
- inflateInit2 (a more complicated version of inflateInit)
- inflateEnd
Fundamentally zlib is built to support streaming compression or decompression,
i.e. where you are not providing your entire input at once. So even if you DO
have all of your input at once, you're still defining a stream structure,
calling all these functions, handling the various buffer errors, and so on.
None of this is necessary.
All you need to do to use zEDC to compress from COBOL is:
call 'compress' using output-area
output-length
input-area
by value input-length
returning rc
where the lengths and rc are binary fullwords (pic s9(9) binary). You set
output-length to the size of the output-area before the call, after the
compress it is the size of the compressed data.
Uncompressing is the same, except you call 'uncompress' instead of 'compress'.
These functions are documented in the zlib manual Utility Functions:
https://zlib.net/manual.html
The utility functions are doing all the work for you, using the default options
you'd probably pick if you were doing it the hard way.
-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of
Schmitt, Michael
Sent: Wednesday, April 26, 2023 1:04 PM
To: [email protected]
Subject: Re: How to call zEDC functions from an HLL other than C [was: RE:
Unzip on z/OS ?]
Thanks.
That seems like an odd place to put it. What's next, a chapter on how to call
the Binder Fast Data API from COBOL?
I'd think this chapter should be in the Callable Services for High Level
Languages manual.
-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of
Farley, Peter
Sent: Wednesday, April 26, 2023 10:43 AM
To: [email protected]
Subject: Re: How to call zEDC functions from an HLL other than C [was: RE:
Unzip on z/OS ?]
An off-list communication from another interested party pointed me to this link
to the online Enterprise COBOL Programmers Guide V6.4, which has exactly the
documentation I have been requesting, at least for COBOL programmers:
Chapter 36. Using zlib compression from a COBOL program
https://urldefense.com/v3/__https://www.ibm.com/docs/en/cobol-zos/6.4?topic=processing-using-zlib-compression-from-cobol-program__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!PH7R6DqoJ4s46c2nl6ioiOH78zLOJ4b4RxXOpf7vArg5zC6Vhcau-QWdkO2kmNijOrUoC0S9_ZmGwWmvlwR4_cJxh92ULmY$
I checked my previously saved COBOL PDF's for V6.2 and it is there as well.
Interestingly the latest PL/I Programmers Guide (V6.1) has no reference to zlib
at all, and the last published VS Fortran documents (all of which are dated
1993) of course have no references to it.
I will be updating my RCF to ask that the MVS manual at least reference the
COBOL Programmer's Guide and chapter title as an example of non-C-language
access to these functions. I'm certain that any competent PL/I or Fortran
programmer could figure out what to do in their language from the COBOL example.
Peter
-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of
Farley, Peter
Sent: Tuesday, April 25, 2023 5:11 PM
To: [email protected]
Subject: Re: How to call zEDC functions from an HLL other than C [was: RE:
Unzip on z/OS ?]
To be more clear: I am asking for examples of non-C-language un-authorized HLL
calls to the "zlib" un-authorized functions and a list of any COPY/INCLUDE
members necessary to accomplish those calls, not the zEDC authorized functions
nor the hardware-level DFLTCC instruction.
Peter
-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of
Farley, Peter
Sent: Tuesday, April 25, 2023 11:53 AM
To: [email protected]
Subject: How to call zEDC functions from an HLL other than C [was: RE: Unzip on
z/OS ?]
I submitted an RCF on the subject of examples for actually using zEDC functions
from HLL's other than C not long after this message chain and received no
response at all from the RCF team. A follow-up email requesting status or at
least an acknowledgement that the documentation addition suggestion had been
received did get a response, which was:
"Thank you for reaching out to IBM about your experience with our Documentation
feedback.
A response is not provided for feedback sent to your product's documentation
team. All comments are received and evaluated to help improve the content
experience. Any resulting updates to the product documentation are then
reflected in the current release of the product. Any issues that require a
response should go through IBM support."
Since neither the zEDC redbook to which Tom Harper posted a link nor the MVS
Callable Services for HLL's manual have any examples of how to ACTUALLY use
zEDC functions from any HLL except C, has anyone on this list actually coded
invocation of zEDC services from an HLL other than C who is willing (and is
permitted) to share how they accomplished that task?
Since IBM hasn't documented it (at least not so far) I guess we have to do it
ourselves.
Peter
-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of
Farley, Peter
Sent: Tuesday, April 4, 2023 2:17 PM
To: [email protected]
Subject: Re: Unzip on z/OS ?
You are probably right about that. I will start one and see what they reply.
Peter
-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of
Steve Thompson
Sent: Tuesday, April 4, 2023 2:07 PM
To: [email protected]
Subject: Re: Unzip on z/OS ?
A similar issue happened with BPXWDYN. COBOL can't set R0. So a new entry point
in BPXWDYN was created that handled that problem.
This all started with me writing an RCF to tell them that they didn't have a
COBOL example. Then a C programmer (I'm guessing) wrote the COBOL code. You can
write c in any language (one of those type of things). Problem is, it would
confuse most COBOL programmers that, well, it would confuse most COBOL
programmers, and so I suggested a few changes to solve the issue. Then one of
their own people onfirmed what I said, it would be confusing to most COBOL
programmers. And so it appears that IBM doesn't have many product developers
that actually know COBOL..... That has been my take-away from that exchange.
So you may need to do an RCF, and you may go a few rounds with them.
Just say'n'.
Steve Thompson
On 4/4/2023 1:46 PM, Farley, Peter wrote:
> The V2R5 Callable Services manual SA23-1377-50 pp 191-196 describes ONLY the
> C language zlib library and functions. There is no material on how to use
> those functions from any other language than C.
>
> At the very least there is no mention of COBOL COPY members for the parameter
> definitions nor any mention of a COBOL-compatible link library for inclusion
> in an executable module. Only the POSIX C link library and functions are
> described.
>
> Am I missing something? Like maybe the zlib C functions are compiled with
> "#pragma linkage(entryname,OS)"? There is no such statement in that manual
> at all.
>
> -----Original Message-----
> From: IBM Mainframe Discussion List <[email protected]> On
> Behalf Of Ed Jaffe
> Sent: Tuesday, April 4, 2023 1:30 PM
> To: [email protected]
> Subject: Re: Unzip on z/OS ?
>
> On 4/4/2023 10:22 AM, Farley, Peter wrote:
>> I agree with Michael, neither that redbook nor the current (V2R5) z/OS
>> Callable Services manual even mention COBOL or any other HLL interface or
>> API. Only the C language zlib library and functions are described.
> Tom provided the link to the book and on page 128 it states that the
> callable services "... are for use by any program coded in C, COBOL,
> Fortran, Pascal, or PL/I, and this information refers to programs
> written in these languages as high-level language (HLL) programs."
--
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN