View previous topic :: View next topic
|
Author |
Message |
Srinivas B
New User
Joined: 05 Sep 2020 Posts: 14 Location: India
|
|
|
|
Hi,
I have a input file which contains the list of dataset names. In my cobol program i am reading this file and using BPXWDYN program to allocate each input file, read the content present and write into output file. I am gettting this list using LISTCAT. However my query is while getting LISTCAT i am getting files which are allocated and still in use by other job. When my program is trying to allocate this file using BPXWDYN then its showing error.
Even if i deallocate this file still its not solving the issue and after this another file is not getting allocated.
To make it simple if the dataset is having 10 filenames out of that if any file in b/w is used by another job or if there is abend in another job then that file is deleted in that job but my listcat has already listed that file and BPXWDYN is giving error while allocating the dataset.
How to overcome this issue Any sugesstions would be great help, i want to remove the files name from the input which are inuse/deleted by another job.
Thanks in Advance. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Schedule your job to run after the other job(s). |
|
Back to top |
|
|
Srinivas B
New User
Joined: 05 Sep 2020 Posts: 14 Location: India
|
|
|
|
There are 1000's of jobs which runs anytime and creates those input files and my job has to run every 15 mins and get the list of files which are created in that 15 mins window and load them into the DB2 table. Either listcat has to give the datasets which are are completed and avaliable for use or handle it in the program?? Is there any possibility to get the listcat of the datasets based on time creation? |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
Do you allocate OLD or SHR? If another job has allocated a dataset with OLD, then you cannot allocate it. |
|
Back to top |
|
|
Srinivas B
New User
Joined: 05 Sep 2020 Posts: 14 Location: India
|
|
|
|
Thanks for the response, We are using SHR mode only. This is what we are doing in the program.
1. Read input file get the list of Dataset names.
2. FREE FI
3. ALLOCATE FILE
3. if successful then open the file in Input mode and read the content in the file and write it into output file.
The above process will continue till all the files are completed in the list.
We also tried SHR REUSE also but that is also giving problem if any dataset in b/w is not avaliable or in use by another job. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
What does 'in b/w' mean? I can think of 'black/white' or 'between' but neither of those make sense in the context written. |
|
Back to top |
|
|
Srinivas B
New User
Joined: 05 Sep 2020 Posts: 14 Location: India
|
|
|
|
Sorry for the confusion..it is in between. i have a file which contains list of dataset names, i am using BPXWDYN to allocate dynamically each file name as input and read them and write the data to output file. if any file is not present/or in use by another job when my program is processing its giving error. Its not allocating the next dataset aslo. Hope this clarifies. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
Seems that you have 2 issues, other dataset allocated and other dataset not exits any more.
I repeat, if the dataset is in exclusive use by another job allocating the dataset either OLD or NEW, then you cannot access it, end of story.
If the dataset no longer exist then of course you cannot access it either, it is gone.
I believe that you should be able to determine the cause by the return code, though I must admit I have no idea of what return code might be returned to a COBOL program.
You could detect the 'missing dataset' by doing a specific listcat just prior to allocate, but looking at the return code would be more efficient.
REUSE has nothing to do with allocation disposition, it means free the dname before allocation.
And in any case, you write "i want to remove the files name from the input which are inuse/deleted by another job". When the allocation fails, the name is not processed and you have achieved the goal. Or am I missing something? |
|
Back to top |
|
|
Srinivas B
New User
Joined: 05 Sep 2020 Posts: 14 Location: India
|
|
|
|
Correct..We are getting return code 23 or 25 if any input file is in use by another job or file is not available. We are handling this. But program is giving the same error when trying to allocate the next file even through we are issuing the 'FREE FI' command. Probably we need to handle this before program runs to have only datasets which are available for exclusive use. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
Just to absolutely sure that I follow, you are certain that that 'next' dataset is allocatable? |
|
Back to top |
|
|
Srinivas B
New User
Joined: 05 Sep 2020 Posts: 14 Location: India
|
|
|
|
YES..It is..for Testing purpose i have used allocatable dataset only, next dataset. But still i am getting error for this dataset also as previous one was not allocatable. |
|
Back to top |
|
|
Apoorva
New User
Joined: 28 Jan 2020 Posts: 49 Location: India
|
|
|
|
Srinivas B wrote: |
Hi,
I have a input file which contains the list of dataset names. In my cobol program i am reading this file and using BPXWDYN program to allocate each input file, read the content present and write into output file. I am gettting this list using LISTCAT. However my query is while getting LISTCAT i am getting files which are allocated and still in use by other job. When my program is trying to allocate this file using BPXWDYN then its showing error.
Even if i deallocate this file still its not solving the issue and after this another file is not getting allocated.
To make it simple if the dataset is having 10 filenames out of that if any file in b/w is used by another job or if there is abend in another job then that file is deleted in that job but my listcat has already listed that file and BPXWDYN is giving error while allocating the dataset.
How to overcome this issue Any sugesstions would be great help, i want to remove the files name from the input which are inuse/deleted by another job.
Thanks in Advance. |
Can you check if ENQ for SYSDSN is held or not for the dataset you are about to allocate? It's been a long time since I used BPXWDYN interface but as far as I remember you could let BPXWDYN assign a DDNAME for the datasets you are trying to allocate instead of passing the same DDNAME to all your datasets. |
|
Back to top |
|
|
Srinivas B
New User
Joined: 05 Sep 2020 Posts: 14 Location: India
|
|
|
|
I am not sure how to check these in COBOL program, do you have any sample code for ENQ and SYSDSN. These are avaliable in REXX. |
|
Back to top |
|
|
Apoorva
New User
Joined: 28 Jan 2020 Posts: 49 Location: India
|
|
|
|
Srinivas B wrote: |
I am not sure how to check these in COBOL program, do you have any sample code for ENQ and SYSDSN. These are avaliable in REXX. |
Ok... So, if the dataset is being held by another job, BPXWDYN will anyway fail. Now your problem is when that happens you will not be able to issue BPXWDYN again with same DDNAME right? If this is your problem then can you check if BPXWDYN can dynamically assign a DDNAME to the dataset you are trying to allocate? This way you need not use the same DDNAME. |
|
Back to top |
|
|
Srinivas B
New User
Joined: 05 Sep 2020 Posts: 14 Location: India
|
|
|
|
I am not if i understood correctly, We have DDNAME for input mentioned in JCL which contains the list of dataset names, another DDNAME for output mentioned in JCL for writing the output and another DDNAME which is used for dynamic allocation (not mentioned in JCL) of these dataset names. Using this dynamic allocation we are allocating each dataset, if the allocation is sucessfull then reading the content from the input file and writing into output file. If any file is in use/deleted by another job then this dynamic allocation is failing for this dataset and also its failing for all the subsequent dataset names even through they are avaliable for use. Hope this clarifies. |
|
Back to top |
|
|
Apoorva
New User
Joined: 28 Jan 2020 Posts: 49 Location: India
|
|
|
|
Srinivas B wrote: |
I am not if i understood correctly, We have DDNAME for input mentioned in JCL which contains the list of dataset names, another DDNAME for output mentioned in JCL for writing the output and another DDNAME which is used for dynamic allocation (not mentioned in JCL) of these dataset names. Using this dynamic allocation we are allocating each dataset, if the allocation is sucessfull then reading the content from the input file and writing into output file. If any file is in use/deleted by another job then this dynamic allocation is failing for this dataset and also its failing for all the subsequent dataset names even through they are avaliable for use. Hope this clarifies. |
I am referring to the dynamic allocation part. You must be using a static DDNAME to dynamically allocate multiple datasets right? If you are using a static DDNAME to dynamically allocate multiple datasets, you could explore if BPXWDYN has the option to let the system assign different DDNAMEs to different datasets? (In this case you need not input your static DDNAME to BPXWDYN) |
|
Back to top |
|
|
Srinivas B
New User
Joined: 05 Sep 2020 Posts: 14 Location: India
|
|
|
|
i am not aware of dynamic DDNAME allocation by BPXWDYN for each dataset ..i checked manual and its avaliable like below..
FI(name) | DD(name) Specifies the ddname to allocate.
If any thing of that you see/you know..please share with us. |
|
Back to top |
|
|
Apoorva
New User
Joined: 28 Jan 2020 Posts: 49 Location: India
|
|
|
|
Srinivas B wrote: |
i am not aware of dynamic DDNAME allocation by BPXWDYN for each dataset ..i checked manual and its avaliable like below..
FI(name) | DD(name) Specifies the ddname to allocate.
If any thing of that you see/you know..please share with us. |
Don't specify FI(name) when you are trying to allocate the datasets. In such cases system will assign a unique DDNAME for your dataset. You can then request BPXWDYN to extract the DDNAME that system assigned. Please refer to below link,
www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.bpxb600/bpx1rx78.htm
I coded a simple REXX program below to allocate a dataset without providing DDNAME,
/* REXX */
CALL BPXWDYN "ALLOC DA(XXXXX.TEMP.ADRDSSU) SHR MSG(2)"
CALL BPXWDYN "INFO INRTDDN(DDN) DA(XXXXX.TEMP.ADRDSSU)"
SAY 'DDN = ' DDN
EXIT
System then assigned SYS00016 DDNAME. You should be able to do something similar in COBOL. |
|
Back to top |
|
|
Srinivas B
New User
Joined: 05 Sep 2020 Posts: 14 Location: India
|
|
|
|
Thanks for the inputs, We will try this and update you. |
|
Back to top |
|
|
Apoorva
New User
Joined: 28 Jan 2020 Posts: 49 Location: India
|
|
|
|
Srinivas B wrote: |
Thanks for the inputs, We will try this and update you. |
ok...All the best! |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
Actually you can use a single BPXWDYN command:
cc=BpxWdyn('alloc da(what.ever) shr rtddn(ddn)')
will return the generated ddname in var 'ddn' if cc=0.
Then you can reuse that ddname i.e.
cc=BpxWdyn('alloc da(what.ever.b) shr dd('ddn') reuse') |
|
Back to top |
|
|
jasorn Warnings : 1 Active User
Joined: 12 Jul 2006 Posts: 191 Location: USA
|
|
|
|
It's been a while and I don't have access to the program at the moment. But I've done this before. Make sure you check the RC of bpxwdyn. You can free the ddname and reuse or use another if you want.
If I remember correctly, the process we had ran frequently so we didn't mind if a dataset was skipped until the next run. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2018 Location: USA
|
|
|
|
Using such things as dynamic dataset allocation is not needed in 99% of the cases where it has appeared. Especially when the author of this solution does not understand the fundumentals of dataset maintenance under zOS. This approach may demonstrate a pseudo-expert level of the developer to his manager (who in turn has not a minor idea about such issues).
In zOS the same things almost always can be implemented in a simple way, without any sophisticated operations. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Please start a new topic in future. |
|
Back to top |
|
|
|