Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Fetch records from flat file which match with those of KSDS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vinay kashyap

New User


Joined: 13 Aug 2008
Posts: 5
Location: US, california

PostPosted: Mon Sep 15, 2008 2:44 pm    Post subject: Fetch records from flat file which match with those of KSDS
Reply with quote

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
View user's profile Send private message

revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Mon Sep 15, 2008 4:01 pm    Post subject:
Reply with quote

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
View user's profile Send private message
vinay kashyap

New User


Joined: 13 Aug 2008
Posts: 5
Location: US, california

PostPosted: Mon Sep 15, 2008 8:23 pm    Post subject: Reply to: Fetch records from flat file which match with thos
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Mon Sep 15, 2008 8:34 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Mon Sep 15, 2008 8:54 pm    Post subject:
Reply with quote

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
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Tue Sep 16, 2008 9:15 am    Post subject:
Reply with quote

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
View user's profile Send private message
vinay kashyap

New User


Joined: 13 Aug 2008
Posts: 5
Location: US, california

PostPosted: Tue Sep 16, 2008 10:12 am    Post subject:
Reply with quote

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
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Tue Sep 16, 2008 10:36 am    Post subject:
Reply with quote

Check the size of the VSAM file record and your FD entry ...
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Tue Sep 16, 2008 11:05 am    Post subject:
Reply with quote

vinay kashyap wrote:
yeah.. it an existing VSAM , but it is in my PDS
I'm stumped, please clarify.
Back to top
View user's profile Send private message
vinay kashyap

New User


Joined: 13 Aug 2008
Posts: 5
Location: US, california

PostPosted: Tue Sep 16, 2008 1:00 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Tue Sep 16, 2008 1:08 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us