Chuck, this is a quick and dirty conversion of the COBOL snippet to Easytrieve. I did not test actual I/O, but I do see the dynamic allocation in the JES messages and RC 0 is returned from BPXWDYN. This was tested with Easytrieve 11.6.

DEFINE BPXWDYN              W   8 A VALUE 'BPXWDYN '.
DEFINE BPXWDYN-RETCODE      W   4 B.

DEFINE ALLOC-STRING      W                 159 A.
DEFINE A1                ALLOC-STRING       15 A.
DEFINE A2                ALLOC-STRING +15   13 A.
DEFINE ALLOC-DSN         ALLOC-STRING +28   45 A.
DEFINE ALLOC-DSN-PAD     ALLOC-STRING +73    1 A.
DEFINE A5                ALLOC-STRING +74   23 A.
DEFINE A6                ALLOC-STRING +97   27 A.
DEFINE A7                ALLOC-STRING +124  34 A.
DEFINE ALLOC-TERM        ALLOC-STRING +158   1 A.

JOB INPUT (NULL)

 MOVE SPACES                               TO ALLOC-STRING.
 MOVE 'ALLOC MSG(WTP) '                    TO A1.
 MOVE 'DD(OUT1) DSN('                      TO A2.
 MOVE 'A.TEST.DSN)'                        TO ALLOC-DSN.
 MOVE 'NEW DELETE UNIT(SYSDA) '            TO A5.
 MOVE 'CYL SPACE(01,01) DSORG(PS) '        TO A6.
 MOVE 'RECFM(FB) LRECL(80) BLKSIZE(27920)' TO A7.
 MOVE LOW-VALUES                           TO ALLOC-TERM.

 CALL BPXWDYN USING (ALLOC-STRING)        +
              RETURNS BPXWDYN-RETCODE.

 IF BPXWDYN-RETCODE = 0
 ELSE
     DISPLAY 'ERROR BPX RC= ' BPXWDYN-RETCODE
 END-IF.

STOP.

Alan

Hardee, Chuck wrote:
Thanks Alan, but what you have indicated won't work for me in CA-Easytrieve.
The biggest problem is that to use null or space terminated strings as 
parameters, I have to be able to call BPXWDYN with R0 = 0 and Easytrieve 
doesn't provide a method of setting R0 to zero.

A wrapper is going to be needed.


Charles (Chuck) Hardee
Senior Systems Engineer/Database Administration
EAS Information Technology

Thermo Fisher Scientific
300 Industry Drive | Pittsburgh, PA 15275
Phone +1 (724) 517-2633 | Mobile +1 (412) 877-2809 | FAX: +1 (412) 490-9230
chuck.har...@thermofisher.com  | www.thermofisher.com

WORLDWIDE CONFIDENTIALITY NOTE: Dissemination, distribution or copying of this 
e-mail or the information herein by anyone other than the intended recipient, 
or an employee or agent of a system responsible for delivering the message to 
the intended recipient, is prohibited. If you are not the intended recipient, 
please inform the sender and delete all copies.


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Alan Young
Sent: Tuesday, January 31, 2017 1:11 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Calling bpxwdyn from CA-Easytrieve

I have called it for many years from COBOL using the C string parameter format (NULL terminated parameter string in the doc). No wrappers needed. Here's a short snippet:

 WORKING-STORAGE SECTION.

 01  WORKAREA.

     05  BPXWDYN                     PIC  X(08) VALUE 'BPXWDYN'.

     05  WS-BPXWDYN-RETCODE          PIC  9(08) COMP SYNC.

     05  WS-OUT1-ALLOC-STRING.
         10                          PIC  X(15) VALUE
           'ALLOC MSG(WTP) '.

         10                          PIC  X(14) VALUE
           'DD(OUT1) DSN('''.

         10  WS-OUT1-DSN             PIC  X(45).

         10                          PIC  X(01) VALUE SPACE.

         10                          PIC  X(23) VALUE
           'NEW DELETE UNIT(SYSDA) '.

         10                          PIC  X(27) VALUE
           'CYL SPACE(01,01) DSORG(PS) '.

         10                          PIC  X(34) VALUE
           'RECFM(FB) LRECL(80) BLKSIZE(27920)'.

