Running Python as a started task on z/OS

Setting this up was relatively easy. I used JCL

// PROC P=’cons’
// SET PY=’/usr/lpp/IBM/cyp/v3r8/pyz/bin/python3′
// SET PR=’/u/tmp/console’
//*
//STEP1 EXEC PGM=BPXBATSL,REGION=0M,TIME=NOLIMIT,MEMLIMIT=NOLIMIT,
// PARM=’PGM &PY &PR/&P..py’
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//CEEDUMP DD SYSOUT=*
//STDIN DD DUMMY

As part of this work, I also developed zconsole which allows a program to get the parameters on the start command, any modify command (and the data), and the stop command.

I tried using print to //SYSOUT2, but was unsuccessful. I could write to a Unix file, but not to a “DD:…” statement.

Following on from a suggestion from Peter Sylvester I used AOPBATCH, and got that working as well.

// SET PY=’/usr/lpp/IBM/cyp/v3r8/pyz/bin/python3′
//*
//AOP EXEC PGM=AOPBATCH,PARM=’/&PY. //DD:STDIN P1 P2′
//STDIN DD PATH=’/u/tmp/zos/z.py’
//STDENV DD *
PATH=/usr/lpp/IBM/cyp/v3r8/pyz/bin:/u/tmp/zos
LIBPATH=/u/tmp/zos
PYTHONPATH=/u/tmp/zos
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDOUT DD SYSOUT=*
//…

This read from the Unix file in STDIN.

The parameters passed to the Python script are P1 P2

One thought on “Running Python as a started task on z/OS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s