View previous topic :: View next topic
|
Author |
Message |
Gayathri P
New User
Joined: 07 Oct 2011 Posts: 16 Location: India
|
|
|
|
I have converted a flat file (recl 100) into the below VSAM.
when I read that VSAM using the key (old-card), am getting logic-error '92'.
Code: |
SELECT INP-FILE ASSIGN TO O-INPFILE
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
FILE STATUS IS FILE-STAT
RECORD KEY IS WS-KEY.
FD INP-FILE
DATA RECORD IS INPUT-RECORD.
01 INPUT-RECORD.
05 WS-KEY.
10 old-card PIC X(16).
05 new-CARD PIC X(16).
05 NAME PIC X(36).
05 ACCT PIC X(09).
05 FILLER PIC X(22).
05 FILE-STAT PIC X(2) VALUE SPACES.
88 WI-XREF-SUCCESSFUL VALUE '00'.
88 WI-XREF-EOF VALUE '10'.
88 WI-XREF-SEQUENCE-ERROR VALUE '21'.
88 WI-XREF-DUPLICATE-KEY VALUE '22'.
88 WI-XREF-NOT-FOUND VALUE '23'.
88 WI-XREF-NOT-SPACE VALUE '24'.
PROCEDURE DIVISION
MOVE ws-number TO WS-KEY
READ INP-FILE.
DISPLAY 'XREF-STAT = ' FILE-STAT
IF WI-XREF-SUCCESSFUL
.............
(do processing)
|
Kindly help in resolving this |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
And a code 92 is what ............
You have looked it up haven't you. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Also it is a Cobol rather than a VSAM question. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Indeed it is and has now been moved |
|
Back to top |
|
|
Dsingh29
Active User
Joined: 16 Dec 2008 Posts: 132 Location: IBM
|
|
|
|
your input record is of 99 length while you said recl =100 for flat file, please check following to start with your error research:
1. see if KSDS is properly populated
2. check the length of your key again.
3. try to increase the length of input record. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I got the same byte-count as Dave. You'll have to change that anyway.
What are you going to use those 88's for? The name you've given for 24, I don't understand. From the 88's it looks like you are doing sequential reads as well.
The minimal code you have provided shows a sequential read, yet you are setting up the key.
Either you are doing a sequential read without a prior position on the file, or you are doing a keyed read with the wrong (sequential) format for the READ statement. The KEY IS to Read The Fine Manual. |
|
Back to top |
|
|
Gayathri P
New User
Joined: 07 Oct 2011 Posts: 16 Location: India
|
|
|
|
After the read stmt I have displayed the FILE-STAT which is '92',Hence I ve raised this under VSAM .
File status 92 has given me the explanation as logical error.
As far as i checked , the key field length is correct, pos 1-16 and is correctly populated in KSDS too.
Thanks for pointing out the recl mismatch and it has been corrected. |
|
Back to top |
|
|
Gayathri P
New User
Joined: 07 Oct 2011 Posts: 16 Location: India
|
|
|
|
The 88 Variables ,I have just given some self defined flags for various status codes of the VSAM .
Please ignore the '24' which is not applicable in this case |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Not "logical error" but "logic error". This means you have done somthing which does not make sense to the VSAM processing code.
In your case, when you get to the post, you have asked it to read the next record when there is no current record for VSAM to use to establish what record anyone would feel is the "next".
It is a "logic error" because your code asked VSAM to do something which does not make sense. It is a Cobol question because your code is in Cobol.
Maybe there are other exceptions, but except for an I/O error, those FILE-STATUSes you get in your program which are not those expected at the time are indicating problems with your code (sometimes it'll be the specification which is lacking, but usually you should have been able to think of those situations yourself; sometimes it'll be the file definition, which is more code that is either yours, or which you should have looked at).
EDIT: Crossed in the post. I'm not discouraging the 88s, just was curious as to whether they indicated random and sequential, and what you were expecting from the 24, which I'll now ignore. Still, the others should be adding to the information about your program... |
|
Back to top |
|
|
Gayathri P
New User
Joined: 07 Oct 2011 Posts: 16 Location: India
|
|
|
|
Quote: |
keyed read with the wrong (sequential) format for the READ statement |
am afraid If I do a wrong key-read . I have provided the code how I perform the READ , can you correct it , if its wrong ? Please |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Click on the Manuals link at the top of the page. Choose a Cobol Language Reference. Look at Format 2 of the READ. Look at some other stuff at the same time, so you pick up something else as well. |
|
Back to top |
|
|
Gayathri P
New User
Joined: 07 Oct 2011 Posts: 16 Location: India
|
|
|
|
Thank you Mr Bill ,
Will definitley look into the reference .
The issue is resolved now. I just corrected the line order below ,
FILE STATUS IS FILE-STAT
RECORD KEY IS WS-KEY.
to
RECORD KEY IS WS-KEY
FILE STATUS IS FILE-STAT.
and it worked out.
Thank you all !!! |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Really?
If the order mattered, I'd have expected the Compiler to notice and give you an error.
Same data? No other code changes?
You have DYNAMIC access. How do you think you are telling it to do a keyed read rather than a sequential read? |
|
Back to top |
|
|
Gayathri P
New User
Joined: 07 Oct 2011 Posts: 16 Location: India
|
|
|
|
I havent made any other change Sir.
In the same program , I am also performing a sequential read on another file and have given the access mode as SEQUENTIAL .
For KEY-READ I have tried with both RANDOM & DYNAMIC , and now after this change both are working.
To answer your question,in DYNAMIC I have populated the key value and made the READ ,
MOVE ws-number TO WS-KEY
READ INP-FILE.
Whereas in sequential jus staright away reading till the End Of file.
READ HBO-MASTER
AT END
(come out)
NOT AT END
(process)
Thats the only difference I had made in here . |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK. I'll try to find time to do a little checking, as that sounds interesting.
If you are only doing keyed reads on that file, then it is better to specify RANDOM. If doing a mix of keyed and sequential reads on that file, you must use DYNAMIC.
With DYNAMIC, READ without the KEY is going to do a sequential read.
Having said that, I've always used READ NEXT for a sequential and READ KEY for a keyed read, so can't be certain about what happens if you don't do that. It makes the program easier to read, and leave no doubt about either your intention or the compiler's actions. |
|
Back to top |
|
|
Gayathri P
New User
Joined: 07 Oct 2011 Posts: 16 Location: India
|
|
|
|
Yes I have realized the benefit of using RANDOM here.
So far I ve been using START , READ NEXT only for the READs using PARTIAL-KEYs . Will try using READ NEXT for sequential too.
Thanks a ton for ur help |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
For OPEN INPUT for a KSDS the default when nothing specified is a keyed read.
I have so far failed to create a '92' for keyed reads of a KSDS.
There is one change you made we forgot about, which was the length of the record.
The order of FILE STATUS and RECORD KEY makes no difference.
The 92, "logic error", should be saying "you're asking me (VSAM) to do something that does not make sense given, like writing input, reading output".
If you can make the problem return by changing the length of the record back to 99, I'd be interested in seeing a LISTCAT.
If you can't re-create it like that, then we'll get nowhere without seeing more of your code. If you like, and are allowed, you can PM me the whole thing :-) |
|
Back to top |
|
|
Gayathri P
New User
Joined: 07 Oct 2011 Posts: 16 Location: India
|
|
|
|
Yes !!!!
Its that recl change which is causing the difference.
I have recreated the bug , by reverting that change.
I still don't understand why it dint throw me some error like file attribute mismatch or so .. during execution itself , instead the job ran fine !!! |
|
Back to top |
|
|
Gayathri P
New User
Joined: 07 Oct 2011 Posts: 16 Location: India
|
|
|
|
I would appreciate a detail explanation for I dont have enough knowledge on compiler listing |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
unfortunately this is not a training forum...
if You have some/few lines that You do not understand post them and somebody will be glad to help.
but.... nothing more |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Have a look in the Language Reference about specifying the extended file status for VSAM files. The third field in the group that you define will give you the Reason Code returned from VSAM. If you do this and display the value, you will get a decimal 44.
DFSMS Macro Instructions for Data Sets, Reason Codes (RPLERRCD) wrote: |
44(X'2C') Work area not large enough for the data record or for the buffer (GET with OPTCD=MVE). |
If you haven't defined enough bytes to hold the record, I guess it is a "logic error" :-)
Why doesn't it fail on the OPEN? I guess down to the difference between VSAM file-handling and non-VSAM file-handling.
I haven't looked, but there may be a better answer in DFSMS Macro Instructions for Data Sets. |
|
Back to top |
|
|
|