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

COPY commands under JCL vs. under Unix System Services

1,903 views
Skip to first unread message

Henrique Seganfredo

unread,
Aug 25, 2011, 2:47:03 PM8/25/11
to
Hello,

I have been dealing with some strange behaviour.

I am trying to run a job that calls BPXBATCH do execute a Unix script.

The Unix script tries to copy the file from the Unix environment to a MVS dataset. I have tried these two approaches. The filename is variable.

1) cp -P "RECFM=FB,SPACE=(CYL,(1,1)),LRECL=96,BLKSIZE=0" $myfilevar.ebcdic "//'PSTR.TEMP'"

2) tso -t "OGET '$myfilevar.ebcdic' 'PSTR.TEMP'"

Both approaches work fine when interactively I type them on a telnet session or on a TSO OMVS session, BUT FAIL when I call the script containing these commands using BPXBATCH on a JOB:

JCL:
//XXXXXXX JOB YYYYYY,TIME=1
//COPY EXEC PGM=BPXBATCH,REGION=8M,COND=(0,NE)
//STDIN DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDPARM DD *
sh /spb/bin/Copy.sh
//*

SYSOUT:

OGET '/spb/tmp/ABMA014_57D18317.33555264.D.ebcdic' 'PSTR.TEMP'
IKJ56225I DATA SET PSTR.TEMP ALREADY IN USE, TRY LATER+
IKJ56225I DATA SET IS ALLOCATED TO ANOTHER JOB OR USER
RC(12)

Why the dataset appears to be "in use" ?? It DOES NOT EVEN exists!

I get this message whenever my script uses 'cp' or 'oget'...

Regards,

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to list...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Mark Zelden

unread,
Aug 25, 2011, 2:59:20 PM8/25/11
to
On Thu, 25 Aug 2011 13:45:12 -0500, Henrique Seganfredo <henrique....@BCB.GOV.BR> wrote:

>Hello,
>
>I have been dealing with some strange behaviour.
>
>I am trying to run a job that calls BPXBATCH do execute a Unix script.
>
>The Unix script tries to copy the file from the Unix environment to a MVS dataset. I have tried these two approaches. The filename is variable.
>
>1) cp -P "RECFM=FB,SPACE=(CYL,(1,1)),LRECL=96,BLKSIZE=0" $myfilevar.ebcdic "//'PSTR.TEMP'"
>
>2) tso -t "OGET '$myfilevar.ebcdic' 'PSTR.TEMP'"
>
>Both approaches work fine when interactively I type them on a telnet session or on a TSO OMVS session, BUT FAIL when I call the script containing these commands using BPXBATCH on a JOB:
>
>JCL:
>//XXXXXXX JOB YYYYYY,TIME=1
>//COPY EXEC PGM=BPXBATCH,REGION=8M,COND=(0,NE)
>//STDIN DD SYSOUT=*
>//STDOUT DD SYSOUT=*
>//STDPARM DD *
>sh /spb/bin/Copy.sh
>//*
>
>SYSOUT:
>
>OGET '/spb/tmp/ABMA014_57D18317.33555264.D.ebcdic' 'PSTR.TEMP'
>IKJ56225I DATA SET PSTR.TEMP ALREADY IN USE, TRY LATER+
>IKJ56225I DATA SET IS ALLOCATED TO ANOTHER JOB OR USER
>RC(12)
>
>Why the dataset appears to be "in use" ?? It DOES NOT EVEN exists!
>
>I get this message whenever my script uses 'cp' or 'oget'...
>


Are you sure something isn't allocated to your TSO session still? Try
logging off from TSO and back on and then try it in batch.

Ways to check would include TSO ISRDDN (DDLIST) with the ENQ
command, or a GRS display command - D GRS,RES=(SYSDSN,PSTR.TEMP)

--
Mark Zelden - Zelden Consulting Services - z/OS, OS/390 and MVS
mailto:ma...@mzelden.com
Mark's MVS Utilities: http://www.mzelden.com/mvsutil.html
Systems Programming expert at http://expertanswercenter.techtarget.com/

Starr, Alan

unread,
Aug 25, 2011, 3:43:17 PM8/25/11
to
Hello Henrique,

There appear to be two threads, both describing a similar issue. BPXBATCH can be a real can of worms. I believe that your problem stems from the fact that executables may be invoked in multiple address spaces having different jobnames, which screws up ENQueue something fierce.

Without going into long-winded explanations, I suggest you try the following using the script that issues "cp"; do not use OGET because it complicates things. I believe that the two environment variables may coax spawn() into doing everything in a single address space, thus eliminating the ENQueue issue. Note that this example may not work as expected if your script (executable) file is flagged with setuid or setgid.

//XXXXXXX JOB YYYYYY,TIME=1
//COPY EXEC PGM=BPXBATCH,REGION=8M,COND=(0,NE),
// PARM='SH /spb/bin/Copy.sh'
//STDOUT DD SYSOUT=*
//STDENV DD *
_BPX_SHAREAS=YES
_BPX_SPAWN_SCRIPT=YES

If the above doesn't work (I don't have time to test - sorry), try changing the program name to BPXBATSL (spawn locally); I'm 97% sure that will work but, if it doesn't, let me know and I'll give you a third alternative.

Cheers,
Alan

Henrique Seganfredo

unread,
Aug 25, 2011, 3:48:35 PM8/25/11
to
Mark,

This is what I got. The other commands you suggested may show anything different?

/D GRS,RES=(SYSDSN,PSTR.TEMP)

RESPONSE=HOMO
ISG343I 16.34.00 GRS STATUS 894
NO REQUESTORS FOR RESOURCE SYSDSN PSTR.TEMP

One correction:

The use of the oget under JCL produces:
Command:
tso -t "OGET '$myvar.ebcdic' 'PSTR.TEMP'"
Sysout:


IKJ56225I DATA SET PSTR.TEMP ALREADY IN USE, TRY LATER+
IKJ56225I DATA SET IS ALLOCATED TO ANOTHER JOB OR USER
RC(12)

The use of the cp under JCL produces:
Command:
cp -P "RECFM=FB,SPACE=(CYL,(1,1)),LRECL=96,BLKSIZE=0" $myvar.ebcdic "//'PSTR.TEMP'"
Sysout: cp: FSUM6258 cannot open file "//'PSTR.TEMP'": EDC5061I An error occurred when attempting to define a file to the system.

Like I said before, these commands entered interactively under USS work w/o problems.

0 new messages