Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

You CAN dynamically allocate files in IRXJCL

410 views
Skip to first unread message

Thomas Conley

unread,
Mar 12, 2002, 3:27:24 AM3/12/02
to
For those of you who could not attend SHARE, Bob Shannon had this little
nugget at the Bit Bucket Friday morning. There is a callable service that
will dynamically allocate files from a REXX exec. While it can be used from
anywhere, it's probably most useful from IRXJCL. We seemed to have a thread
about that not too long ago and we all said you had to run under IKJEFT01.
But here's how you do it in IRXJCL.

call bpxwdyn(address tso-style alloc statement)

This callable service is part of the USS callable services package. It's
not well documented, but Bob tried it and it works well. I just ran some
tests with IRXJCL and it works like a champ. Here's an example:

allocstr = "ALLOC FI(PARMLIB) DA('SYS1.PARMLIB') SHR"
call bpxwdyn(allocstr)
allocstr = "FREE FI(PARMLIB)"
call bpxwdyn(allocstr)

Simple and straightforward. Bob found two quirks with the TSO ALLOC syntax.
ALLOC F(file) does not work, you need a minimum of ALLOC FI(file). Also,
CATLG does not work, you must spell out CATALOG, so be on the lookout for
other variations. Good luck.

Regards,
Tom Conley

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX

Charles Merrythought

unread,
Mar 12, 2002, 11:47:59 AM3/12/02
to
Thomas Conley <pinn...@FRONTIERNET.NET> wrote:
> There is a callable service that will dynamically allocate files from a > REXX exec...

It has been around a while (OS/290 2.7 IIRC) and can be called from assembler, C, COBOL and PL/I as well. As you said, neat, simple and effective.
--


__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

Robert Zenuk

unread,
Mar 12, 2002, 1:30:12 PM3/12/02
to
BPXWDYN has actually been around for quite a while. Its "traditional" use is
on the OMVS side to allocate files on the MVS side for processing on the OMVS
side without moving files from MVS datasets to HFS files. It is real close
but not identical to ALLOCATE, so it is worthwhile to check your syntax prior
to assuming it is the same as ALLOCATE. I have to admit, I never tried
running it native on the MVS side. I find that if I need to allocate files
(that can't be put in the JCL), I am usually using LISTDSI and/or SYSDSN for
other various checks and balances. At the risk of starting a religious war,
these days it is debatable whether the performance impact of using IRXJCL
over IKJEFT01 is worth the effort...

Three common uses for BPXWDYN are:

1) Allocating MVS datasets under OMVS to read data in programs running on the
OMVS side
2) Allocating files under OMVS to run MVS programs from the OMVS side
3) Allocating SYSOUT INTRDR files to submit jobs from the OMVS side

The link to the BPXWDYN documentation can be found at:

http://www-1.ibm.com/servers/eserver/zseries/zos/unix/bpxa1ty2.html

The direct link is:

ftp://ftp.software.ibm.com/s390/zos/tools/bpxwdyn/bpxwdyn.html

Examples of the above approaches are illustrated in the following REXX EXECs
designed to run on the OMVS side.

Example 1. Allocate all required files and run IEBGENER while running under
OMVS

/* REXX */
/* Purpose: Run a GENER through the USS wall */
/*-------------------------------------------------------------------*/
/* Syntax: gener sysut1 sysut2 */
/*-------------------------------------------------------------------*/
/* Parms: sysut1 - input */
/* sysut2 - output */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Jan 2001 Initial Creation */
/* */
/*********************************************************************/
/* Accept input and output */
/*********************************************************************/
arg sysut1 sysut2
/*********************************************************************/
/* Allocate SYSUT1 */
/*********************************************************************/
exitrc = bpxwdyn("alloc fi(sysut1) da('"sysut1"') shr")
if exitrc <> 0 then say 'Allocate error on SYSUT1 RC='exitrc
/*********************************************************************/
/* Allocate SYSUT2 */
/*********************************************************************/
exitrc = bpxwdyn("alloc fi(sysut2) da('"sysut2"') shr")
if exitrc <> 0 then say 'Allocate error on SYSUT2 RC='exitrc
/*********************************************************************/
/* Allocate SYSPRINT */
/*********************************************************************/
exitrc = bpxwdyn("alloc dd(sysprint) sysout(a)")
if exitrc <> 0 then say 'Allocate error on SYSPRINT RC='exitrc
/*********************************************************************/
/* Allocate SYSIN */
/*********************************************************************/
exitrc = bpxwdyn("alloc dd(sysin) dummy")
if exitrc <> 0 then say 'Allocate error on SYSIN RC='exitrc
/*********************************************************************/
/* Invoke IEBGENER */
/*********************************************************************/
parms = ''
address linkmvs 'IEBGENER' 'PARMS'
exitrc = rc
if exitrc <> 0 then say 'IEBGENER error RC='exitrc
/*********************************************************************/

