View previous topic :: View next topic
|
Author |
Message |
Vidya Bhama
New User
Joined: 17 Sep 2008 Posts: 41 Location: Chennai
|
|
|
|
Hi,
I have a requirement where i have a input file having VSAM file names in each of its record. I need to read each of these VSAM files (in the input file) and check for the specific record in it. If i have it then i need to write the output file.
Below in an example
Code: |
Input file
11AAAAA abc.vsam1.file
11BBBBB abc.vsam2.file
11CCCC abc.vsam3.file
|
Code: |
Vsam file abc.vsam1.file
...10 xxxxxxxxxxxxxxxxxxx
...10 xxxxxxxxxxxxxxxxxxx
...10 xxxxxxxxxxxxxxxxxxx
...10 xxxxxxxxxxxxxxxxxxx
|
If there is a record "10..." inthe VSAM file I need to write the output file else I need to continue and read the next record in the Input file.
Can anyone please suggest me any way to achieve this?
Regards,
Vidya |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
If i understand the task, you want to read a file of records like:
Code: |
11AAAAA abc.vsam1.file |
Is the "driver" file always going to contain the same number of records?
Is the 11AAAAA needed for anything or does this just happen to be the first bytes of the record?
Then you want to read the entire file named in the dsn field looking for a Record 10. If a 10 is found, write this record to some (as yet undescribed) output file. Is there a rule about needing all records n a file to have a 10 or will one anywhere meet your rule for copying?
It appears that the dataset names to be searched are only known at run-time. Will there always be the same number of files?
If the vsam dataset names is unpredictable, you will need to learn how to dynamically allocate a vsam file in your program. If all of the files to seach do not have the exact same attributes, i see majr problems. |
|
Back to top |
|
|
Vidya Bhama
New User
Joined: 17 Sep 2008 Posts: 41 Location: Chennai
|
|
|
|
Hi Dick,
No it is not a driver file and it will not have the same number of records every time. Its a PS file in a sorted order.
Yes the initial numbers 11AAAAA are the ID's and these needs to be written onto hte output file.
We need to check the VSAM file if it has atleast a single record like
Code: |
...10 xxxxxxxxxxxxxxxxxxx
|
If yes then the output file will be written like below,
yes the VSAM files should be read dynamically. all the VSAM files have the same attributes. but how do we do dynamic reads?
Thanks for your reply,
Vidya |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Its a PS file in a sorted order. |
Yes, but the content "drives" the rest of the process. Possibly "driver" has some very specific meaning in your organization
Quote: |
yes the VSAM files should be read dynamically. |
Yup, and they will need to be dynamically allocated as well. There are several topics in our forum that deal with dynamic file allocation.
One caution is that i don't recall dynamic allocation of vsam files. If this is still an open question when i return, i'll try to find a dynamic vsam allocation topic. |
|
Back to top |
|
|
Vidya Bhama
New User
Joined: 17 Sep 2008 Posts: 41 Location: Chennai
|
|
|
|
Thanks Dick. I ll check in the forum for dynamic file allocation. I have never done it before so was wondering why to allocate a file to read it.
Thanks
Vidya |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Normally in a batch job all the datasets a program needs are allocated by the JCL *the DD statement) which EXECs the program.
If you are unable to have DD statements, you have to "allocate" dynamically. Otherwise, when you open a file in your program, there is nothing to connect your ASSIGN to any sort of dataset.
EDIT: If you can explain why the dataset names have to be unknown to the JCL, it might help us to make suggestions. Explain as much as you can about the process, please. |
|
Back to top |
|
|
Vidya Bhama
New User
Joined: 17 Sep 2008 Posts: 41 Location: Chennai
|
|
|
|
Hi Bill,
Thanks for the explanation.
The Input file has almost like 100 or more number of VSAM file names occuring in it. Also this number of records that might appear in it would be varying too. Hence it cannot be given in a JCL.
Regards,
Vidya |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Why not write a program that generates the JCL and submits it into the internal reader? |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
@ Vidya Bhama !
My first thought went in the same direction, Robert mentioned above.
Simply done in some minutes.
Just a little Rexx-Routine, which reads the Ps-File record for record till the end , gets the Vsam-Name, generates JCL via File-Tayloring, and submits a job for every Vsam-Name.
The submitted JCL executes a programm that handels the VSAM-FILE.
The only thing here is, you have a separate Job in the Queue for ervery filename you found. On the other hand, if you have a scheduling system like OPC/ESA or something else, you could plan explicit runtime for the jobs. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Vidya Bhama,
Are you saying, in your second post, that you only have to check for the presence of any record on the vsam file, or of a particular record?
The whole thing sounds very complex. What is the purpose? Is it something for Production, or a "tool"?
From what I understand so far, I'd generate a bunch of REPRO statements, toss them into IDCAMS and look at the output to build your output file.
Whether this would satisfy your requirement, I don't know, because the requirement is still unclear. Don't know the type of VSAM file, or where any one, or one particular, record is required.
You are getting suggestions which may not be what you expected, but which may give you better results than the way you are planning.
Unless you tell us about the full requirement, though, we can't tell what might be of use to you, and you'll have to stick with some odd solution, which sounds very difficult to manage. |
|
Back to top |
|
|
Vidya Bhama
New User
Joined: 17 Sep 2008 Posts: 41 Location: Chennai
|
|
|
|
Hi
Thanks for all your inputs. I have suggested the alternative methods suggested here to my peers and thye have mentioned they ll get back to me on this.
@Bill,
They business purpose was not explained to us and this request reached in a technical way saying " prepare a cobol program to read the vsam filew dynamically" so i am not able to give you much inputs here. I have asked my peers for more information and they said they would get back.
Meanwhile thanks to all who have given valuable suggestions here for it helped me a lot.
Regards,
Vidya |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Did they at least tell you whether you are looking for any data content or the file or specific data content. And the type of the vsam file? |
|
Back to top |
|
|
|