Trouble with //DD:

Discussion of the COZBATCH utility for z/OS
Post Reply
BobC
Posts: 10
Joined: Fri Mar 04, 2011 9:57 am

Trouble with //DD:

Post by BobC »

Maybe you can Help with this... This works:
//BCOHSFTP JOB FTN,'COHO',MSGCLASS=X,CLASS=A,REGION=0M
//JOBLIB DD DISP=SHR,DSN=COZ.LOADLIB
//*
//RUNSFTP EXEC PGM=COZBATCH
//STDIN DD *
cozsftp root@bufw116t <<EOB
lzopts mode=text,linerule=crlf
put //'PROD.TEMP.BCOHSMFD.STEP0060.SORTOUT' smftest.txt
EOB
//SYSOUT DD SYSOUT=*
but this doesn't???
//BCOHSFTP JOB FTN,'COHO',MSGCLASS=X,CLASS=A,REGION=0M
//JOBLIB DD DISP=SHR,DSN=COZ.LOADLIB
//*
//RUNSFTP EXEC PGM=COZBATCH
//STDIN DD *
cozsftp root@bufw116t <<EOB
lzopts mode=text,linerule=crlf
put //DD:DWNLOAD smftest.txt
EOB
//SYSOUT DD SYSOUT=*
//DWNLOAD DD DISP=SHR,DSN=PROD.TEMP.BCOHSMFD.STEP0060.SORTOUT

ZosDataset.I.: Opening dataset DD:DWNLOAD for read
DatasetHandler.E.: Error in fopen(//DD:DWNLOAD, rb,type=record,noseek,recfm=*) - EDC5037I The specified ddname was not
found. (errno2=0xC00B05B1)
.10.122. Couldn't open local file "//DD:DWNLOAD" for reading: EDC5037I The specified ddname was not found.
(errno2=0xC00B05B1)
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

The only reason that I can think that this would fail (using DD:) is that for some reason the "cozsftp" command was being run in a separate z/OS address space.

One reason that this might occur would be that the user's .profile or the /etc/profile has set _BPX_SHARAS=NO.

Try adding this to the beginning of your shell script;

//STDIN DD *
env
export _BPX_SHAREAS=YES
...

and see if that is true (and if it works now)
BobC
Posts: 10
Joined: Fri Mar 04, 2011 9:57 am

Post by BobC »

dovetail wrote: //STDIN DD *
env
export _BPX_SHAREAS=YES
...

and see if that is true (and if it works now)
This MAY be because the user is using bash instead of sh for a shell.
I modified a shell script to issue a set here are the results:

Code: Select all

CoZBatch[N]: Copyright (C) 2005-2009 Dovetailed Technologies LLC. All rights reserved.
CoZBatch[N]: version 1.8.0 2011-02-03
CoZBatch[I]: executing progname=login-shell="-/bin/bash"
_=/usr/local/bin/cozsetup
_BPX_SHAREAS=YES
_BPX_SPAWN_SCRIPT=YES
_BPXK_JOBLOG=STDERR
_EDC_ADD_ERRNO2=1
BASH=/bin/bash
BASH_VERSINFO=([0]="2" [1]="03" [2]="0" [3]="1" [4]="release" [5]="i370-ibm-mvs")
BASH_VERSION='2.03.0(1)-release'
DIRSTACK=()
EUID=0
GROUPS=()
HOME=/u/bcoh
HOSTNAME=ZOS
HOSTTYPE=i370
IFS=' 	
'
LIBPATH=/lib:/usr/lib:.
MACHTYPE=i370-ibm-mvs
OPTERR=1
OPTIND=1
OSTYPE=mvs
PATH=/bin:/usr/local/bin
PIPESTATUS=([0]="0")
PPID=50331879
PS4='+ '
PWD=/u/bcoh
SHELL=/bin/sh
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=1
TERM=dumb
UID=0
Co:Z SFTP version: 1.8.0 (5.0p1) 2011-02-03
Copyright (C) Dovetailed Technologies, LLC. 2008. All rights reserved.
Connecting to bufw116t...
cozsftp> lzopts mode=text,linerule=crlf
 linerule=crlf   mode=text
cozsftp> put //DD:XXX smftest.txt
Uploading //DD:XXX to /root/smftest.txt
ZosSmf119Record[I]: getaddrinfo failed: EDC5000I No error occurred. (errno2=0x00000000) for: bufw116t:22
ZosDataset[I]: Opening dataset DD:XXX for read
DatasetHandler[E]: Error in fopen(//DD:XXX, rb,type=record,noseek,recfm=*) - EDC5037I The specified ddname was not
found. (errno2=0xC00B05B1)
[42.220] Couldn't open local file "//DD:XXX" for reading: EDC5037I The specified ddname was not found.
(errno2=0xC00B05B1)
cozsftp> quit
CoZBatch[I]: returning rc=exitcode=0
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

I don't know what port of BASH you are using, but I doubt that it supports _BPX_SHAREAS and _BPS_SPAWN_SCRIPT. Thus, when you run the "cozsftp" command from your BASH script, it is forked into a separate BPXAS address space.

Try running with the z/OS shell by adding PARM='/ /bin/sh -L' to your EXEC statement.
BobC
Posts: 10
Joined: Fri Mar 04, 2011 9:57 am

Post by BobC »

dovetail wrote:I don't know what port of BASH you are using, but I doubt that it supports _BPX_SHAREAS and _BPS_SPAWN_SCRIPT. Thus, when you run the "cozsftp" command from your BASH script, it is forked into a separate BPXAS address space.

Try running with the z/OS shell by adding PARM='/ /bin/sh -L' to your EXEC statement.
The bash port 2.03 is from the binaries at IBM's website and VERY convenient when using ssh.
Using the PARM solved the problem.

Thanks so much for your time on this.
Post Reply