View previous topic :: View next topic
|
Author |
Message |
jaspal
New User
Joined: 22 May 2007 Posts: 68 Location: mumbai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Dick,
I think you overestimated the question.
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Agreeing with Abhijit, I'm reading it a the average elapsed times from various records..... |
|
Back to top |
|
|
jaspal
New User
Joined: 22 May 2007 Posts: 68 Location: mumbai
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
jaspal
New User
Joined: 22 May 2007 Posts: 68 Location: mumbai
|
|
|
|
thanks Agkshirsagar
i'll try if it serves my problem |
|
Back to top |
|
|
|