View previous topic :: View next topic
|
Author |
Message |
vinay kashyap
New User
Joined: 13 Aug 2008 Posts: 5 Location: US, california
|
|
|
|
hi,
i got two files. one flat and the other is a KSDS. i have to fetch those records from flat file which match with those of KSDS. so every time i read a record from flat file do i need to open/close the KSDS in order to point to the first record? or isnt it necessary?
am new to KSDS concept. |
|
Back to top |
|
|
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
|
|
Hi Vinay,
Welcome to forum
Quote: |
every time i read a record from flat file do i need to open/close the KSDS in order to point to the first record? or isnt it necessary? |
It is not necessary to open/close KSDS File every time
Implement logic this way.
1. Read record from flat file sequentially(put it in loop till end of file).
2. Read randomly record from KSDS File for each record of Flat file
3. Check out status code ie record were present in KSDS File
4. If yes; Process how ever u want If not; By pass that record and next record from flat file
Hope this helps |
|
Back to top |
|
|
vinay kashyap
New User
Joined: 13 Aug 2008 Posts: 5 Location: US, california
|
|
|
|
thanks revel,
i tried opening the KSDS , but am not able to.
The open , itself is failing with a VSAM return code of "39".
i guess , the above return code is for file attribute mismatch,but am not able to figure out where exactly the mismatch is occuring. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
You need to compare a LISTCAT of the VSAM file with the COBOL definition you have provided of the file. There's a mismatch somewhere, and the manual suggests some good starting points:
Quote: |
These attributes include
the organization of the file
(sequential, relative, or indexed), the
prime record key, the alternate record
keys, the code set, the maximum record
size, the record type (fixed or
variable), and the blocking factor. |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
if it is an existing vsam file that is used in production,
any good shop will already have copybooks to define the records.
Most probably, there exists at least 1 batch program that accesses the vsam file.
copy the fd statements from a batch program that works............................. |
|
Back to top |
|
|
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
|
|
Hi Vinay,
Check as Robert said; The VSAM File attributes may mismatch with the Attributes which you mentioned in Application program(its attribute mismatch).
Check it out fallowing info
Code: |
The OPEN statement was unsuccessful because a conflict was detected between the fixed file attributes and the attributes specified for that file in the program. These attributes include the organization of the file (sequential, relative, or indexed), the prime record key, the alternate record keys, the code set, the maximum record size, the record type (fixed or variable), and the blocking factor. |
|
|
Back to top |
|
|
vinay kashyap
New User
Joined: 13 Aug 2008 Posts: 5 Location: US, california
|
|
|
|
yeah.. it an existing VSAM , but it is in my PDS
My fd section is as follows
FILE-CONTROL.
SELECT IN-FILE1 ASSIGN TO INFILE1R.
SELECT IN-FILE2 ASSIGN TO INFILE2R
ORGANIZATION IS INDEXED
ACCESS IS SEQUENTIAL
FILE STATUS IS VSAM-FILE-1-STATUS
RECORD KEY IS IN-FILE2-REC-KEY
SELECT OUT-FILE ASSIGN TO OUTFILEW.
and am trying to open in the following way
OPEN INPUT IN-FILE2.
IF NOT VSAM-OPEN-SUCCESS
MOVE VSAM-FILE-STATUS TO FILE-STATUS
DISPLAY FILE-STATUS-ABEND-MESSAGE
GO TO 1000-END-JOB
END-IF.
"VSAM-OPEN-SUCCESS" has been included in the copybook.
Am getting an RC of 39 |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
Check the size of the VSAM file record and your FD entry ... |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
vinay kashyap wrote: |
yeah.. it an existing VSAM , but it is in my PDS
|
I'm stumped, please clarify. |
|
Back to top |
|
|
vinay kashyap
New User
Joined: 13 Aug 2008 Posts: 5 Location: US, california
|
|
|
|
hi anuj,
I meant to say thaat the VSAM is in my personal location and its not in production . sorry for the mis communication..
in my FD section , i have given only FD IN-FILE2 and defined its record layout. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
in my FD section , i have given only FD IN-FILE2 and defined its record layout |
Vinay,
Do you find any difference in file-attributes mentioned in FD and your actual dataset attributes. As suggested earlier, Compare the COBOL FD, JCL DD card and the LISTCAT output to find out the mismatch.
Thanks,
Arun |
|
Back to top |
|
|
|