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 

Improving performance of Cobol-DB2 program

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


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Fri Dec 09, 2011 10:10 am    Post subject: Improving performance of Cobol-DB2 program Reply with quote

I have one program which reads data from DB2 table for particular date through cursor and loads every records into VSAM file and prints every record into a sysout report. At some days there will be huge data fetched through cursor(around 20L records), because of this program is running for longer duration around 2 hours.

I would like to know if we keep an unload step before the program to unload the records fetched through cursor and in the program load the VSAM file using above unloaded file; will this improve the performance.

Or please suggest any good solution which will increase performance.
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Dec 09, 2011 11:19 am    Post subject: Reply with quote

psmadhusudhan,

Why are you printing every record in the sysout? You are filling up the spool with your displays. An unload and simple REPRO would be an easy solution and also have a good performance.

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Dec 09, 2011 1:46 pm    Post subject: Reply with quote

and instead of sysout,
you have the intermediate file between the unload and repro
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Mon Dec 12, 2011 4:54 am    Post subject: Reply with quote

If generating the SYSOUT report is necessary, may be, use an internal COBOL-table and instead of priting one by one record - prtint the table at one go - it might save some I/Os possibly... .
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Mon Dec 12, 2011 7:56 pm    Post subject: Reply with quote

Thanks all for your suggestions.
I need intermediate file because their are some checks need to be done and some formatting before loading into VSAM file.
Anyways I will try to do the checks through SORT. I wll work on the solution and let you know.
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Tue Dec 13, 2011 12:19 am    Post subject: Reply with quote

Until the complete requirement is understood, there cannot be really useful suggestions on the implementation.

If you keep adding "things" that must be part of the process, earlier suggestions will probably be negated.

Once you explain "everyting" than must be accomplished, better suggestions can be offered. You are trying to get help with performance, but have not provided anything consistent for us to use to help you.
_________________
All the best,

di


Last edited by papadi on Thu Dec 15, 2011 12:39 am; edited 1 time in total
Back to top
View user's profile Send private message
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Tue Dec 13, 2011 4:09 am    Post subject: Reply with quote

Reading your (OP) latest post and everything what papadi says make sense - it's hard to hit a moving target!
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Wed Dec 14, 2011 7:08 am    Post subject: Reply with quote

I have to do below processing with the unload file.

For every record of unload file read VSAM file with unload key
> If record is already present in VSAM I need to update the VSAM record with adding some non key fields of VSAM and Unload file.
> If no record found in VSAM file then Write the record in VSAM file.

There might be duplicates in Unload file on Key combination.

Please suggest if it is possible to do above logic in Easytrieve.
I have started writing Easytrieve program through matching technique, but couldn't get the logic of rewriting the VSAM record if it gets matched.
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Thu Dec 15, 2011 12:42 am    Post subject: Reply with quote

How/why did we make the leap to Easytrieve . . . Confused

Yes, this can be done in Easytrieve as well as COBOL (or lots of other languages).

In any language, i believe you have already shown the process.

Unload the data.
Read the data handling duplicates as need be.
Update existing records and Write new records into the file.
_________________
All the best,

di


Last edited by papadi on Fri Dec 16, 2011 1:36 am; edited 1 time in total
Back to top
View user's profile Send private message
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Fri Dec 16, 2011 12:41 am    Post subject: Reply with quote

Hi can we do matching between sequential file and VSAM file; update VSAM file if matched and write into VSAM file if not matched
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Fri Dec 16, 2011 1:37 am    Post subject: Reply with quote

Yes, why might there be a doubt?

I do not believe i understand the problem/question Embarassed
_________________
All the best,

di
Back to top
View user's profile Send private message
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Sun Dec 18, 2011 9:07 am    Post subject: Reply with quote

Hi All,

I tried matching sequential file and VSAM ; if matched tried updating VSAM but I am getting below error
Code:

