A batch job and your TSO session are executing in different address spaces and thus they are INDEPENDENT of each other -- what you do in one of them *usually* has no impact on the other one. The usual "exception" is if one of the two allocates a file EXCLUSIVELY (DISP=OLD), then the other one cannot also allocate that file. The first one to get EXCLUSIVE access wins, and the other one loses. This is the same as if two JCL jobs try to allocate the same file with DISP=OLD (explicitly or by default).
The other thing you need to understand is the concept of "shared" versus "exclusive" access to a file -- in your case, both the TSO session and the batch job must have used "DISP=SHR", that is they SHARED access (read-only) to that file. When you already have one allocation of a file (SYS1.UADS is allocated to DDname SYSUADS), it is not allowed to have a second EXCLUSIVE allocation; your allocate command did not use the SHR keyword, so the default DISP is OLD, which asks for EXCLUSIVE access to the file. If you had used the SHR keyword, your allocate would have succeeded. Lastly, when you execute your COBOL program in JCL, you must do the JCL equivalent of "allocate", and in JCL this is the DD statement. Running your program in JCL without a DD is like running your program in TSO without an "allocate" before. So, to run your COBOL program in JCL, write a DD statement and use DISP=SHR if it is a file other jobs or TSO sessions will already be using. HTH Peter -----Original Message----- From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] Sent: Thursday, December 08, 2005 2:19 AM To: [email protected] Subject: 'ALLOCATE' a data set in my TSO/E session I've dwell on some questions for days : 1,In TSO,I use 'listalc status' to find that SYS1.UADS has been allocated to DDNAME 'SYSUADS'. For a test, I issue 'allocate dsn(center.uads) dd(sysuads)' and get the meesage that filename is in use. I resort to manuals and know that to do this I must use 'REUSE' operand. However,I submit a job via JCL which also uses DDNAME 'SYSUADS' and there is no problem. 2,I have a simple cobol program who just opens a input file and closes it(select infile assign to infile). First I issue 'allocate dsn(md0006.input.qsam) dd(infile)' and succeed.Then I can use TSO command 'call' to execute the program successfully. However,when I execute the program via JCL without coding infile DDNAME,it fails. So I want to know the exact reason.My personal guess is that a job submitted by JCL is not executed in my TSO address space.Would someone be kind enough to give some explanation for me? Thanks a lot. _ This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html

