IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Update a record in VSAM file twice in a program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Fri Jun 18, 2010 2:39 am
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
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
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
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
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
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
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

Moderator Emeritus


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

PostPosted: Fri Jun 18, 2010 3:00 am
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
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
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
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

Moderator Emeritus


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

PostPosted: Fri Jun 18, 2010 3:18 am
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

Moderator Emeritus


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

PostPosted: Fri Jun 18, 2010 3:20 am
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
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: 2146
Location: At my coffee table

PostPosted: Fri Jun 18, 2010 5:00 am
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

Moderator Emeritus


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

PostPosted: Fri Jun 18, 2010 5:14 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts how to complete the end of a record w... DFSORT/ICETOOL 2
Search our Forums:

Back to Top