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
swathiravichandran

New User


Joined: 21 Jul 2008
Posts: 19
Location: Mumbai

PostPosted: Fri Sep 26, 2008 9:33 pm
Reply with quote

Hi,

I am trying to open and read a vsam file .I have used it in I-O mode .It is opening the file successfully but not reading any value . Can anyone please help me out with it ?

I initialized the code with this layout
SELECT I-O-FILE ASSIGN TO OFILE1
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS ABCD.
FILE STATUS IS WS-VSAM-STATUS.

READ I-O-FILE.
IF VSAM-SUCCESSFUL
PERFORM 2600-CHK-PARA THRU 2600-EXIT
ELSE
DISPLAY 'VSAM UN-SUCCESFUL'
GO TO 2600-EXIT
END-IF.
Back to top
View user's profile Send private message
swathiravichandran

New User


Joined: 21 Jul 2008
Posts: 19
Location: Mumbai

PostPosted: Fri Sep 26, 2008 9:41 pm
Reply with quote

Hi,
While reading my vsam file in I-O-mode, I am getting vsam file status 47.
wat does it mean.?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Sep 26, 2008 9:57 pm
Reply with quote

that You did not care to look at the manual for the vsam file status meaning
is Your other post related to the same issue ???

please do not double post,
You will not get a double help or the same help in half the time

let me know and I will delete one of the two
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Sep 26, 2008 10:05 pm
Reply with quote

swathiravichandran wrote:
I have used it in I-O mode .It is opening the file successfully but not reading any value .
Apparently not.....
swathiravichandran wrote:
While reading my vsam file in I-O-mode, I am getting vsam file status 47.
wat does it mean.?
Look it up.....
47
The execution of a READ statement was attempted on a file not open in the input or I-O mode.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Sat Sep 27, 2008 4:28 am
Reply with quote

swathiravichandran wrote:
It is opening the file successfully ..
How do you conclude this ? Status code posted doesn't support this explanation. Was the VSAM defined correctly ?
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: Sat Sep 27, 2008 5:12 am
Reply with quote

swathiravichandran: I notice you did not post the OPEN statement you used with the file. This is highly important data for your problem. And, by the way, if you open the file for OUTPUT it may very well open successfully but when you attempt to READ from such a file you will get a file status 47 set on the READ, even though the OPEN file status was 00.
Back to top
View user's profile Send private message
ramakrishnag

New User


Joined: 10 Sep 2008
Posts: 6
Location: india

PostPosted: Sat Sep 27, 2008 8:02 pm
Reply with quote

Hi Swathi,

For read and update VSAM file
Frist thing open I-O mode that you aready done.
Next pass the KEy values in ABCD
then read the VSAM file if record is found then WS-file -STATus will be 00 other wise 10 record not found.
for update use re-write command but make sure that key values in ABCD should not be changed.
Hope this will solve your problem

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

Superior Member


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

PostPosted: Sat Sep 27, 2008 10:19 pm
Reply with quote

Hi Rama,
ramakrishnag wrote:
Frist thing open I-O mode that you aready done.
How could you know this, She has just given the file-name as I-O-FILE and that doesn't conclude that file is/was actually OPENed in I-O mode. We would need to know how does the OPEN statement look like, as asked by Robert. Unless I misunderstood or there is other way please let me know.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Sun Sep 28, 2008 1:45 am
Reply with quote

Hello swathiravichandran,

Did you miss the example & link of this thread..

www.ibmmainframes.com/viewtopic.php?t=34651&highlight=
Back to top
View user's profile Send private message
ridgewalker58

New User


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

PostPosted: Sun Sep 28, 2008 4:03 am
Reply with quote

If what you mean by "opens successfully" is that you are receiving a File status code of ZEROS, then:
1. If the file has records of varying sizes, and you are only describing
one 01 LEVEL, try adding a second 01 LEVEL for the MAXIMUM size
of the possible records.
FOR EXAMPLE: VSAM DEFINITION RECSIZE (15 4096)
Make two 01 levels 01 REC1 PIC X(15).
01 REC2 PIC X(4096).
** If you described ONE 01 level and you encounter a different
size record - depending on your compiler - you will get an
error.
2. OR if the file is EMPTY and you try to open it with I-O you should
have gotten an INVALID open file status code.
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 10:45 am
Reply with quote

This is my open statement 'OPEN I-O I-O-FILE.' which I have coded before i m reading the file.But still facing the same problem.The record key I mentioned as ABCD which i m using as a key in my vsam file.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Mon Sep 29, 2008 10:54 am
Reply with quote

Ok, try to DISPLAY the status code after READ..& tell us what comes up..

Code:
READ I-O-FILE.
IF VSAM-SUCCESSFUL
    DISPLAY 'WS-VSAM-STATUS='WS-VSAM-STATUS
ELSE
    DISPLAY 'VSAM UN-SUCCESFUL'
END-IF.
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 11:05 am
Reply with quote

VSAM UN-SUCCESFUL
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Mon Sep 29, 2008 11:21 am
Reply with quote

Hi,

Please post the scrap of code where you issuse an OPEN, was it in PROCEDURE DIVISION or not ? Please post a code in a manner that we can understand the logical flow of the program. I suspect you tried to READ file before it was OPENed.
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 11:37 am
Reply with quote

OPEN I-O I-O-FILE.
DISPLAY 'OPENING I-O-FILE'.
READ I-O-FILE.
DISPLAY 'READING I-O-FILE'.

IF VSAM-SUCCESSFUL
DISPLAY 'VSAM-STATUSCODE' WS-VSAM-STATUS
DISPLAY 'VSAM SUCCESFUL FOR 2600-PARA'
PERFORM 2600-CHK-PARA THRU 2600-EXIT
ELSE
DISPLAY 'VSAM UN-SUCCESFUL'
DISPLAY 'VSAM-STATUSCODE' WS-VSAM-STATUS
GO TO 2500-EXIT
END-IF.
Back to top
View user's profile Send private message
ramakrishnag

New User


Joined: 10 Sep 2008
Posts: 6
Location: india

PostPosted: Mon Sep 29, 2008 11:54 am
Reply with quote

Hi Swathi,

Can you tell one thing.

1. Are you define the 05 WS-VSAM-STATUS PIC 9(02).
and the 88 VSAM-SUCCESSFUL value 00.

2. In the JOB are you mentioned VSAM file which has record lenght equal to the file section record length only or seqential file ?.

Check these to things and let us know.

thanks,
Rama
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 1:55 pm
Reply with quote

what will be the access mode for a file being opened in I-O mode and is a KSDS 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 2:00 pm
Reply with quote

Hi Rama,
1.I declared as 05 WS-VSAM-STATUS PIC X(02).
and the 88 VSAM-SUCCESSFUL value '00', '97'.
2.Yes the record length in both the job and file are same.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Mon Sep 29, 2008 2:18 pm
Reply with quote

swathiravichandran wrote:
what will be the access mode for a file being opened in I-O mode and is a KSDS VSAM file.
INDEXED.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Mon Sep 29, 2008 2:27 pm
Reply with quote

Well, we are not making progress. So far it seems code does have all the ingredients, let's check the VSAM definition now - how the VSAM was created, do you have IDCAMS code lines available to share.
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: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
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 FTP VB File from Mainframe retaining ... JCL & VSAM 3
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 HILITE on Browse mode? TSO/ISPF 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top