View previous topic :: View next topic
|
Author |
Message |
Sumit Jindal
New User
Joined: 19 Apr 2012 Posts: 8 Location: India
|
|
|
|
I am creating the fresh VSAM file using IDCAMS and initializing it with a Low value record using a utility(in house utility of my shop).
Case 1:
Now In my Cobol program I am opening the VSAM file in I-O mode with access as "Sequential" in Select clause
And writing a record to the VSAM file. But at the time of Write, I am getting VSAM file Status as 92
Case 2:
Doing the same as in case1 except now I have defined access as "Random" in select clause for the VSAM.
Now its working fine and records are successfully written.
So I was wondering what causes the File status 92 in case1.
Thanks in Advance
Regards
Sumit |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Since it is a Cobol question, what does the Cobol manual say about the exact Cobol I/O statements that you are using? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
what kind of vsam file is it?
here is a description of the write statement for a vsam ksds file.
notice that talks about release order (order of records written)
with sequential access.
are you releasing records in order? |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
Back to top |
|
|
Sumit Jindal
New User
Joined: 19 Apr 2012 Posts: 8 Location: India
|
|
|
|
Hello Dbz,
VSAM is the KSDS, With key length of 5.
Yes I know for writing, when access is "SEQUENTIAL" records must
be released in ascending order of the record key values.
When access is "RANDOM" or "DYNAMIC", records may be released in any programmer-specified order.
But I am am writing the records in Ascending order only and moreover I am getting the status code 92 even for my first write step.
My Input Sequential file is like:
11111 AAAA
22222 BBBB
33333 CCCC
44444 DDDD
55555 EEEE |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
actually, NO!
the referenced thread speaks of READ,
while this thread is about WRITE.
the (il)logic error is obvious,
and with a little reading the TS will probably/hopefully
come to understand the problem
that he created with his file definition.
Sumit Jindal,
don't you already have a record in the vsam file prior to opening? |
|
Back to top |
|
|
Sumit Jindal
New User
Joined: 19 Apr 2012 Posts: 8 Location: India
|
|
|
|
yes DBZ, like I mentioned, After creating the KSDS file using IDCAMS.
I have initialized it with a Low value record.
Thanks
Sumit |
|
Back to top |
|
|
Peter cobolskolan
Active User
Joined: 06 Feb 2012 Posts: 104 Location: Sweden
|
|
|
|
Whats so special with your program that you cant post the code, and I mean the Real code?!
I think there is a lot of help available, if we know a bit more, not just guess. |
|
Back to top |
|
|
Sumit Jindal
New User
Joined: 19 Apr 2012 Posts: 8 Location: India
|
|
|
|
Hi, My logic is as below:
(Select Clause for Output file)
Code: |
SELECT FILE-OUT1 ASSIGN TO DD1
ORGANIZATION IS INDEXED
ACCESS IS SEQUENTIAL
RECORD KEY IS <key>
FILE STATUS IS <Status key> |
(Input Sequential File)
Code: |
FD IN-SEQ
DATA RECORD IS INPUT-RECORD.
01 INPUT-RECORD PIC X(10). |
(output VSAM KSDS File)
Code: |
FD FILE-OUT1
DATA RECORD IS OUTPUT-RECORD.
01 OUTPUT-RECORD.
05 OUT1-PRIMARY-KEY PIC X(05).
05 OUT1-DATA PIC X(05).
|
(Program Logic)
Code: |
PERFORM A100-OPEN.
PERFORM B100-READ
UNTIL SEQ-EOF-Y.
PERFORM C100-CLOSE
************************
A100-OPEN.
OPEN I-O FILE-OUT1.
OPEN INPUT IN-SEQ.
************************
B100-READ-FILES.
READ IN-SEQ
AT END
SET SEQ-EOF-Y TO TRUE
GO TO B100-READ-FILES-EXIT
END-READ.
PERFORM D100-WRITE.
***********************
D100-WRITE.
MOVE INPUT-RECORD TO OUTPUT-RECORD
WRITE OUTPUT-RECORD.
*********************** |
Code'd |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why don't you use the FILE-STATUS that you coded? For VSAM files there is an extended file status as well. Good practice to use that also. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Sumit Jindal, have you reveiwed Table 50 in the COBOL Language Reference manual (link at the top of this page)? If not, you might want to review it and then you'll have the answer to your question in your initial post. |
|
Back to top |
|
|
Sumit Jindal
New User
Joined: 19 Apr 2012 Posts: 8 Location: India
|
|
|
|
Hi Robert,
By looking at link you suggested I got, We cant use the WRITE statement in the KSDS & RRDS when File is opened in I-O mode and access is SEQUENTIAL.
Thanks a lot !!!!
---------
Sumit Jindal |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Glad to hear you've learned something, and you have an answer to your query. |
|
Back to top |
|
|
|