View previous topic :: View next topic
|
Author |
Message |
swathiravichandran
New User
Joined: 21 Jul 2008 Posts: 19 Location: Mumbai
|
|
|
|
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 |
|
|
swathiravichandran
New User
Joined: 21 Jul 2008 Posts: 19 Location: Mumbai
|
|
|
|
Hi,
While reading my vsam file in I-O-mode, I am getting vsam file status 47.
wat does it mean.? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
ramakrishnag
New User
Joined: 10 Sep 2008 Posts: 6 Location: india
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
ridgewalker58
New User
Joined: 26 Sep 2008 Posts: 51 Location: New York
|
|
|
|
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 |
|
|
swathiravichandran
New User
Joined: 21 Jul 2008 Posts: 19 Location: Mumbai
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
swathiravichandran
New User
Joined: 21 Jul 2008 Posts: 19 Location: Mumbai
|
|
|
|
VSAM UN-SUCCESFUL |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
swathiravichandran
New User
Joined: 21 Jul 2008 Posts: 19 Location: Mumbai
|
|
|
|
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 |
|
|
ramakrishnag
New User
Joined: 10 Sep 2008 Posts: 6 Location: india
|
|
|
|
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 |
|
|
swathiravichandran
New User
Joined: 21 Jul 2008 Posts: 19 Location: Mumbai
|
|
|
|
what will be the access mode for a file being opened in I-O mode and is a KSDS VSAM file. |
|
Back to top |
|
|
swathiravichandran
New User
Joined: 21 Jul 2008 Posts: 19 Location: Mumbai
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
swathiravichandran
New User
Joined: 21 Jul 2008 Posts: 19 Location: Mumbai
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
swathiravichandran
New User
Joined: 21 Jul 2008 Posts: 19 Location: Mumbai
|
|
|
|
Hi Robert,
In the JCL we have to specify DCB parameters.That one I m asking about. |
|
Back to top |
|
|
hchinnam
New User
Joined: 18 Oct 2006 Posts: 73
|
|
|
|
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 |
|
|
|