@Peter, I have given this some serious thought. Thanks for the interesting
problem!

I believe you should eschew the clever "assembler in working storage"
approach. If the UUID4 approach works for you, then of course, by all means
use it.

If not, then you should go with a conventional external callable assembler
routine. Here is my logic.

I hear you on the assembler maintenance issues. I think the external
assembler is very unlikely to fail or require maintenance, but if it does,
the task is straightforward. If there is no talent at your shop that can do
it, then certainly they can find a contractor to do it. There is no complex
business logic embedded in the assembler. It will be a simple problem.

OTOH if you go with the working storage approach, I think there is a decent
likelihood of failure sometime in the future. Perhaps they change the COBOL
compiler, as I suggested. Perhaps IBM changes the "executability" of working
storage, as @Peter suggested. If that happens then your organization has a
complex and difficult problem. If it is an exception on non-executable
storage LE is likely to be totally boggled by the error. Your shop will have
a complex problem that someone with knowledge of the hardware, knowledge of
COBOL, and then ultimately decent assembler skills, is going to have to sort
out. That is going to be tricky. Some future programmer may be cursing your
memory.

That is why I think you should eschew your working storage technique, as
clever and as fascinating as it is, and go with either UUID4 or a
conventional call to assembler.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
Behalf Of Farley, Peter x23353
Sent: Wednesday, March 17, 2021 8:50 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: This Call-Assembler-inside-COBOL technique works, but is it risky
to use?

I discovered that one can code and call extremely simple assembler code from
completely within a COBOL source program, but it is a two-step process which
I will describe below.

My question is whether using a technique like this is "risky" in the sense
that it may someday, under a future incarnation of the compiler, stop
working?

The technique:

Code a simple assembler program like the following and browse the resulting
listing that shows the generated object code:

COBSTCKE CSECT ,
         L     15,0(,1)  GET ARGUMENT ADDRESS
         STCKE 0(15)     STCKE INTO ARGUMENT AREA
         XR    15,15     SET RETURN CODE = 0
         BR    14        RETURN TO CALLER

Then copy the generated object code into a COBOL source program as follows:

       ID DIVISION.
       PROGRAM-ID. COBSTCKE.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  WS-TOD-VALUE              PIC  X(16).

       01  WS-GETTOD-PROGRAM.
      *                 GET ARGUMENT ADDRESS         L  15,0(,1)
           05  FILLER       PIC  X(04) VALUE X'58F01000'.
      *                 STCKE INTO ARGUMENT AREA     STCKE 0(15)
           05  FILLER       PIC  X(04) VALUE X'B278F000'.
      *                 SET RETURN-CODE = 0          XR 15,15
           05  FILLER       PIC  X(02) VALUE X'17FF'.
      *                 RETURN TO CALLER             BR 14
           05  FILLER       PIC  X(02) VALUE X'07FE'.

       01  WS-GETTOD-PTR.
           05  GETTOD-ADDR            PROCEDURE-POINTER VALUE NULL.
           05  FILLER                 REDEFINES GETTOD-ADDR.
               10  GETTOD-ADDR1       POINTER.
               10  GETTOD-ADDR2       POINTER.

       PROCEDURE DIVISION.

           SET GETTOD-ADDR1 TO ADDRESS OF WS-GETTOD-PROGRAM.
           CALL GETTOD-ADDR USING WS-TOD-VALUE.
           DISPLAY FUNCTION HEX-OF (WS-TOD-VALUE).
           GOBACK.

Peter

This message and any attachments are intended only for the use of the
addressee and may contain information that is privileged and confidential.
If the reader of the message is not the intended recipient or an authorized
representative of the intended recipient, you are hereby notified that any
dissemination of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by e-mail
and delete the message and any attachments from your system.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to