Calculate Elapsed Time Callable Routine for Elapsed Times |
The SimoTime Home Page |
This member provides functional specifications by example of the basic functions of the HTMGENER program that generates HTML documents from specifications in an Excel Spreadsheet.
We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.
Copyright © 1987-2023
SimoTime Technologies and Services
All Rights Reserved
This program is a called routine that will calulate two elapsed times. First is the elapsed time since a primary start time. The second is the elapsed time since the routine was previously called. The routine will optionally call the SIMOLOGS routine to display information on the console and wrtite the information to a log file.
WIP
WIP
WIP
WIP
*set dialect(MF) assign(external) nooptional-file IDENTIFICATION DIVISION. PROGRAM-ID. UTTIMEX1. AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * SOURCE MODULE UTTIMEX1.CBL ***************************************************************** * UTTIMEX1 - Caclulates Elapsed Time. * * DESCRIPTION * ----------- * This program is a called routine that will calulate two * elapsed times. * First is the elapsed time since a primary start time. * The second is the elapsed time since the routine was * previously called. * The routine will optionally call the SIMOLOGS routine to * display information on the console and wrtite the information * to a log file. ***************************************************************** * MAINTENANCE * ----------- * 1999/03/89 Simmons, Created program. * 1999/03/89 Simmons, No changes to date. * ***************************************************************** DATA DIVISION. ***************************************************************** WORKING-STORAGE SECTION. 01 FLAGS-FOR-TRAKCALL. 05 FLAG-FOR-DISPLAY pic X value 'N'. 05 FLAG-FOR-JOURNAL pic X value 'N'. 05 FLAG-FOR-STACK pic X value 'N'. 05 FLAG-FOR-KEEP-OPEN pic X value 'Y'. 01 SYSTRAK-OPEN-FLAG pic X value 'N'. 01 FIRST-TIME pic X value 'Y'. 01 INIT-FLAG pic X value 'N'. 01 HEAD-FLAG pic X value 'Y'. 01 ENCODE-FLAG pic X value 'A'. 01 REMAINDER-01 pic 9(5)V99 value 0. 01 REMAINDER-02 pic 9(5)V99 value 0. 01 WORKING-DT. 05 WORKING-DATE. 10 WORKING-DATE-CCYY. 15 WORKING-DATE-CC pic 99. 15 WORKING-DATE-YY pic 99. 10 WORKING-DATE-MM pic 99. 10 WORKING-DATE-DD pic 99. 05 WORKING-TIME. 10 WORKING-TIME-HH pic 99. 10 WORKING-TIME-MM pic 99. 10 WORKING-TIME-SSCC. 15 WORKING-TIME-SS pic 99. 15 WORKING-TIME-CC pic 99. 01 WORKING-SECONDS pic 9(5)V99 value 0. 01 CHD-HEAD-STRING. 05 CHD-USER-ID pic X(16) value 'User Description'. 05 filler pic X value ','. 05 CHD-DATE pic X(12) value 'Current Date'. 05 filler pic X value ','. 05 CHD-TIME pic X(12) value 'Current Time'. 05 filler pic X value ','. 05 CHD-SECONDS-CURRENT pic X(15) value 'Current Seconds'. 05 filler pic X value ','. 05 CHD-SECONDS-EARLIER pic X(15) value 'Segment Seconds'. 05 filler pic X value ','. 05 CHD-SECONDS-PRIMARY pic X(15) value 'Initial Seconds'. 05 filler pic X value ','. 05 CHD-ELAPSED-EARLIER pic X(16) value 'Segment Elapsed'. 05 filler pic X value ','. 05 CHD-ELAPSED-PRIMARY pic X(16) value 'Initial Elapsed'. 05 filler pic X value ','. 01 CSV-TEXT-STRING. 05 CSV-USER-ID pic X(32) value SPACES. 05 filler pic X value ','. 05 CSV-DATE pic X(10) value 'yyyy/nn/nn'. 05 filler pic X value ','. 05 CSV-TIME pic X(11) value 'nn:nn:nn.nn'. 05 filler pic X value ','. 05 CSV-SECONDS-CURRENT pic ZZZZZ.99. 05 filler pic X value ','. 05 CSV-SECONDS-EARLIER pic ZZZZZ.99. 05 filler pic X value ','. 05 CSV-SECONDS-PRIMARY pic ZZZZZ.99. 05 filler pic X value ','. 05 CSV-ELAPSED-EARLIER pic ZZZZZ.99. 05 filler pic X value ','. 05 CSV-ELAPSED-PRIMARY pic ZZZZZ.99. 05 filler pic X value ','. 01 ST-ELAPSED-TIME-GROUP. 05 ST-ELAPSED-TIME. 10 ST-ELAPSED-TIME-HH pic 99. 10 ST-ELAPSED-TIME-MM pic 99. 10 ST-ELAPSED-TIME-SSCC-GROUP. 15 ST-ELAPSED-TIME-SS pic 99. 15 ST-ELAPSED-TIME-CC pic 99. 10 ST-ELAPSED-TIME-SSCC pic 99v99. COPY PASSPL4K. COPY PASSLOGS. COPY ASCEBCB1. ***************************************************************** LINKAGE SECTION. COPY UTTIMEB1. ***************************************************************** PROCEDURE DIVISION using UTTIMEX1-PASS-AREA. * The following will cause the ANIMATOR to be started. By * using the View, Debug Windows and Call Stack you can see * the call progression that got you here. * * call 'CBL_DEBUGBREAK' move 'A' to ENCODE-FLAG evaluate UTTIMEX1-REQUEST when 'LOGB' move 'BOTH' to SIMOLOGS-REQUEST when 'LOGD' move 'SHOW' to SIMOLOGS-REQUEST when 'LOGF' move 'FILE' to SIMOLOGS-REQUEST when 'TRAK' move ST-CURR-DT to ST-SEGM-DT perform DO-CURR-REQUEST perform CALCULATE-ELPASED-TIME when 'INIT' perform DO-INIT-REQUEST when 'CURR' perform GET-CURRENT-DATE-TIME when 'FULL' perform CALCULATE-ELPASED-SECONDS-FULL when 'PART' continue when other perform TRY-EBCDIC end-evaluate if UTTIMEX1-REQUEST = 'FULL' if HEAD-FLAG = 'Y' move 'PUT ' to PA-PL4K-REQUEST move CHD-HEAD-STRING to PA-PL4K-STORAGE call 'SIMOPL4K' using PASS-AREA-PL4K move 'N' to HEAD-FLAG end-if move UTTIMEX1-USER-ID to CSV-USER-ID move ST-CURR-SECONDS to CSV-SECONDS-CURRENT move ST-SEGM-SECONDS to CSV-SECONDS-EARLIER move ST-INIT-SECONDS to CSV-SECONDS-PRIMARY if SIMOLOGS-REQUEST = SPACES move 'PUT ' to PA-PL4K-REQUEST end-if move CSV-TEXT-STRING to PA-PL4K-STORAGE call 'SIMOPL4K' using PASS-AREA-PL4K end-if if ENCODE-FLAG = 'E' inspect UTTIMEX1-PASS-AREA converting A-INFO to E-INFO end-if GOBACK. ***************************************************************** GET-CURRENT-DATE-TIME. perform GET-WORKING-DATE-AND-TIME add WORKING-SECONDS to ZERO giving ST-CURR-SECONDS move WORKING-DATE to ST-CURR-DATE move WORKING-TIME to ST-CURR-TIME exit. ***************************************************************** TRY-EBCDIC. inspect UTTIMEX1-PASS-AREA converting E-INFO to A-INFO move 'E' to ENCODE-FLAG move UTTIMEX1-USER-ID to CSV-USER-ID evaluate UTTIMEX1-REQUEST when 'LOGB' move 'BOTH' to SIMOLOGS-REQUEST when 'LOGD' move 'SHOW' to SIMOLOGS-REQUEST when 'LOGF' move 'FILE' to SIMOLOGS-REQUEST when 'INIT' perform DO-INIT-REQUEST when 'TRAK' move ST-CURR-DT to ST-SEGM-DT perform DO-CURR-REQUEST perform CALCULATE-ELPASED-TIME when other add 16 to ZERO giving RETURN-CODE end-evaluate exit. ***************************************************************** DO-CURR-REQUEST. if INIT-FLAG = 'N' perform DO-INIT-REQUEST else perform GET-WORKING-DATE-AND-TIME move WORKING-DT to ST-CURR-DT end-if exit. ***************************************************************** DO-INIT-REQUEST. perform GET-WORKING-DATE-AND-TIME move WORKING-DT to ST-INIT-DT move WORKING-DT to ST-SEGM-DT move WORKING-DT to ST-CURR-DT perform CALCULATE-SECS-SINCE-MIDNIGHT move ZEROES to ST-CURR-MINUS-PREV move ZEROES to ST-CURR-MINUS-INIT move ZEROES to ST-ELAPSED-TIME move 'Y' to INIT-FLAG exit. ***************************************************************** CALCULATE-SECS-SINCE-MIDNIGHT. if ST-CURR-TIME is NUMERIC compute ST-CURR-SECONDS = ST-CURR-TIME-HH * 3600 + ST-CURR-TIME-MM * 60 + ST-CURR-TIME-SS + ST-CURR-TIME-CC / 100 end-if if ST-SEGM-TIME is NUMERIC compute ST-SEGM-SECONDS = ST-SEGM-TIME-HH * 3600 + ST-SEGM-TIME-MM * 60 + ST-SEGM-TIME-SS + ST-SEGM-TIME-CC / 100 end-if if ST-INIT-TIME is NUMERIC compute ST-INIT-SECONDS = ST-INIT-TIME-HH * 3600 + ST-INIT-TIME-MM * 60 + ST-INIT-TIME-SS + ST-INIT-TIME-CC / 100 end-if move ST-CURR-SECONDS to CSV-SECONDS-CURRENT move ST-SEGM-SECONDS to CSV-SECONDS-EARLIER move ST-INIT-SECONDS to CSV-SECONDS-PRIMARY exit. ***************************************************************** CALCULATE-ELPASED-SECONDS. if ST-CURR-SECONDS > ST-SEGM-SECONDS subtract ST-SEGM-SECONDS from ST-CURR-SECONDS giving ST-CURR-MINUS-PREV else move ZEROES to ST-CURR-MINUS-PREV end-if divide ST-CURR-MINUS-PREV by 3600 giving ST-ELAPSED-TIME-HH remainder REMAINDER-01 divide REMAINDER-01 by 60 giving ST-ELAPSED-TIME-MM remainder REMAINDER-02 compute ST-ELAPSED-TIME-SSCC = REMAINDER-02 * 100 if ST-CURR-SECONDS > ST-INIT-SECONDS and INIT-FLAG ='Y' subtract ST-INIT-SECONDS from ST-CURR-SECONDS giving ST-CURR-MINUS-INIT else move ZEROES to ST-CURR-MINUS-INIT end-if move ST-CURR-MINUS-PREV to CSV-ELAPSED-EARLIER move ST-CURR-MINUS-INIT to CSV-ELAPSED-PRIMARY exit. ***************************************************************** CALCULATE-ELPASED-SECONDS-FULL. perform GET-CURRENT-DATE-TIME if ST-INIT-SECONDS > ST-CURR-SECONDS move ZEROES to ST-CURR-MINUS-INIT else subtract ST-INIT-SECONDS from ST-CURR-SECONDS giving ST-CURR-MINUS-INIT end-if divide ST-CURR-MINUS-INIT by 3600 giving ST-ELAPSED-TIME-HH remainder REMAINDER-01 divide REMAINDER-01 by 60 giving ST-ELAPSED-TIME-MM remainder REMAINDER-02 compute ST-ELAPSED-TIME-SSCC = REMAINDER-02 * 100 move ST-CURR-MINUS-INIT to CSV-ELAPSED-PRIMARY * * Calculate Segment values if ST-SEGM-SECONDS > ST-CURR-SECONDS move ZEROES to ST-CURR-MINUS-PREV else subtract ST-SEGM-SECONDS from ST-CURR-SECONDS giving ST-CURR-MINUS-PREV end-if divide ST-CURR-MINUS-PREV by 3600 giving ST-ELAPSED-TIME-HH remainder REMAINDER-01 divide REMAINDER-01 by 60 giving ST-ELAPSED-TIME-MM remainder REMAINDER-02 compute ST-ELAPSED-TIME-SSCC = REMAINDER-02 * 100 move ST-CURR-MINUS-PREV to CSV-ELAPSED-EARLIER exit. ***************************************************************** CALCULATE-ELPASED-TIME. move ZEROES to ST-CURR-SECONDS move ZEROES to ST-SEGM-SECONDS move ZEROES to ST-INIT-SECONDS move ZEROES to ST-CURR-MINUS-PREV move ZEROES to ST-CURR-MINUS-INIT move ZEROES to ST-ELAPSED-TIME perform CALCULATE-SECS-SINCE-MIDNIGHT perform CALCULATE-ELPASED-SECONDS exit. ***************************************************************** GET-WORKING-DATE-AND-TIME. accept WORKING-DATE from DATE YYYYMMDD accept WORKING-TIME from TIME move WORKING-DATE(1:4) to CSV-DATE(1:4) move WORKING-DATE(5:2) to CSV-DATE(6:2) move WORKING-DATE(7:2) to CSV-DATE(9:2) move WORKING-TIME(1:2) to CSV-TIME(1:2) move WORKING-TIME(3:2) to CSV-TIME(4:2) move WORKING-TIME(5:2) to CSV-TIME(7:2) move WORKING-TIME(7:2) to CSV-TIME(10:2) move 0 to CSV-SECONDS-CURRENT if WORKING-TIME is NUMERIC compute WORKING-SECONDS = WORKING-TIME-HH * 3600 + WORKING-TIME-MM * 60 + WORKING-TIME-SS + WORKING-TIME-CC / 100 end-if add WORKING-SECONDS to ZERO giving CSV-SECONDS-CURRENT exit.
WIP
***************************************************************** * UTTIMEB1.CPY - is a COBOL Copy File * * Data Structure or Pass Area used for calling UTTIMEX1. * * Copyright (C) 1987-2019 SimoTime Technologies * * All Rights Reserved * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * ***************************************************************** * UTTIMEB1-REQUEST Type of request, must be one of the * following values. * BOTH - Display message on the console, * Write message to the SYSLOG file. * CURR - Get the current Date/Time * DIFF - CURR minus INIT * SEGM - CURR minus SEGM * INIT - * CALC - * MARK - * TRAK - * UTTIMEB1-RESPOND This is an indicator as to the success * or failure of the request. A value of * zero (0000) indicates the routine was * successful. A non-zero value indicates * a failure. * ST-CURR-SECONDS The number of elapsed seconds since * 0:00:00am (sssss.cc). The precision is * hundreths of a second. The calculation is * based on the content of ST-CURR-TIME * (hhmmsscc). * ***************************************************************** 01 UTTIMEX1-PASS-AREA. 05 UTTIMEX1-REQUEST pic X(4). 05 UTTIMEX1-RESPOND pic 9999. 05 UTTIMEX1-USER-ID pic X(32). 05 UTTIMEX1-MODE pic X(8). 05 ST-CURR-SECONDS pic 9(5)v99. 05 ST-SEGM-SECONDS pic 9(5)v99. 05 ST-INIT-SECONDS pic 9(5)v99. 05 ST-CURR-MINUS-PREV pic 9(5)v99. 05 ST-CURR-MINUS-INIT pic 9(5)v99. 05 ST-CURR-DT. 10 ST-CURR-DATE. 15 ST-CURR-DATE-CCYY. 20 ST-CURR-DATE-CC pic 99. 20 ST-CURR-DATE-YY pic 99. 15 ST-CURR-DATE-MM pic 99. 15 ST-CURR-DATE-DD pic 99. 10 ST-CURR-TIME. 15 ST-CURR-TIME-HH pic 99. 15 ST-CURR-TIME-MM pic 99. 15 ST-CURR-TIME-SSCC. 20 ST-CURR-TIME-SS pic 99. 20 ST-CURR-TIME-CC pic 99. 05 ST-INIT-DT. 10 ST-INIT-DATE. 15 ST-INIT-DATE-CCYY. 20 ST-INIT-DATE-CC pic 99. 20 ST-INIT-DATE-YY pic 99. 15 ST-INIT-DATE-MM pic 99. 15 ST-INIT-DATE-DD pic 99. 10 ST-INIT-TIME. 15 ST-INIT-TIME-HH pic 99. 15 ST-INIT-TIME-MM pic 99. 15 ST-INIT-TIME-SSCC. 20 ST-INIT-TIME-SS pic 99. 20 ST-INIT-TIME-CC pic 99. 05 ST-SEGM-DT. 10 ST-SEGM-DATE. 15 ST-SEGM-DATE-CCYY. 20 ST-SEGM-DATE-CC pic 99. 20 ST-SEGM-DATE-YY pic 99. 15 ST-SEGM-DATE-MM pic 99. 15 ST-SEGM-DATE-DD pic 99. 10 ST-SEGM-TIME. 15 ST-SEGM-TIME-HH pic 99. 15 ST-SEGM-TIME-MM pic 99. 15 ST-SEGM-TIME-SSCC. 20 ST-SEGM-TIME-SS pic 99. 20 ST-SEGM-TIME-CC pic 99. * *** UTTIMEB1 - End-of-Copy File - - - - - - - - - - - UTTIMEB1 * ***************************************************************** *
The purpose of this document is to assist as a tutorial for new programmers or as a quick reference for experienced programmers.
In the world of programming there are many ways to solve a problem. This documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.
SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the Contact, Comment or Feedback section of this document.
Software Agreement and Disclaimer
Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.
SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.
This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.
Note: A SimoTime License is required for the items to be made available on a local system or server.
The following links may be to the current server or to the Internet.
Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.
Explore an Extended List of Software Technologies that are available for review and evaluation. The software technologies (or Z-Packs) provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.
Explore The ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.
Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and/or QSAM files.
The following links will require an internet connect.
This suite of programs and documentation is available to download for review and evaluation purposes. Other uses will require a SimoTime Software License. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.
A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection
Explore The Micro Focus Web Site for more information about products (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.
Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.
This document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.
1. | Send an e-mail to our helpdesk. |
1.1. | helpdesk@simotime.com. |
2. | Our telephone numbers are as follows. |
2.1. | 1 415 763-9430 office-helpdesk |
2.2. | 1 415 827-7045 mobile |
We appreciate hearing from you.
SimoTime Technologies was founded in 1987 and is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.
Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.
Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.
Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com
Return-to-Top |
Calculate Elapsed Time |
Copyright © 1987-2023 SimoTime Technologies and Services All Rights Reserved |
When technology complements business |
http://www.simotime.com |