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





-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@bama.ua.edu] On Behalf Of 
Henrique Seganfredo
Sent: Thursday, August 25, 2011 11:45 AM
To: IBM-MAIN@bama.ua.edu
Subject: COPY commands under JCL vs. under Unix System Services

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 
lists...@bama.ua.edu with the message: GET IBM-MAIN INFO Search the archives at 
http://bama.ua.edu/archives/ibm-main.html

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

Reply via email to