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

query to know thow to cal. average time from sequential file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jaspal

New User


Joined: 22 May 2007
Posts: 68
Location: mumbai

PostPosted: Thu May 24, 2007 4:47 pm
Reply with quote

Hi
Is there any utility or a way to take a average of time of n number of Records from a sequential file input time will be given in HHMMSS
and avg time should be also in HHMMSS
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu May 24, 2007 8:57 pm
Reply with quote

Hello and welcome to the forums,

The amount of time will depend on many factors - how many jobs are running in the system, how busy the i/o and cpu, how long the records are and how they are blocked, any access to vsam or database info in the run unit.

If you want to run a very simple benchmark, create your job that will read some number of records (say 5 million) and run it several times at different times of the day/night. After the "open" and before the "close" get the date and times and write them into a file that you MOD onto each run. You could also capture the date/time before the open and after the close to see how much time that takes - it is your statistics file, so you can include whatever you want. After you've run a number of tests, you can analyze the file you've created with your elapsed times.

We're here when there are questions.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu May 24, 2007 9:06 pm
Reply with quote

Dick,
I think you overestimated the question. icon_lol.gif
As per my understanding OP wants to add time records(Records with HHMMSS format) and divide it by count of (time records)..
I was confused at first but when I read second line 3 times, I stopped thinking on it..
Correct me if I am wrong..
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu May 24, 2007 10:05 pm
Reply with quote

Hi Abhijit,

I surely wouldn't say that you are wrong. . . I believe that we still trying to understand the request. . . My understanding is definitely not complete.

I'm confused as to how dividing some "time value" by the number/count of time records yields a meaningful result.

Maybe jaspal will provide some clarification. Some sort of example(s) would be most helpful.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu May 24, 2007 10:18 pm
Reply with quote

Agreeing with Abhijit, I'm reading it a the average elapsed times from various records.....
Back to top
View user's profile Send private message
jaspal

New User


Joined: 22 May 2007
Posts: 68
Location: mumbai

PostPosted: Fri May 25, 2007 10:58 am
Reply with quote

HI ALL

Agkshirsagar got it
i'll explain by an example

lets have a sequential file with 500 records

SUB-ID ACQ-PROC PROCESS-TIME
1) 111110 10000001 10:10:40
2) 111111 10000001 10:11:36

I M CONSIDERING TWO RECORDS

AS I HAVE DECLARED THE ARRAY AND WILL MOVE SUB-ID,ACQ-PROC ,PROCESS-TIME AND OTHER REQUIRED FIELDS
NOW I HAVE TO TAKE AN AVERAGE AND MOVE IT TO WORKING STORAGE VARIABLES

AVG SHOULD BE 10:11:08

REGARDS,
JASPAL
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri May 25, 2007 12:07 pm
Reply with quote

Below code will work for averaging 2 times, I have tried to give you the
logic, change it as per your requirement. I really don't know if there are any intrinsic functions for 'time' in COBOL.
Code:
       IDENTIFICATION DIVISION.               
       PROGRAM-ID. TESTPROG.                 
       ENVIRONMENT DIVISION.                 
       DATA DIVISION.                         
       WORKING-STORAGE SECTION.               
       01 TIME-VAR1 VALUE '101040'.           
          05 HR1 PIC 99.                     
          05 MI1 PIC 99.                     
          05 SE1 PIC 99.                     
       01 TIME-VAR2 VALUE '101136'.           
          05 HR2 PIC 99.                     
          05 MI2 PIC 99.                     
          05 SE2 PIC 99.                     
       01 AVG-TIME VALUE '000000000'.         
          05 HR3 PIC 999.                     
          05 MI3 PIC 999.                     
          05 SE3 PIC 999.                     
       01 TEMP PIC 99.                       
        PROCEDURE DIVISION.                                 
             COMPUTE SE3 = SE1 + SE2.                       
             IF SE3 > 60                                     
               MOVE 0 TO TEMP                               
               DIVIDE SE3 BY 60 GIVING TEMP REMAINDER SE3   
               ADD TEMP TO MI3                               
             COMPUTE MI3 = MI1 + MI2 + MI3                   
             IF MI3 > 60                                     
               MOVE 0 TO TEMP                               
               DIVIDE MI3 BY 60 GIVING TEMP REMAINDER MI3   
               ADD TEMP TO HR3                               
             END-IF.                                         
             COMPUTE HR3 = HR1 + HR2 + HR3                   
             COMPUTE HR3 = HR3 / 2                           
             COMPUTE MI3 = MI3 / 2                           
             COMPUTE SE3 = SE3 /2                           
             DISPLAY HR3 ':' MI3 ':' SE3
when I run the program it gave me 010:011:008.

[/code]
Back to top
View user's profile Send private message
jaspal

New User


Joined: 22 May 2007
Posts: 68
Location: mumbai

PostPosted: Fri May 25, 2007 3:35 pm
Reply with quote

thanks Agkshirsagar
i'll try if it serves my 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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top