IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Random access on sequential file


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Tue Jan 08, 2008 9:56 pm
Reply with quote

If we have a file defined earlier as sequential file. Suppose I want to use for dynamic access. Assuming the file is sorted in the key positions. And I define it as organisation is indexed. Can random access be done on it ?
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Jan 09, 2008 1:08 am
Reply with quote

No
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed Jan 09, 2008 7:58 am
Reply with quote

Quote:
And I define it as organisation is indexed

Go thru the manuals, when do you define organization as INDEXED? MF (as a matter of fact any system) doesn't work as your wish.... its the otherway icon_cry.gif icon_cry.gif .
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Wed Jan 09, 2008 6:59 pm
Reply with quote

I tried this on mainframe and I got IEC161I 076-002. Seems the sequential file could not get opened as VSAM.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Jan 09, 2008 7:18 pm
Reply with quote

Of course it can't get opened as a VSAM. It isn't a VSAM. Just like you can't open a database like a VSAM because it isn't a VSAM
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Jan 09, 2008 9:23 pm
Reply with quote

niks_jude wrote:
Seems the sequential file could not get opened as VSAM.

Was bit curious to know..what's the origin of this idea, to read a Sequential file as VSAM? what clciked you?
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu Jan 10, 2008 11:33 am
Reply with quote

My idea was if a sequential file is sorted in key positions. then can be random access be done on it. Basically whether physical organisation has anything to do with what we define logically in a COBOL program. Just like we can use VSAM sequentially, is the other way round possible ?
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu Jan 10, 2008 6:29 pm
Reply with quote

Move the data into a VSAM or DB table if you need random access.
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Thu Jan 10, 2008 6:59 pm
Reply with quote

The organisation of the file sequential file has the characteristic that allows the records to be accessed in the order in which they are stored in the file. Here I am talking about the PS (physical sequential) file. The random and dynamic accesses are not allowed. Also START and DELETE operations can not be performed on it.

But an ESDS VSAM file can be accessed randomly using RBA in CICS.

Thanks,
Ajay
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jan 10, 2008 7:01 pm
Reply with quote

niks_jude wrote:
Just like we can use VSAM sequentially, is the other way round possible ?

In Mainframes (MF) we can't & this is one of the probable reason why VSAM in use.
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Fri Jan 11, 2008 11:24 am
Reply with quote

Thanks it clears my doubt.
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Fri Jan 11, 2008 12:06 pm
Reply with quote

One more thing to add which should clear everyone on this topic -----

The main reason is that for random access an index is required. The index is the displacement corresponding to each key. This is not part of the sequential file organization that is why random access cannot be done on the sequential file.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Jan 15, 2008 8:36 pm
Reply with quote

Hi niks_jude,

The main reason is that seq files were never designed for random access. That's why they call them PS (Physical Sequential) files.

You can define them as "indexed", but that doesn't make it so.
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Tue Jan 15, 2008 8:57 pm
Reply with quote

It is too bad that on the mainframe this cannot be done. Some languages on PCs allow random access of sequential file by positioning to a record or byte position within the file and then doing a read. But if it cannot be done, there is not anything we can do about it. (or is there?)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jan 16, 2008 3:55 am
Reply with quote

Hello,

This goes back a long, long time and i have no reference material, but i seem to recall that one could issue a BDAM read against a PS (QSAM) file.
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Wed Jan 16, 2008 4:51 am
Reply with quote

I found this on the WEB, is it correct?
Quote:
BDAM file handling
Enterprise COBOL does not support the processing of BDAM files. Convert any BDAM files to virtual storage access method/relative record data set (VSAM/RRDS) files.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jan 16, 2008 9:08 pm
Reply with quote

Hello,

I believe that is correct.

If one was so iniclined, i believe it could still be done in assembler.

As suggested in the quote, i'd recommend defining a vsam file and using that for random access.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top