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

VSAM File not opening in I-O Mode


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 29, 2008 5:08 pm
Reply with quote

Quote:
OPEN I-O I-O-FILE.
DISPLAY 'OPENING I-O-FILE'.
READ I-O-FILE.
DISPLAY 'READING I-O-FILE'.
Uh, this code is not right. You need to establish a starting point for the read by moving LOW-VALUES or whatever you want to read to ABCD (your record key) before doing the read. From the manual on the READ statement:
Quote:
6.2.28.7.1 Indexed files


Execution of a format 2 READ statement causes the value of the key of reference to be compared with the value of the corresponding key data item in the file records, until the first record having an equal value is found. The file position indicator is positioned to this record, which is then made available. If no record can be so identified, an INVALID KEY condition exists, and READ statement execution is unsuccessful. (See "Invalid key condition" under "Common processing facilities" in topic 6.1.8.9.)


If you want to read the first record in the file you must use READ I-O-FILE NEXT and I still recommend setting ABCD to LOW-VALUES before doing the read.
Back to top
View user's profile Send private message
swathiravichandran

New User


Joined: 21 Jul 2008
Posts: 19
Location: Mumbai

PostPosted: Mon Sep 29, 2008 5:43 pm
Reply with quote

Volume serial: ,P2PE14
File Type: , KSDS
Device type: , 3390
CI Size: , 32768
Key length: , 40
Key location: , 0
Record format: , V
Average record length: , 375
Maximum record length: , 32700
Physical block size: , 32760
Primary cylinders: , 4
Secondary cylinders: , 50

This is my VSAM layout.How will be my DCB parameter then??
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 29, 2008 5:46 pm
Reply with quote

VSAM files do not have DCB; they have ACB.

And you still need to change your code before it will work, no matter what the VSAM file looks like.
Back to top
View user's profile Send private message
swathiravichandran

New User


Joined: 21 Jul 2008
Posts: 19
Location: Mumbai

PostPosted: Mon Sep 29, 2008 5:50 pm
Reply with quote

Hi Robert,
In the JCL we have to specify DCB parameters.That one I m asking about.
Back to top
View user's profile Send private message
hchinnam

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Mon Sep 29, 2008 5:58 pm
Reply with quote

Quote:


In the JCL we have to specify DCB parameters.That one I m asking about.



For old VSAM DS you will not specify DCB.

For you new DS, you will use IDCAMS or any other utility to define them.

In either case you don't need a DCB for VSAM.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 29, 2008 6:14 pm
Reply with quote

Putting DCB parameters on a VSAM file will cause problems. You do not use DCB parameters with VSAM files. You can specify in JCL AMP=AMORG to indicate a VSAM file, or if you want to specify some buffers you can specify AMP=('BUFND=30,BUFNI=5') or whatever makes sense in your case. But in no case will you specify DCB in the JCL for a VSAM file.
Back to top
View user's profile Send private message
swathiravichandran

New User


Joined: 21 Jul 2008
Posts: 19
Location: Mumbai

PostPosted: Mon Sep 29, 2008 8:20 pm
Reply with quote

what can I do if I get a file status code of 23??
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 29, 2008 8:34 pm
Reply with quote

A file status 23 is normal and expected when you do a random READ (or START) and the record key you specified does not exist. What can you do? Read a different record, write the new record into the file, or skip the record and proceed -- what you do depends on the application requirements and you're certainly not going to find that out on a forum.
Back to top
View user's profile Send private message
ridgewalker58

New User


Joined: 26 Sep 2008
Posts: 51
Location: New York

PostPosted: Mon Sep 29, 2008 9:55 pm
Reply with quote

And what was the value that was in the WS-VSAM-STATUS field when your program displayed VSAM UN-SUCCESSFUL'. The VSAM UN-SUCCESFUL message seems to say that the OPEN was UNSUCCESSFUL.

Does your VSAM file have any records in it,
Does your VSAM file have records that are within the sizes in your
01 level record descriptions in the FD clause
OR
If your VSAM file has only one sized record, does your 01 level match that record size
OR
Does your RECORD KEY field in your FD clause match the KEY field that you used in your Define Cluster cards for the VSAM file
Back to top
View user's profile Send private message
swathiravichandran

New User


Joined: 21 Jul 2008
Posts: 19
Location: Mumbai

PostPosted: Tue Sep 30, 2008 9:59 am
Reply with quote

Thank you Robert my problem has solved..since my vsam file contain single record...it is unable to access in randome mode..now the problem is solved icon_smile.gif
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 -> COBOL Programming Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts HILITE on Browse mode? TSO/ISPF 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top