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