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
 

 

update VSAM KSDS file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Amit tandon
Warnings : 1

New User


Joined: 29 Jul 2010
Posts: 6
Location: mumbai

PostPosted: Tue Mar 29, 2011 11:02 pm    Post subject: update VSAM KSDS file
Reply with quote

Hi all,

I have to update vsam ksds file with records based on flat file.

ex:-
flat file I have company code(input file)
01
02
03

and based on company code I need to update account no
like
01 32444
02 26666
03 99999

key is account no (not 01,02,03)

I'm reading like below

read input-file
at end
move 'y' to eof
not at end
move fs-recodrs to ws-records

fs records from input file

in output I need which company code and acount no get updated

output would be like

01 32444
02 26666
03 99999

The problem is reading sequentally read and sequentally update.
My output file is gettng only one record not all 3 .

could you please help me out of this problem

Thanks,
Amit
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Mar 29, 2011 11:24 pm    Post subject: Reply to: update VSAM KSDS file
Reply with quote

Well, I'm not a programmer, but it looks to me as if you'd read one record from the update dataset, start reading the VSAM dataset until you get a hit on the Company Code, update that record, and continue on (presuming there are other records with a matching Company Code). Then, you'll have to return the pointer back to the beginning on the VSAM dataset, read the next update record, and repeat the process.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7999
Location: Bellevue, IA

PostPosted: Tue Mar 29, 2011 11:28 pm    Post subject:
Reply with quote

You're not exactly giving us much to work with, are you? The logic for this is well known:
- Read a sequential record
- Use the key to directly read the VSAM record
- Update the data on the VSAM record
- Rewrite the VSAM record
- Output sequential record (if needed) identifying the change
- Repeat from read until EOF on sequential file

So you have 3 DD statements (sequential input, sequential output report, and VSAM KSDS) with 3 SELECT statements, 3 OPEN, etc.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Wed Mar 30, 2011 2:32 am    Post subject: Reply to: update VSAM KSDS file
Reply with quote

Robert, maybe I misunderstood, but I thought that the poster's indication that the information in the update dataset is not based on the key would mean a brute-force type of approach to this problem, since the key values are unknown ahead of time.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7999
Location: Bellevue, IA

PostPosted: Wed Mar 30, 2011 2:59 am    Post subject:
Reply with quote

Actually, after re-reading the original post, I'm no longer sure it is even possible as stated:
Quote:
and based on company code I need to update account no
like
01 32444
02 26666
03 99999

key is account no (not 01,02,03)
Another post where someone posted without thinking through the problem and did not tell us exactly what is needed.

Amit tandon: post exactly what your input looks like, what the layout of the VSAM file is, a few sample input records and what each of them should do to the VSAM file and what you want for output (if any) other than the VSAM file changes. If you expect to update the VSAM file by changing the primary key values, the only way to do so is to delete the record with the old key and write the record with the new key.
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
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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