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 a record in VSAM file twice in a program

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

New User


Joined: 03 Apr 2008
Posts: 11
Location: India

PostPosted: Fri Jun 18, 2010 2:19 am    Post subject: Update a record in VSAM file twice in a program
Reply with quote

Hi,

I need to update a record in a VSAM (KSDS) file twice.

Sceneratio:
I have one VSAM and two flat files. Need to read the flat files and update the record when found in the vsam.

Code:
Eg
VSAM
111
222
333
444
666


File 1
111 AAA
222 BBB
333 ABC
666 ZZZ


File 2
333 CCC
555 EEE

Updated VSAM file should be
111 AAA
222 BBB
333 ABCCCC
444
555    EEE
666 ZZZ

But what we find is
Updated VSAM file should be
111 AAA
222 BBB
333    CCC
444
555    EEE
666 ZZZ



Problem:
when i try to update the the record 333 after reading the second file, I am unable to find the ABC details for 333 record. the value ABC is not being commited in the VSAM file.

Hope my question is clear.

Please suggest.

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

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 18, 2010 2:39 am    Post subject:
Reply with quote

Hello,

The code that moves the info from file2 appears to be wiping out the data area. . .

Make sure the code preserves the data from the first update. . .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jun 18, 2010 2:47 am    Post subject:
Reply with quote

either that,
or use a sort product to splice the files,
so there is only one input file.
Back to top
View user's profile Send private message
shobvid

New User


Joined: 03 Apr 2008
Posts: 11
Location: India

PostPosted: Fri Jun 18, 2010 2:47 am    Post subject: Reply to: Update a record in VSAM file twice in a program
Reply with quote

No, when we are reading the VSAM file for the second time to update, we dont see the data being present from the first update. The data is not commited after the first update and after the second read to update. The second read is still showing the initial record with no updates of first update.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jun 18, 2010 2:48 am    Post subject:
Reply with quote

read my previous post,
if you insist that your analysis is true.
Back to top
View user's profile Send private message
shobvid

New User


Joined: 03 Apr 2008
Posts: 11
Location: India

PostPosted: Fri Jun 18, 2010 2:50 am    Post subject:
Reply with quote

Thanks for the option for merging, but we are not interested in that way. We want to know how the program will update it.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jun 18, 2010 2:56 am    Post subject:
Reply with quote

well, then you have to debug your program:

such as listcat for vsam file,
shr options

i assume this 'problem update program' is batch.

Select statement,
FD,
I/O statements,

jcl - dd statements

is this file open to CICS at the same time as the batch update?

and it was not a merge that I suggested. that would result in a file with the number of records = file1 + file2.

my suggestion was to splice, which would reduce the total number of records by the number of duplicates.
Back to top
View user's profile Send private message
shobvid

New User


Joined: 03 Apr 2008
Posts: 11
Location: India

PostPosted: Fri Jun 18, 2010 3:00 am    Post subject:
Reply with quote

Its a batch program. we guess there is some issue with VSAM file handling. Either file definition, access mode or JCL share options.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 18, 2010 3:00 am    Post subject:
Reply with quote

Hello,

Was the status code checked after the update?

What happens if you run a test that ends after the first update of the problem record? Is the update still there or does the first update fail?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jun 18, 2010 3:02 am    Post subject:
Reply with quote

Redbook - VSAM Demystified in case you have not read it.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jun 18, 2010 3:05 am    Post subject:
Reply with quote

Nah!!!
Mr. Scherrer wrote:
The code that moves the info from file2 appears to be wiping out the data area. . .


that's the problem, otherwise, none of your first updates would take.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jun 18, 2010 3:11 am    Post subject:
Reply with quote

to follow up.

you obviously know that you are reading file 2,
because of the silliness of
Code:

555    EEE


why, if there is only one entry is it in the second position.

you have a bug!!!!!
it's not the OP-SYS, or your jcl or vsam construct. it is your code.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 18, 2010 3:18 am    Post subject:
Reply with quote

Hello,

Quote:
Either file definition, access mode or JCL share options.
If you insist on these limits, you will probably not find the problem. . .

The code is failing somewhere and the code will need to be changed. . .
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 18, 2010 3:20 am    Post subject: Reply to: Update a record in VSAM file twice in a program
Reply with quote

Hi Dick,

Quote:
that's the problem, otherwise, none of your first updates would take.

The more i see, i wonder if the first update really did. . . Update that is. . .

Maybe more info will follow. . .

d
Back to top
View user's profile Send private message
shobvid

New User


Joined: 03 Apr 2008
Posts: 11
Location: India

PostPosted: Fri Jun 18, 2010 3:41 am    Post subject:
Reply with quote

Thankyou for your help. Its a bug in the program.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Jun 18, 2010 5:00 am    Post subject:
Reply with quote

shobvid wrote:
Thankyou for your help. Its a bug in the program.
Could you please enlighten us as to the 'bug'?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 18, 2010 5:14 am    Post subject:
Reply with quote

Hello,

If you post the problem/solution, it will probably help someone else who has a similar problem some day. . .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jun 18, 2010 6:09 am    Post subject:
Reply with quote

Glad to hear that you have resolved your problem.
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 I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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