MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Testing of DB2 updateable COBOL program

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
syandra
Beginner


Joined: 26 May 2003
Posts: 19
Topics: 6

PostPosted: Mon Jul 07, 2003 4:07 am    Post subject: Testing of DB2 updateable COBOL program Reply with quote

Hi all,

I have a problem with testing the COBOL programs that update DB2 tables. Actually we are upgrading to OS390 from COBOL-II and making some small changes to it. While testing we run both the versions and compare the outputs. Till now we have no problem. Now I come a across a DB2 module that updates.

I thought of adding some code that can take backup of the table immediately after the query and then rollback the tables. But I don't know how to take a backup of the table to a PS file. Can any one help regarding this. Any other ideas are welcomed.

Thanks a lot,
Sukumar
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Mon Jul 07, 2003 5:10 am    Post subject: Reply with quote

Sukumar,

You can use DSNTIAUL is a sample unload program of DB2 which can be used as a backup of your table to a flat file before the update. This program, which is written in assembler language, unloads some or all rows from up to 100 DB2 tables. With DSNTIAUL, you can unload data of any DB2 built-in data type or distinct type. You can unload up to 32KB of data from a LOB column. DSNTIAUL unloads the rows in a form that is compatible with the LOAD utility and generates utility control statements for LOAD. DSNTIAUL also lets you execute any SQL non-SELECT statement that can be executed dynamically.

Check this link for examples of unloading of the tables using DSNTIAUL

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNAPH11/APPENDIX1.3.1?DT=20010710165542

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
syandra
Beginner


Joined: 26 May 2003
Posts: 19
Topics: 6

PostPosted: Tue Jul 08, 2003 1:26 am    Post subject: Reply with quote

Hi,

Thanks Kolusu.

I have to run two programs on the same set of databases. I tired the following steps :
1. Take the backup of the table( the program updates) to a flat file(FILE1).
2. Run the COBOL-II program.
3. Take the backup of the updated table to another flat file(FILE2).
4. Restore the original table back from the falt file(FILE1).
5. Run the OS390 program.
6. Take the backup of the updated table to another flat file(FILE3).
7. Restore the original table back from the falt file(FILE1).
8. Compare the flat file FILE2 and FILE3 to see the updates are done properly.

But the above stategy did not work for me as I loose some data in other tables which have referential integrity with the table I am work on. Crying or Very sad

Can u suggest any other alternative.

I planned to add cobol code to take the backup of the table after the update is finished and then perform ROLLBACK operation to restore the tables without any data loss.
But I don't know how to take backup to flat file using COBOL. Can u help regarding this.

Does this work for me Question

Thanks
Sukumar
Back to top
View user's profile Send private message
bidpar
Beginner


Joined: 08 Jan 2003
Posts: 28
Topics: 4
Location: india

PostPosted: Tue Jul 08, 2003 3:37 am    Post subject: Reply with quote

sukumar

I dont know a way of taking a backup of table from cobol program. But you can declar a cursor on the table with all the columns. Before rolling back fetch the cursor and write to a file until end-of-cursor.

Probably you have to unload and load all the tables with which your table has referential integrity if you are going by Kolusu's method.

You may also try imagecopy and recover instead of load - unload if you have necessary authority.

Regards
Bidpar
Back to top
View user's profile Send private message
syandra
Beginner


Joined: 26 May 2003
Posts: 19
Topics: 6

PostPosted: Tue Jul 08, 2003 7:16 am    Post subject: Reply with quote

Hi,

Thanku very much. Laughing

Sukumar
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group