/* Free All DD's */
/*********************************************************************/
exitrc = bpxwdyn("free dd(sysut1)")
if exitrc <> 0 then say "FREE error on SYSUT1 DD RC="exitrc
exitrc = bpxwdyn("free dd(sysut2)")
if exitrc <> 0 then say "FREE error on SYSUT2 DD RC="exitrc
exitrc = bpxwdyn("free dd(sysprint)")
if exitrc <> 0 then say "FREE error on SYSPRINT DD RC="exitrc
exitrc = bpxwdyn("free dd(sysin)")
if exitrc <> 0 then say "FREE error on SYSIN DD RC="exitrc
/*********************************************************************/
/* Shutdown */
/*********************************************************************/
shutdown: exit(exitrc)

Example 2. Shows allocating an Internal Reader DD and a JCL PDS to submit a
job from the OMVS side

/* REXX */
/* Purpose: Submit JCL in an existing PDS from the USS side */
/*-------------------------------------------------------------------*/
/* Syntax: sub dsn mem */
/*-------------------------------------------------------------------*/
/* Parms: dsn - PDS that hold the JCL member */
/* mem - Member in the PDS that holds the JCL */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Mar 2001 Initial Creation */
/* */
/*********************************************************************/
/* Accept DSN and MEM */
/*********************************************************************/
arg dsn mem
/*********************************************************************/
/* Format the DSN(MEM) */
/*********************************************************************/
jcl = dsn'('mem')'
/*********************************************************************/
/* Allocate the PDS */
/*********************************************************************/
exitrc = bpxwdyn("alloc fi(jclpds) da('"jcl"') shr")
if exitrc <> 0 then say 'Allocate error on JCLPDS' jcl 'RC='exitrc
/*********************************************************************/
/* Allocate a INTRDR DD */
/*********************************************************************/
exitrc = bpxwdyn("alloc dd(sub) sysout writer(intrdr)")
if exitrc <> 0 then say 'Allocate error on INTRDR RC='exitrc
/*********************************************************************/
/* Read the JCL into a stem */
/*********************************************************************/
address mvs "execio * diskr jclpds (fini stem jcl."
exitrc = rc
if exitrc <> 0 then say 'EXECIO error on JCLPDS RC='exitrc
/*********************************************************************/
/* Write the stem to the INTRDR DD */
/*********************************************************************/
address mvs "execio * diskw sub (fini stem jcl."
exitrc = rc
if exitrc <> 0 then say 'EXECIO error on INTRDR RC='exitrc
/*********************************************************************/
/* Free both DD's */
/*********************************************************************/
exitrc = bpxwdyn("free dd(jclpds)")
if exitrc <> 0 then say 'FREE error on JCLPDS' jcl 'RC='exitrc
exitrc = bpxwdyn("free dd(sub)")
if exitrc <> 0 then say 'FREE error on INTRDR' jcl 'RC='exitrc
/*********************************************************************/
/* Shutdown */
/*********************************************************************/
shutdown: exit(exitrc)

Example 3. Create your own JCL in a stem variable on OMVS and Submit through
an INTRDR

/* REXX */
/* Purpose: Submit JCL created in a stem variable */
/*-------------------------------------------------------------------*/
/* Syntax: jclsub */
/*-------------------------------------------------------------------*/
/* Parms: N/A - N/A */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Jun 2001 Initial Creation */
/* */
/*********************************************************************/
/* Create JCL records */
/*********************************************************************/
jcl.0 = 2
jcl.1 = '//TESTJOB JOB (0000),TESTJOB,CLASS=A,MSGCLASS=X'
jcl.2 = '// EXEC PGM=IEFBR14'
/*********************************************************************/
/* Allocate a INTRDR DD */
/*********************************************************************/
exitrc = bpxwdyn("alloc dd(sub) sysout writer(intrdr)")
if exitrc <> 0 then say 'Allocate error on INTRDR RC='exitrc
/*********************************************************************/
/* Write the stem to the INTRDR DD */
/*********************************************************************/
address mvs "execio * diskw sub (fini stem jcl."
exitrc = rc
if exitrc <> 0 then say 'EXECIO error on INTRDR RC='exitrc
exitrc = bpxwdyn("free dd(sub)")
if exitrc <> 0 then say 'FREE error on INTRDR' jcl 'RC='exitrc
/*********************************************************************/
/* Shutdown */
/*********************************************************************/
shutdown: exit(exitrc)

The last example could be modified to read JCL from an HFS file, but I
haven't found a need to develop a generic example for that. Usually I try to
run everything possible from the MVS side. Only in a few examples do I need
to "reach back" using a technique like this. When I do, it seems easier to
maintain JCL in a PDS or generate it in a stem rather than store it in an HFS
file. Just personal preference, I guess...

Hope This Helps,
Robert Zenuk
robz...@aol.com

Shannon, Bob

unread,
Mar 13, 2002, 7:13:25 AM3/13/02
to
Charles Merrythought wrote:

>It has been around a while (OS/290 2.7 IIRC) and can be called from
>assembler, C, COBOL and PL/I as well. As you said, neat, simple and
>effective.

Actually, I became aware of the service from one of your posting on
the assembler list. You were credited in the Bit Bucket under "Contibuters,
willingly or unwillingly, knowingly or unknowingly".

Bob Shannon

0 new messages