Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Read filenames mentioned in the records in Input file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Vidya Bhama

New User


Joined: 17 Sep 2008
Posts: 41
Location: Chennai

PostPosted: Thu Jan 12, 2012 10:35 am    Post subject: Read filenames mentioned in the records in Input file
Reply with quote

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

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jan 12, 2012 11:15 am    Post subject:
Reply with quote

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

New User


Joined: 17 Sep 2008
Posts: 41
Location: Chennai

PostPosted: Thu Jan 12, 2012 11:30 am    Post subject: Reply to: Read filenames mentioned in the records in Input f
Reply with quote

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,
Code:
VERSION##        11AAAAA       


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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jan 12, 2012 11:52 am    Post subject:
Reply with quote

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 icon_smile.gif

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

New User


Joined: 17 Sep 2008
Posts: 41
Location: Chennai

PostPosted: Thu Jan 12, 2012 12:41 pm    Post subject: Reply to: Read filenames mentioned in the records in Input f
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Thu Jan 12, 2012 12:45 pm    Post subject: Reply to: Read filenames mentioned in the records in Input f
Reply with quote

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

New User


Joined: 17 Sep 2008
Posts: 41
Location: Chennai

PostPosted: Thu Jan 12, 2012 2:31 pm    Post subject: Reply to: Read filenames mentioned in the records in Input f
Reply with quote

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

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Thu Jan 12, 2012 3:34 pm    Post subject:
Reply with quote

Why not write a program that generates the JCL and submits it into the internal reader?
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 743
Location: Germany

PostPosted: Thu Jan 12, 2012 5:30 pm    Post subject:
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Thu Jan 12, 2012 5:56 pm    Post subject: Reply to: Read filenames mentioned in the records in Input f
Reply with quote

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

New User


Joined: 17 Sep 2008
Posts: 41
Location: Chennai

PostPosted: Fri Jan 13, 2012 12:35 pm    Post subject: Reply to: Read filenames mentioned in the records in Input f
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Jan 13, 2012 1:09 pm    Post subject: Reply to: Read filenames mentioned in the records in Input f
Reply with quote

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
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 1 Fri Dec 09, 2016 4:40 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 22 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us