PROGRAMS AND ALL SUPPORTING MATERIALS COPYRIGHT (C) 19
     1 PARM DEBUG(FLOW)                               
     2 *                                             
     3 FILE RWSD1 FB (74 27972)                       
     4  RWSD1-KEY             1  58   A               
     5   RWSD1-ORG            1   3   N               
     6   RWSD1-TYPE           4   3   N               
     7   RWSD1-CARD           7  19   A               
     8   RWSD1-TRN-REF-NMBR  26  23   A               
     9   RWSD1-ACODE         49   6   A               
    10   RWSD1-TRN-DATE      55   4   P               
    11   RWSD1-POINTS        59   8   P  2           
    12   RWSD1-PROGRAM       67   4   N               
    13   RWSD1-BP-ID         71   4   N               
                                                     
    14 FILE RWTRPT VS UPDATE                         
    15  RWTRPT-KEY            1  58   A               
16   RWTRPT-ORG           1   3   N                         
17   RWTRPT-TYPE          4   3   N                         
18   RWTRPT-CARD          7  19   A                         
19   RWTRPT-TRN-REF-NMBR 26  23   A                         
20   RWTRPT-ACODE        49   6   A                         
21   RWTRPT-TRN-DATE     55   4   P                         
22   RWTRPT-MILES        59   8   P  2                     
23   RWTRPT-POINTS       67   8   P  2                     
                                                           
24  JOB INPUT (RWSD1  KEY RWSD1-KEY +                       
               RWTRPT KEY RWTRPT-KEY)                       
                                                           
25  IF MATCHED                                             
26     RWTRPT-POINTS = RWTRPT-POINTS + RWSD1-POINTS         
27     WRITE RWTRPT UPDATE                                 
27 *******B054 NOT A VALID FILE - RWTRPT                   
28  END-IF

_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Mon Dec 19, 2011 12:01 am    Post subject: Reply with quote

Does this fail on the first attempt to write or has the job run for some time before this error.

What happpens where there is a different number of records in each file?

Why try to use MATCHED when you could read the sequential file and then difrectly read the vsam file by the key from the sequential record?
_________________
All the best,

di
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Dec 19, 2011 12:41 pm    Post subject: Reply with quote

psmadhusudhan,

By now you should have known that you can't IF matched logic on a VSAM for rewriting.

Here is an untested program written purely based on my memory. So use it with caution. Use code tags so that the spacing is retained and code is readable.

Code:

FILE RWSD1                                           
     RWSD1-KEY            01  58   A                 
     RWSD1-ORG            01  03   N                 
     RWSD1-TYPE           04  03   N                 
     RWSD1-CARD           07  19   A                 
     RWSD1-TRN-REF-NMBR   26  23   A                 
     RWSD1-ACODE          49  06   A                 
     RWSD1-TRN-DATE       55  04   P                 
     RWSD1-POINTS         59  08   P  2               
     RWSD1-PROGRAM        67  04   N                 
     RWSD1-BP-ID          71  04   N                 
                                                     
FILE RWTRPT VS UPDATE                                 
     RWTRPT-KEY           01  58   A                 
     RWTRPT-ORG           01  03   N                 
     RWTRPT-TYPE          04  03   N                 
     RWTRPT-CARD          07  19   A                 
     RWTRPT-TRN-REF-NMBR  26  23   A                 
     RWTRPT-ACODE         49  06   A                 
     RWTRPT-TRN-DATE      55  04   P                 
     RWTRPT-MILES         59  08   P  2               
     RWTRPT-POINTS        67  08   P  2               
                                                     
  JOB INPUT NULL                                     
                                                     
  GET RWSD1                                           
  DO WHILE NOT EOF RWSD1                             
    READ RWTRPT KEY RWSD1-KEY STATUS                 
    IF RWTRPT:FILE-STATUS EQ 0                     
       RWTRPT-POINTS = RWTRPT-POINTS + RWSD1-POINTS   
       WRITE RWTRPT UPDATE                           
    ELSE                                             
       DISPLAY RWSD1-KEY ' NOT FOUND IN VSAM FILE' 
    END-IF                                           
    GET INFILE                                       
  END-DO                                             
  STOP                                               
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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