Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Dynamically read input files using BPXWDYN
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 10
Location: India

PostPosted: Sat Sep 05, 2020 1:48 pm    Post subject: Dynamically read input files using BPXWDYN
Reply with quote

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
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2400
Location: Hampshire, UK

PostPosted: Sat Sep 05, 2020 3:12 pm    Post subject: Reply to: Dynamically read input files using BPXWDYN
Reply with quote

Schedule your job to run after the other job(s).
Back to top
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 10
Location: India

PostPosted: Sat Sep 05, 2020 3:41 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 385
Location: Denmark

PostPosted: Sun Sep 06, 2020 2:08 pm    Post subject:
Reply with quote

Do you allocate OLD or SHR? If another job has allocated a dataset with OLD, then you cannot allocate it.
Back to top
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 10
Location: India

PostPosted: Mon Sep 07, 2020 12:19 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2400
Location: Hampshire, UK

PostPosted: Mon Sep 07, 2020 1:45 pm    Post subject: Reply to: Dynamically read input files using BPXWDYN
Reply with quote

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
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 10
Location: India

PostPosted: Mon Sep 07, 2020 1:52 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 385
Location: Denmark

PostPosted: Mon Sep 07, 2020 1:58 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 10
Location: India

PostPosted: Mon Sep 07, 2020 4:52 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 385
Location: Denmark

PostPosted: Mon Sep 07, 2020 4:57 pm    Post subject:
Reply with quote

Just to absolutely sure that I follow, you are certain that that 'next' dataset is allocatable?
Back to top
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 10
Location: India

PostPosted: Mon Sep 07, 2020 6:31 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 46
Location: India

PostPosted: Mon Sep 07, 2020 10:44 pm    Post subject: Re: Dynamically read input files using BPXWDYN
Reply with quote

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
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 10
Location: India

PostPosted: Tue Sep 08, 2020 11:12 am    Post subject:
Reply with quote

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
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 46
Location: India

PostPosted: Tue Sep 08, 2020 12:07 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 10
Location: India

PostPosted: Tue Sep 08, 2020 1:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 46
Location: India

PostPosted: Tue Sep 08, 2020 1:40 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 10
Location: India

PostPosted: Tue Sep 08, 2020 3:44 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 46
Location: India

PostPosted: Tue Sep 08, 2020 4:09 pm    Post subject:
Reply with quote

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,
https://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
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 10
Location: India

PostPosted: Tue Sep 08, 2020 6:12 pm    Post subject:
Reply with quote

Thanks for the inputs, We will try this and update you.
Back to top
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 46
Location: India

PostPosted: Tue Sep 08, 2020 6:58 pm    Post subject:
Reply with quote

Srinivas B wrote:
Thanks for the inputs, We will try this and update you.


ok...All the best!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts EIBRESP=16 and EIBRESP2=25 while doi... sancraig16 CICS 2 Thu Sep 03, 2020 2:53 am
No new posts Sync logic between VSAM files and DB2... murali.andaluri COBOL Programming 9 Tue Aug 25, 2020 1:01 pm
No new posts Dynamic file read via JCL abdulrafi JCL & VSAM 4 Fri Aug 14, 2020 11:51 am
No new posts CA Sysview - JCL or Rexx - Read or Ex... Jasi CA Products 4 Wed Aug 05, 2020 9:19 pm
No new posts REXX tool to extract all files starti... KeshavKunal CLIST & REXX 4 Tue Jul 21, 2020 3:43 pm

Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us