*** TERMINATE COMMAND STRING
*** COULD SET THE LAST PARM AS A Z STRING
         10                          PIC  X(01) VALUE LOW-VALUE.


 PROCEDURE DIVISION.

     STRING 'A.DYNAMIC.DSNAME'
            ''')' DELIMITED BY SPACE
     INTO WS-OUT1-DSN.

     CALL BPXWDYN USING WS-OUT1-ALLOC-STRING
                  RETURNING WS-BPXWDYN-RETCODE.

     IF WS-BPXWDYN-RETCODE EQUAL ZERO
        OPEN OUTPUT OUT-FILE

        MOVE 'THIS IS SOME DATA !!!!' TO OUT-REC
        WRITE OUT-REC

        CLOSE OUT-FILE
     ELSE
        DISPLAY 'ERROR BPX RC=' WS-BPXWDYN-RETCODE
     END-IF.

     GOBACK.

Alan

Farley, Peter x23353 wrote:
I don't know in which language CA Easytrieve is coded, but a few years back I 
tried setting up calls to BPXWDYN in Enterprise COBOL (V4.1 at the time) and 
they did not work because COBOL does not zero R0 as BPXWDYN requires.  I had to 
code an assembler stub routine to put between the COBOL program and BPXWDYN to 
get it to work.  For simplicity the stub was non-reentrant to be able use the 
LOAD macro to find a copy of BPXWDYN and save the entry point address for later 
use.

Email me privately if you want a copy of the stub routine.  It wasn't hard to 
code, 40 actual code lines and 7 lines of comments.

Peter

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Hardee, Chuck
Sent: Tuesday, January 31, 2017 7:41 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Calling bpxwdyn from CA-Easytrieve

I have a need to be able to call bpxwdyn from within an CA-Easytrieve "program".

According to the manual, IBM says that bpxwdyn can be called from non-REXX 
environments as long as certain rules are followed.
It also states that values can be returned as long as the return value 
parameter follows the following format:

PARMx DC          Y(L'PARMxVAL+1)
PARMxVAL         DC          C'parameter value '
(Notice the very important space at the end of the value string!)
The manual states that the length must be 1 greater than the maximum length 
possible for the returned attribute. Since a dataset name can only be 44 bytes, 
the length value should be fine.

My need it to call bpxwdyn and have it return to me the dataset name associated 
with a specific DD name.

I have built the "command" string as follows:

bpxwdyn-command       DC          Y(L'bpxwdyn-info)
bpxwdyn-info                   DC          C'INFO FI(MYDDN) '

I have built the information return parameter as follows:
bpxwdyn-dsname-p       DC          Y(102)
bpxwdyn-dsname           DC          CL100'INRTDSN '

The call in Easytrieve is CALL BPXWDYN USING (bpxwdyn-command, bpxwdyn-dsname-p)
What's happening is that I getting a return code of 20, invalid parameter.
What I don't get is whether it is with my command string or my returned value 
strings.

The manual states that on a call from a non-REXX environment, R0 must be zero.

According to the Easytrieve manual, the CALL verb generates an MVS convention 
calling list. So, based on that I can only assume that the last address in the 
parameter list has it's high order bit on. Also, have written several routines 
which trigger off of the number of parameters with the number of parameters 
signaled by the high order but of the last one being on, and having called 
these routines successfully in Easytrieve, I suspect my assumption is correct.

What I don't know is whether Easytrieve sets R0 to zero for the call. If it 
doesn't, that could account for the return code of 20.

So, my question is, has anyone ever called bpxwdyn from within an Easytrieve 
program?

Thanks,
Chuck


Charles (Chuck) Hardee<mailto:chuck.har...@thermofisher.com>
Senior Systems Engineer/Database Administration
EAS Information Technology<mailto:DBA%20Engineering%20-%20DB2_IDMS>

Thermo Fisher Scientific
300 Industry Drive | Pittsburgh, PA 15275
Phone +1 (724) 517-2633 | Mobile +1 (412) 877-2809 | FAX: +1 (412) 490-9230
chuck.har...@thermofisher.com<mailto:chuck.har...@thermofisher.com>  | 
www.thermofisher.com

WORLDWIDE CONFIDENTIALITY NOTE: Dissemination, distribution or copying of this 
e-mail or the information herein by anyone other than the intended recipient, 
or an employee or agent of a system responsible for delivering the message to 
the intended recipient, is prohibited. If you are not the intended recipient, 
please inform the sender and delete all copies.

----------------------------------------------------------------------
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