Admittedly, I wrote it while not on the mainframe last night. I went
back and checked my JCL. I have successfully used it with the BPXBATCH
PGM parm. You are correct the SH parm does not work. The shell may be
forking or doing something else. Your example does work on zOS 2.1 with
a PARM='PGM /bin/cp //DD:MYDD /dev/fd1'
Kirk Wolf wrote:
Have you tried your suggestion Alan? (it doesn't work)
//BPXBATCH JOB (),'WOLF',MSGCLASS=H,NOTIFY=&SYSUID,REGION=32M
//*
//SHELL EXEC PGM=BPXBATCH,PARM='SH cp //DD:MYDD /dev/fd1'
//STDENV DD *
_BPX_BATCH_SPAWN=YES
_BPX_SHAREAS=YES
//STDIN DD DUMMY
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//MYDD DD DISP=SHR,DSN=SYS1.MACLIB(ACB)
//
cp: FSUM6258 cannot open file "//DD:MYDD": EDC5037I The specified ddname
was not found.
You can use BPXBATSL, but you can't run a login shell with it unless you
are root. So you don't get the system or your login profile run.
But if you can live with that, then this works:
//BPXBATSL JOB (),'WOLF',MSGCLASS=H,NOTIFY=&SYSUID,REGION=32M
//*
//SHELL EXEC PGM=BPXBATSL,PARM='PGM /bin/cp //DD:MYDD /dev/fd1'
//STDENV DD *
_BPX_BATCH_SPAWN=YES
_BPX_SHAREAS=YES
//STDIN DD DUMMY
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//MYDD DD DISP=SHR,DSN=SYS1.MACLIB(ACB)
//
Years ago, the mvs-oe forum was about 75% BPXBATCH issues; you might want
to check the archives.
You might want to try COZBATCH, which is a little utility that was designed
to work like a reasonable person would expect:
https://dovetail.com/products/cozbatch.html
Kirk Wolf
Dovetailed Technologies
http://dovetail.com
On Thu, Oct 12, 2017 at 8:19 PM, Alan Young <[email protected]> wrote:
Try changing the STDENV DD to
//STDENV DD *
_BPX_BATCH_SPAWN=YES
_BPX_SHAREAS=YES
/*
The variables are discussed in https://www.ibm.com/support/
knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxa400/bpxug240.htm
-----Original Message-----
From: Frank Swarbrick <[email protected]>
Sent: Oct 12, 2017 5:17 PM
To: [email protected]
Subject: fopen DD
I am playing with the Swift for z/OS beta. Swift itself supports little
in the way of I/O, and instead depends on the underlying C runtime. Below
is a small program that opens a file, reads 4 bytes in to a buffer and
writes out the results as an integer.
import Libc
func fwx(file filename: String, access: String) {
if let fwf = fopen(filename, access) {
defer { fclose(fwf) }
let buffer = UnsafeMutablePointer<UInt32>.allocate(capacity: 1)
defer { buffer.deallocate(capacity: 1) }
let _ = fread(buffer, MemoryLayout<UInt32>.size, 1, fwf)
print("from \(filename): \(buffer.pointee)")
}
else {
print("error opening file \(filename): \(errno)")
}
}
fwx(file: "/u/dvfjs/fw.bin", access: "rb")
fwx(file: "//'DVFJS.FW'", access: "rb")
fwx(file: "dd:FW", access: "rb")
The last three statements are the "mainline" of the program. For the
first one the file is a Unix file. For the second one its a VSAM ESDS
called 'DVFJS.FW'. Both of these work. I can't figure out how to specify
a DD reference to make that last one work. I've tried both using "dd:FW"
and "//dd:FW". Is it perhaps a problem with the DD itself? When running
it under BPXBATCH I am specifying the FW DD like I would for any other
batch job:
//SHELL JOB NOTIFY=&SYSUID,REGION=2000M
//UNIXSH EXEC PGM=BPXBATCH,PARMDD=PARMSIN
//FW DD DISP=SHR,DSN=DVFJS.FW
//PARMSIN DD *
SH /u/dvfjs/src/fw
/*
//STDIN DD DUMMY
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDENV DD DUMMY
//
Does the Unix environment for BPXBATCH not have access to the JCL DD?
We don't have a license for the C compiler, so I've never used C for z/OS.
Frank
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN