Time conversion 
Author Message
 Time conversion

Does anyone know how to convert the SNNTTIME field in dsect
DFHSNNT to a HHMMSS format that is easily usable for display
purposes?  I think its in STCK format?


                            Anne Arundel Community College
                            301-541-2414



Sun, 26 Sep 1993 04:18:47 GMT  
 Time conversion

Quote:
>Does anyone know how to convert the SNNTTIME field in dsect
>DFHSNNT to a HHMMSS format that is easily usable for display
>purposes?  I think its in STCK format?


>                            Anne Arundel Community College
>                            301-541-2414

The following is a routine we use at the University of Utah to convert
STCK time to a more managable format.  From here you can use CVD and UNPK
to get it into printable form.

-------- example use of dptodcnv ---------
*
MMDDYY  DS      0CL6
MONTH   DS      CL2
DAY     DS      CL2
YEAR    DS      CL2
PWORK   DS      D
SYSDATE DS      D
STORCLK DS      0CL32
CLKYY   DS      F
CLKMM   DS      F
CLKDD   DS      F
        DS      5F
*
        STCK    SYSDATE
        LINK    EP=DPTODCNV,PARAM=(SYSDATE,STORCLK),VL=1
        L       R3,CLKMM
        CVD     R3,PWORK
        UNPK    MONTH,PWORK
        OI      MONTH+1,X'F0'
*
-------- example use of dptodcnv ---------

DPTODCNV TITLE 'DPTODCNV - CONVERT TOD CLOCK VALUE'
*
* DPTODCNV - CONVERT TOD CLOCK VALUE.  THIS PROGRAM IS CALLED USING
*            STANDART LINKAGE CONVENTIONS TO CONVERT AN 8-BYTE TIME OF
*            DAY CLOCK VALUE TO YEAR, MONTH, DAY, HOUR, MINUTE, AND
*            MICROSECONDS.
*
*            ON ENTRY, REGISTER 1 HAS THE ADDRESS OF A PARAMETER LIST.
*            THE FIRST WORD OF THE PARAMETER LIST IS THE ADDRESS OF THE
*            8-BYTE TIME OF DAY CLOCK VALUE; THE SECOND WORD HAS THE
*            ADDRESS OF THE 8-WORD RETURN AREA.  THIS PROGRAM WILL SET
*            THE RETURN AREA TO THE VALUES:
*
*              4-BYTE BINARY YEAR (0 = THE YEAR 1900)
*              4-BYTE BINARY MONTH (1 TO 12)
*              4-BYTE BINARY DAY OF MONTH (1 TO 31)
*              4-BYTE BINARY HOUR OF DAY (00 TO 23)
*              4-BYTE BINARY MINUTE OF HOUR (00 TO 59)
*              4-BYTE BINARY MICROSECOND OF MINUTE (00 TO 59999999)
*              4-BYTE BINARY DAY OF WEEK (0 TO 6; 0=SUNDAY)
*              4-BYTE BINARY DAY OF YEAR (1 TO 366)
*
*            ON RETURN, THIS PROGRAM SETS REGISTER 15 TO 0 (TO AVOID
*            SOME PROBLEMS WITH THE COBOL RETURN-CODE REGISTER).
*
*   BY M. QUINLAN - UNIVERSITY OF UTAH
*  
*
         EJECT
DPTODCNV PGMSTART SA=SA,PGMBASE=REG12,PARMREG=REG11
         EJECT
*
* CNVRTTOD - CONVERT THE TOD VALUE.
*
*            THIS CODE IS DERIVED FROM THE "TODEBCD" ROUTINE IN THE
*            DFHXMOLS PROGRAM DISTRIBUTED WITH CICS RELEASE 1.5.
*
CNVRTTOD EQU   *
         L     REG14,0(REG11)      GET ADDRESS OF TOD VALUE
         SPACE 1
* CONVERT TOD VALUE TO DAYS SINCE DAY 0, HOURS IN DAY, MINUTES IN HOUR,
* AND MICROSECONDS IN MINUTE.  DAY 0 IS JAN 1, 1900.
         LM    REG0,REG1,0(REG14)  GET TOD VALUE
         SRDL  REG0,12             CONVERT VALUE TO MICROSECONDS
         D     REG0,=F'60000000'   DIVIDE BY # MICROSEC IN 1 MINUTE
         LR    REG10,REG0          R10=ODD MICROSEC LESS THAN A MINUTE
         SLR   REG0,REG0           CLEAR FOR DIVIDE
         D     REG0,=F'60'         DIVIDE MINUTES BY 60 TO GET HOURS
         LR    REG9,REG0           R9=ODD MINUTES LESS THAN 1 HOUR
         SLR   REG0,REG0           CLEAR FOR DIVIDE
         D     REG0,=F'24'         DIV HRS BY 24 TO GET DYS & ODD HRS
         LR    REG8,REG0           R8=ODD HOURS LESS THAN 1 DAY
         SPACE 1
* REG1 HAS THE NUMBER OF DAYS SINCE DAY 0.
         SPACE 1
* COMPUTE THE DAY OF THE WEEK
         LA    REG3,1(,REG1)       R3=DAY COUNT SINCE SUNDAY LONG PAST
         SLR   REG2,REG2           CLEAR FOR DIVIDE
         D     REG2,=F'7'          R2=DAY OF WEEK (0=SUNDAY -> 6=SAT.)
         ST    REG2,DAYOFWK#       SAVE DAY OF WEEK
         SPACE 1
* NOW COMPUTE THE YEAR NUMBER; REG1 HAS NUMBER OF DAYS SINCE DAY 0.
         SLR   REG7,REG7           ASSUME NOT A LEAP YEAR FOR NOW
         S     REG1,=F'365'        SUBTRACT # OF DAYS IN YR 1900
         BNM   CVTOD010            BRANCH IF YEAR NOT = 1900
* TREAT THE YEAR 1900 AS A SPECIAL CASE
         LA    REG2,365(,REG1)     SET DAY OF YEAR (RELATIVE TO 0)
         SLR   REG5,REG5           SET YEAR = 1900
         B     CVTOD030            GO CALC DAY OF YEAR
* NOT THE YEAR 1900
CVTOD010 EQU   *                   NOT THE YEAR 1900
         SLR   REG0,REG0           CLEAR FOR DIVIDE
         D     REG0,=F'1461'       DIV DYS BY DYS IN 4 YRS ((4*365)+1)
         SLL   REG1,2              MULT BY 4 TO GET YEAR NUMBER
         LA    REG5,1(,REG1)       R5=YRS LESS ODD YRS SINCE 1900
         LR    REG3,REG0           R3=REMAINING DAYS IN 4-YR PERIOD
         SLR   REG2,REG2           CLEAR FOR DIVIDE
         D     REG2,=F'365'        GET # ODD YRS AND # ODD DAYS
         CL    REG3,=F'3'          CHECK FOR LEAP YEAR
         BL    CVTOD020            BRANCH IF NOT A LEAP YEAR
         LA    REG7,1              ADJUST EXTRA DAY REGISTER FOR LEAPYR
         BE    CVTOD020            BRANCH IF NOT LAST DAY OF LEAP YEAR
         BCTR  REG3,0              DECR YEAR TO FORCE IT = 3
         LA    REG2,365            SET FOR LAST DAY OF YR (REL. TO 0)
CVTOD020 EQU   *
         ALR   REG5,REG3           R5 HAS YEARS SINCE 1900
         EJECT
CVTOD030 EQU   *
* R2=DAY OF YEAR (RELATIVE TO ZERO); R7=1 IF LEAP YEAR, 0 OTHERWISE
* COMPUTE THE MONTH AND DAY OF MONTH.  THIS CODE USES SOME MAGIC
* NUMBERS TO FIGURE OUT WHAT THE MONTH AND DAY OF MONTH ARE; IT IS
* COPIES FROM THE DFHXMOLS PROGRAM.
         LA    REG2,1(,REG2)       MAKE DAY OF YR RELATIVE TO 1
         ST    REG2,DAYOFYR        SAVE THE DAY OF THE YEAR
         LA    REG1,59(,REG7)      R1=60 IF LEAPYR; 59 OTHERWISE
         CLR   REG2,REG1           IS THE DATE PAST FEBRUARY?
         BNH   CVTOD040            NO: LET DATE STAND AS IS
         LA    REG2,2(,REG2)       SET FOR NON-LEAPYEAR INITIALLY
         SLR   REG2,REG7           SUBTRACT 1 IF A LEAP YEAR
CVTOD040 EQU   *
         LA    REG3,91(,REG2)      R3=DAY OF YEAR + 91
         LR    REG7,REG3           COPY FOR LATER
         M     REG2,=F'2145'       MAGIC NUMBER
         SRL   REG3,16             DIV BY 65536 TO GET MONTH NUMBER+2
         LR    REG6,REG3           R6=MONTH NUMBER + 2
         S     REG6,=F'2'          R6=MONTH NUMBER
         M     REG2,=F'1955'       ANOTHER MAGIC NUMBER
         SRL   REG3,6              DIV BY 64 GET TOT DYS IN PAST MON+91
         SLR   REG7,REG3           R7 = DAY OF MONTH
         EJECT
*
* REG5     = YEAR NUMBER            (0 = 1900)
* REG6     = MONTH NUMBER           (1 TO 12)
* REG7     = DAY OF MONTH           (1 TO 31)
* REG8     = HOUR OF DAY            (0 TO 23)
* REG9     = MINUTE OF HOUR         (0 TO 59)
* REG10    = MICROSECONDS OF MINUTE (0 TO 59999999)
* DAYOFWK# = DAY OF WEEK            (0 TO 6; 0=SUNDAY)
* DAYOFYR  = DAY OF YEAR            (1 TO 366)
*
         SPACE 1
* RETURN THE TIME VALUES TO THE CALLER
         L     REG1,4(,REG11)      GET RETURN AREA ADDRESS
         STM   REG5,REG10,0(REG1)  SET RETURN AREA VALUES
         MVC   24(4,REG1),DAYOFWK# RETURN DAY OF WEEK VALUE
         MVC   28(4,REG1),DAYOFYR  RETURN DAY OF YEAR VALUE
         SPACE 1
* RETURN TO THE CALLER
         L     REG13,4(,REG13)     RESTORE OLD SAVE AREA
         RETURN (14,12),RC=0       RETURN TO THE CALLER
         EJECT
*
* DATA AREAS
*
         LTORG
SA       DC    9D'0'
DAYOFWK# DC    F'-1'
DAYOFYR  DC    F'-1'
         END



Sun, 26 Sep 1993 00:20:16 GMT  
 Time conversion


Quote:
>Does anyone know how to convert the SNNTTIME field in dsect
>DFHSNNT to a HHMMSS format that is easily usable for display
>purposes?  I think its in STCK format?


>                            Anne Arundel Community College
>                            301-541-2414

The following is a routine we use at the University of Utah to convert
STCK time to a more managable format.  From here you can use CVD and UNPK
to get it into printable form.

-------- example use of dptodcnv ---------
*
MMDDYY  DS      0CL6
MONTH   DS      CL2
DAY     DS      CL2
YEAR    DS      CL2
PWORK   DS      D
SYSDATE DS      D
STORCLK DS      0CL32
CLKYY   DS      F
CLKMM   DS      F
CLKDD   DS      F
        DS      5F
*
        STCK    SYSDATE
        LINK    EP=DPTODCNV,PARAM=(SYSDATE,STORCLK),VL=1
        L       R3,CLKMM
        CVD     R3,PWORK
        UNPK    MONTH,PWORK
        OI      MONTH+1,X'F0'
*
-------- example use of dptodcnv ---------

DPTODCNV TITLE 'DPTODCNV - CONVERT TOD CLOCK VALUE'
*
* DPTODCNV - CONVERT TOD CLOCK VALUE.  THIS PROGRAM IS CALLED USING
*            STANDART LINKAGE CONVENTIONS TO CONVERT AN 8-BYTE TIME OF
*            DAY CLOCK VALUE TO YEAR, MONTH, DAY, HOUR, MINUTE, AND
*            MICROSECONDS.
*
*            ON ENTRY, REGISTER 1 HAS THE ADDRESS OF A PARAMETER LIST.
*            THE FIRST WORD OF THE PARAMETER LIST IS THE ADDRESS OF THE
*            8-BYTE TIME OF DAY CLOCK VALUE; THE SECOND WORD HAS THE
*            ADDRESS OF THE 8-WORD RETURN AREA.  THIS PROGRAM WILL SET
*            THE RETURN AREA TO THE VALUES:
*
*              4-BYTE BINARY YEAR (0 = THE YEAR 1900)
*              4-BYTE BINARY MONTH (1 TO 12)
*              4-BYTE BINARY DAY OF MONTH (1 TO 31)
*              4-BYTE BINARY HOUR OF DAY (00 TO 23)
*              4-BYTE BINARY MINUTE OF HOUR (00 TO 59)
*              4-BYTE BINARY MICROSECOND OF MINUTE (00 TO 59999999)
*              4-BYTE BINARY DAY OF WEEK (0 TO 6; 0=SUNDAY)
*              4-BYTE BINARY DAY OF YEAR (1 TO 366)
*
*            ON RETURN, THIS PROGRAM SETS REGISTER 15 TO 0 (TO AVOID
*            SOME PROBLEMS WITH THE COBOL RETURN-CODE REGISTER).
*
*   BY M. QUINLAN - UNIVERSITY OF UTAH
*
*
         EJECT
DPTODCNV PGMSTART SA=SA,PGMBASE=REG12,PARMREG=REG11
         EJECT
*
* CNVRTTOD - CONVERT THE TOD VALUE.
*
*            THIS CODE IS DERIVED FROM THE "TODEBCD" ROUTINE IN THE
*            DFHXMOLS PROGRAM DISTRIBUTED WITH CICS RELEASE 1.5.
*
CNVRTTOD EQU   *
         L     REG14,0(REG11)      GET ADDRESS OF TOD VALUE
         SPACE 1
* CONVERT TOD VALUE TO DAYS SINCE DAY 0, HOURS IN DAY, MINUTES IN HOUR,
* AND MICROSECONDS IN MINUTE.  DAY 0 IS JAN 1, 1900.
         LM    REG0,REG1,0(REG14)  GET TOD VALUE
         SRDL  REG0,12             CONVERT VALUE TO MICROSECONDS
         D     REG0,=F'60000000'   DIVIDE BY # MICROSEC IN 1 MINUTE
         LR    REG10,REG0          R10=ODD MICROSEC LESS THAN A MINUTE
         SLR   REG0,REG0           CLEAR FOR DIVIDE
         D     REG0,=F'60'         DIVIDE MINUTES BY 60 TO GET HOURS
         LR    REG9,REG0           R9=ODD MINUTES LESS THAN 1 HOUR
         SLR   REG0,REG0           CLEAR FOR DIVIDE
         D     REG0,=F'24'         DIV HRS BY 24 TO GET DYS & ODD HRS
         LR    REG8,REG0           R8=ODD HOURS LESS THAN 1 DAY
         SPACE 1
* REG1 HAS THE NUMBER OF DAYS SINCE DAY 0.
         SPACE 1
* COMPUTE THE DAY OF THE WEEK
         LA    REG3,1(,REG1)       R3=DAY COUNT SINCE SUNDAY LONG PAST
         SLR   REG2,REG2           CLEAR FOR DIVIDE
         D     REG2,=F'7'          R2=DAY OF WEEK (0=SUNDAY -> 6=SAT.)
         ST    REG2,DAYOFWK#       SAVE DAY OF WEEK
         SPACE 1
* NOW COMPUTE THE YEAR NUMBER; REG1 HAS NUMBER OF DAYS SINCE DAY 0.
         SLR   REG7,REG7           ASSUME NOT A LEAP YEAR FOR NOW
         S     REG1,=F'365'        SUBTRACT # OF DAYS IN YR 1900
         BNM   CVTOD010            BRANCH IF YEAR NOT = 1900
* TREAT THE YEAR 1900 AS A SPECIAL CASE
         LA    REG2,365(,REG1)     SET DAY OF YEAR (RELATIVE TO 0)
         SLR   REG5,REG5           SET YEAR = 1900
         B     CVTOD030            GO CALC DAY OF YEAR
* NOT THE YEAR 1900
CVTOD010 EQU   *                   NOT THE YEAR 1900
         SLR   REG0,REG0           CLEAR FOR DIVIDE
         D     REG0,=F'1461'       DIV DYS BY DYS IN 4 YRS ((4*365)+1)
         SLL   REG1,2              MULT BY 4 TO GET YEAR NUMBER
         LA    REG5,1(,REG1)       R5=YRS LESS ODD YRS SINCE 1900
         LR    REG3,REG0           R3=REMAINING DAYS IN 4-YR PERIOD
         SLR   REG2,REG2           CLEAR FOR DIVIDE
         D     REG2,=F'365'        GET # ODD YRS AND # ODD DAYS
         CL    REG3,=F'3'          CHECK FOR LEAP YEAR
         BL    CVTOD020            BRANCH IF NOT A LEAP YEAR
         LA    REG7,1              ADJUST EXTRA DAY REGISTER FOR LEAPYR
         BE    CVTOD020            BRANCH IF NOT LAST DAY OF LEAP YEAR
         BCTR  REG3,0              DECR YEAR TO FORCE IT = 3
         LA    REG2,365            SET FOR LAST DAY OF YR (REL. TO 0)
CVTOD020 EQU   *
         ALR   REG5,REG3           R5 HAS YEARS SINCE 1900
         EJECT
CVTOD030 EQU   *
* R2=DAY OF YEAR (RELATIVE TO ZERO); R7=1 IF LEAP YEAR, 0 OTHERWISE
* COMPUTE THE MONTH AND DAY OF MONTH.  THIS CODE USES SOME MAGIC
* NUMBERS TO FIGURE OUT WHAT THE MONTH AND DAY OF MONTH ARE; IT IS
* COPIES FROM THE DFHXMOLS PROGRAM.
         LA    REG2,1(,REG2)       MAKE DAY OF YR RELATIVE TO 1
         ST    REG2,DAYOFYR        SAVE THE DAY OF THE YEAR
         LA    REG1,59(,REG7)      R1=60 IF LEAPYR; 59 OTHERWISE
         CLR   REG2,REG1           IS THE DATE PAST FEBRUARY?
         BNH   CVTOD040            NO: LET DATE STAND AS IS
         LA    REG2,2(,REG2)       SET FOR NON-LEAPYEAR INITIALLY
         SLR   REG2,REG7           SUBTRACT 1 IF A LEAP YEAR
CVTOD040 EQU   *
         LA    REG3,91(,REG2)      R3=DAY OF YEAR + 91
         LR    REG7,REG3           COPY FOR LATER
         M     REG2,=F'2145'       MAGIC NUMBER
         SRL   REG3,16             DIV BY 65536 TO GET MONTH NUMBER+2
         LR    REG6,REG3           R6=MONTH NUMBER + 2
         S     REG6,=F'2'          R6=MONTH NUMBER
         M     REG2,=F'1955'       ANOTHER MAGIC NUMBER
         SRL   REG3,6              DIV BY 64 GET TOT DYS IN PAST MON+91
         SLR   REG7,REG3           R7 = DAY OF MONTH
         EJECT
*
* REG5     = YEAR NUMBER            (0 = 1900)
* REG6     = MONTH NUMBER           (1 TO 12)
* REG7     = DAY OF MONTH           (1 TO 31)
* REG8     = HOUR OF DAY            (0 TO 23)
* REG9     = MINUTE OF HOUR         (0 TO 59)
* REG10    = MICROSECONDS OF MINUTE (0 TO 59999999)
* DAYOFWK# = DAY OF WEEK            (0 TO 6; 0=SUNDAY)
* DAYOFYR  = DAY OF YEAR            (1 TO 366)
*
         SPACE 1
* RETURN THE TIME VALUES TO THE CALLER
         L     REG1,4(,REG11)      GET RETURN AREA ADDRESS
         STM   REG5,REG10,0(REG1)  SET RETURN AREA VALUES
         MVC   24(4,REG1),DAYOFWK# RETURN DAY OF WEEK VALUE
         MVC   28(4,REG1),DAYOFYR  RETURN DAY OF YEAR VALUE
         SPACE 1
* RETURN TO THE CALLER
         L     REG13,4(,REG13)     RESTORE OLD SAVE AREA
         RETURN (14,12),RC=0       RETURN TO THE CALLER
         EJECT
*
* DATA AREAS
*
         LTORG
SA       DC    9D'0'
DAYOFWK# DC    F'-1'
DAYOFYR  DC    F'-1'
         END



Sun, 26 Sep 1993 06:20:16 GMT  
 Time conversion
On Tue, 9 Apr 91 15:18:47 EST ZPRM000 said:
Quote:
>Does anyone know how to convert the SNNTTIME field in dsect
>DFHSNNT to a HHMMSS format that is easily usable for display
>purposes?  I think its in STCK format?


>                            Anne Arundel Community College
>                            301-541-2414

I have a routine that converts the system clock value to a timestamp...
YYYY-MM-DD-HH.MM.SS.SSSSSS
If I can find it, I will post it.


Sun, 26 Sep 1993 07:12:04 GMT  
 Time conversion

          I have a time program, it gets the timer value from TOD CLOCK,
          and displays following line:

CLOCK xx:xx:xx:xxx:xxx xx, DATE xx/xx/xxxx xxxxxxxxx, ZONE xx:xx:xx/xxxx

      |  |  |  |   |   |        |  |  |    |               |  |  |  |
      |  |  |  |   |   |        |  |  |    |               |  |  |  |
hour --  |  |  |   |   |        |  |  |    |               |  |  |  |
minute ---  |  |   |   |        |  |  |    |               |  |  |  |
second ------  |   |   |        |  |  |    |               |  |  |  |
millisecond ----   |   |        |  |  |    |               |  |  |  |
microsecond --------   |        |  |  |    |               |  |  |  |
am/pm ------------------        |  |  |    |               |  |  |  |
month ---------------------------  |  |    |               |  |  |  |
day of month -----------------------  |    |               |  |  |  |
year ----------------------------------    |               |  |  |  |
day of week --------------------------------               |  |  |  |
hour -------------------------------------------------------  |  |  |
minute --------------------------------------------------------  |  |
second -----------------------------------------------------------  |
west/gmt/east -------------------------------------------------------

(time zone is difference between local time and Greenwich Mean Time)
/**/



Mon, 27 Sep 1993 00:13:22 GMT  
 Time conversion

Quote:

>Does anyone know how to convert the SNNTTIME field in dsect
>DFHSNNT to a HHMMSS format that is easily usable for display
>purposes?  I think its in STCK format?

I have some code I do this with.  I am posting relevant samples here
which are good enough to copy and adapt to stuff.  But if you want to
assemble what I post, you need more of my macros.  You can get them by

address if you have one) or by Anonymous FTP to host vmd.cso.uiuc.edu
(128.174.5.98) and cd to "phil.194".

The first program is a REXX function that gives the clock data in a format
a REXX program can play with easily.  The second program is the macro that
I use to generate code to convert the clock.

:READ RXDATIM ASSEMBLE A
RXDATIM  TITLE 'REXX function to convert TOD value to info'             00001000
*********************************************************************** 00002000
* Copyright:  (C) 1990, Philip David Howard - All rights reserved.    * 00003000
*             Permission is granted to the public to distribute this  * 00004000
*             program unaltered provided that no profit is derived    * 00005000
*             from the distribution and that this permission is not   * 00006000
*             denied to others receiving this program.                * 00007000
*                                                                     * 00008000
* Program:    RXDATIM ASSEMBLE                                        * 00009000
*                                                                     * 00010000
* Function:   datim                                                   * 00011000
*                                                                     * 00012000
* Purpose:    To convert a TOD value in decimal such as that from     * 00013000
*             the tod() function into individual date and time        * 00014000
*             information.                                            * 00015000
*                                                                     * 00016000
* Usage:      info = datim( todvalue )                                * 00017000
*                                                                     * 00018000
*             todvalue - The TOD clock value in decimal.  Value will  * 00019000
*                        be from 0 to 2**63-1.                        * 00020000
*                                                                     * 00021000
*             info     - Date and time information separated by       * 00022000
*                        blanks as follows:                           * 00023000
*                                                                     * 00024000
*                        year         - 1900 to 2042                  * 00025000
*                        month        - 1 to 12                       * 00026000
*                        date         - 1 to 31                       * 00027000
*                        day          - 1 to 7                        * 00028000
*                        hour         - 0 to 23                       * 00029000
*                        minute       - 0 to 59                       * 00030000
*                        second       - 0 to 59                       * 00031000
*                        microseconds - 0 to 999999                   * 00032000
*                                                                     * 00033000
* Program:    No time zone adjustments are made.                      * 00034000
*             Those must be made by the calling program.              * 00035000
*                                                                     * 00036000
* Author:     Philip D. Howard                                        * 00037000
* Post:       Computing Services Office                               * 00038000
*             Digital Computer Lab                                    * 00039000
*             University of Illinois at Urbana-Champaign              * 00040000
*             1304 West Springfield Avenue                            * 00041000
*             Urbana, IL  USA-61801                                   * 00042000
* Phone:      217-244-6246                                            * 00043000

*********************************************************************** 00045000
                                                                 EJECT  00046000
*********************************************************************** 00047000
* General declarations.                                               * 00048000
*********************************************************************** 00049000
         INTREL DATIM,DECINT,I{*filter*}C                                     00050000
RXDATIM  NUCEXT ACODE=GODATIM,ZCODE=ENDATIM,(RXDATIM,GODATIM)           00051000
         USING GODATIM,R12                                              00052000
                                                                 SPACE  00053000
*********************************************************************** 00054000
* Begin main entry point.                                             * 00055000
*********************************************************************** 00056000
GODATIM  STM   R14,R12,SAVER14(R13) preserve registers                  00057000
                                                                 SPACE  00058000
         CLM   R1,B'1000',F5+3     is this a REXX call?                 00059000
         BC    NOT-EQUAL,EXIT4     no --> too bad                       00060000
         LTR   R3,R0               is it a function (not call)?         00061000
         BC    NEG,EXIT4           no --> signal error                  00062000
                                                                 SPACE  00063000
         ICM   R11,B'1111',20(R3)  get evalblok return word address     00064000
         BC    ZERO,EXIT4          zero --> signal error                00065000
                                                                 SPACE  00066000
*********************************************************************** 00067000
* Allocate savearea and evalblok.                                     * 00068000
*********************************************************************** 00069000
         LA    R0,9                size to allocate                     00070000
         DMSFREE DWORDS=(0)        get a work area                      00071000
         ST    R13,SAVEPREV(R1)    link...                              00072000
         ST    R1,SAVENEXT(R13)    ...saveareas                         00073000
         LR    R13,R1              use new save area                    00074000
                                                                 SPACE  00075000
         LA    R9,7                size of EVALBLOK / workarea          00076000
         LR    R0,R9               request size                         00077000
         DMSFREE DWORDS=(0)        get an EVALBLOK / workarea           00078000
         ST    R1,0(,R11)          pass EVALBLOK address to REXX now    00079000
         LR    R11,R1              use in this register                 00080000
         XC    0(8*7,R11),0(R11)   clean it up                          00081000
         ST    R9,4(,R11)          put allocated size in header         00082000
                                                                 SPACE  00083000
*********************************************************************** 00084000
* Convert number to internal binary form then to individual numbers.  * 00085000
*********************************************************************** 00086000
         $IF   NOT-ZERO            if                                   00087000
           ICM   R10,B'1111',16(R3)  arg list is present                00088000
         $AND  NOT-EQUAL           and                                  00089000
           CLI   0(R10),X'FF'        arg list has at least one arg      00090000
         $AND  NOT-ZERO            and                                  00091000
           ICM   R2,B'1111',0(R10)   address is not null                00092000
         $AND  NOT-ZERO            and                                  00093000
           ICM   R3,B'1111',4(R10)   length is not null                 00094000
         $AND  CC0+CC1             and                                  00095000
           DECINT ,                  given number is valid              00096000
         $THEN ,                   then                                 00097000
         $ELSE ,                   else                                 00098000
           STCK  16(R13)             use the current TOD clock          00099000
           LM    R0,R1,16(R13)       as if it were specified            00100000
         $END  ,                                                        00101000
                                                                 SPACE  00102000
         DATIM ,                   >>> convert TOD to various info      00103000
                                                                 SPACE  00104000
         LA    R3,1(,R3)           add one to month                     00105000
         LA    R4,1(,R4)           add one to date                      00106000
         LA    R5,1(,R5)           add one to day                       00107000
         STM   R2,R9,24(R11)       array these numbers                  00108000
                                                                 SPACE  00109000
*********************************************************************** 00110000
* Convert numbers to decimal and build resultant value.               * 00111000
* The binary values will be wiped over by the character values, but   * 00112000
* not until they are no longer needed.  The EVALBLOK overlay is:      * 00113000
*             1   1   2   2   2   3
...

read more »



Mon, 27 Sep 1993 07:01:38 GMT  
 Time conversion

Quote:

>Does anyone know how to convert the SNNTTIME field in dsect
>DFHSNNT to a HHMMSS format that is easily usable for display
>purposes?  I think its in STCK format?

I have some code I do this with.  I am posting relevant samples here
which are good enough to copy and adapt to stuff.  But if you want to
assemble what I post, you need more of my macros.  You can get them by

address if you have one) or by Anonymous FTP to host vmd.cso.uiuc.edu
(128.174.5.98) and cd to "phil.194".

The first program is a REXX function that gives the clock data in a format
a REXX program can play with easily.  The second program is the macro that
I use to generate code to convert the clock.

:READ RXDATIM ASSEMBLE A
RXDATIM  TITLE 'REXX function to convert TOD value to info'             00001000
*********************************************************************** 00002000
* Copyright:  (C) 1990, Philip David Howard - All rights reserved.    * 00003000
*             Permission is granted to the public to distribute this  * 00004000
*             program unaltered provided that no profit is derived    * 00005000
*             from the distribution and that this permission is not   * 00006000
*             denied to others receiving this program.                * 00007000
*                                                                     * 00008000
* Program:    RXDATIM ASSEMBLE                                        * 00009000
*                                                                     * 00010000
* Function:   datim                                                   * 00011000
*                                                                     * 00012000
* Purpose:    To convert a TOD value in decimal such as that from     * 00013000
*             the tod() function into individual date and time        * 00014000
*             information.                                            * 00015000
*                                                                     * 00016000
* Usage:      info = datim( todvalue )                                * 00017000
*                                                                     * 00018000
*             todvalue - The TOD clock value in decimal.  Value will  * 00019000
*                        be from 0 to 2**63-1.                        * 00020000
*                                                                     * 00021000
*             info     - Date and time information separated by       * 00022000
*                        blanks as follows:                           * 00023000
*                                                                     * 00024000
*                        year         - 1900 to 2042                  * 00025000
*                        month        - 1 to 12                       * 00026000
*                        date         - 1 to 31                       * 00027000
*                        day          - 1 to 7                        * 00028000
*                        hour         - 0 to 23                       * 00029000
*                        minute       - 0 to 59                       * 00030000
*                        second       - 0 to 59                       * 00031000
*                        microseconds - 0 to 999999                   * 00032000
*                                                                     * 00033000
* Program:    No time zone adjustments are made.                      * 00034000
*             Those must be made by the calling program.              * 00035000
*                                                                     * 00036000
* Author:     Philip D. Howard                                        * 00037000
* Post:       Computing Services Office                               * 00038000
*             Digital Computer Lab                                    * 00039000
*             University of Illinois at Urbana-Champaign              * 00040000
*             1304 West Springfield Avenue                            * 00041000
*             Urbana, IL  USA-61801                                   * 00042000
* Phone:      217-244-6246                                            * 00043000

*********************************************************************** 00045000
                                                                 EJECT  00046000
*********************************************************************** 00047000
* General declarations.                                               * 00048000
*********************************************************************** 00049000
         INTREL DATIM,DECINT,I{*filter*}C                                     00050000
RXDATIM  NUCEXT ACODE=GODATIM,ZCODE=ENDATIM,(RXDATIM,GODATIM)           00051000
         USING GODATIM,R12                                              00052000
                                                                 SPACE  00053000
*********************************************************************** 00054000
* Begin main entry point.                                             * 00055000
*********************************************************************** 00056000
GODATIM  STM   R14,R12,SAVER14(R13) preserve registers                  00057000
                                                                 SPACE  00058000
         CLM   R1,B'1000',F5+3     is this a REXX call?                 00059000
         BC    NOT-EQUAL,EXIT4     no --> too bad                       00060000
         LTR   R3,R0               is it a function (not call)?         00061000
         BC    NEG,EXIT4           no --> signal error                  00062000
                                                                 SPACE  00063000
         ICM   R11,B'1111',20(R3)  get evalblok return word address     00064000
         BC    ZERO,EXIT4          zero --> signal error                00065000
                                                                 SPACE  00066000
*********************************************************************** 00067000
* Allocate savearea and evalblok.                                     * 00068000
*********************************************************************** 00069000
         LA    R0,9                size to allocate                     00070000
         DMSFREE DWORDS=(0)        get a work area                      00071000
         ST    R13,SAVEPREV(R1)    link...                              00072000
         ST    R1,SAVENEXT(R13)    ...saveareas                         00073000
         LR    R13,R1              use new save area                    00074000
                                                                 SPACE  00075000
         LA    R9,7                size of EVALBLOK / workarea          00076000
         LR    R0,R9               request size                         00077000
         DMSFREE DWORDS=(0)        get an EVALBLOK / workarea           00078000
         ST    R1,0(,R11)          pass EVALBLOK address to REXX now    00079000
         LR    R11,R1              use in this register                 00080000
         XC    0(8*7,R11),0(R11)   clean it up                          00081000
         ST    R9,4(,R11)          put allocated size in header         00082000
                                                                 SPACE  00083000
*********************************************************************** 00084000
* Convert number to internal binary form then to individual numbers.  * 00085000
*********************************************************************** 00086000
         $IF   NOT-ZERO            if                                   00087000
           ICM   R10,B'1111',16(R3)  arg list is present                00088000
         $AND  NOT-EQUAL           and                                  00089000
           CLI   0(R10),X'FF'        arg list has at least one arg      00090000
         $AND  NOT-ZERO            and                                  00091000
           ICM   R2,B'1111',0(R10)   address is not null                00092000
         $AND  NOT-ZERO            and                                  00093000
           ICM   R3,B'1111',4(R10)   length is not null                 00094000
         $AND  CC0+CC1             and                                  00095000
           DECINT ,                  given number is valid              00096000
         $THEN ,                   then                                 00097000
         $ELSE ,                   else                                 00098000
           STCK  16(R13)             use the current TOD clock          00099000
           LM    R0,R1,16(R13)       as if it were specified            00100000
         $END  ,                                                        00101000
                                                                 SPACE  00102000
         DATIM ,                   >>> convert TOD to various info      00103000
                                                                 SPACE  00104000
         LA    R3,1(,R3)           add one to month                     00105000
         LA    R4,1(,R4)           add one to date                      00106000
         LA    R5,1(,R5)           add one to day                       00107000
         STM   R2,R9,24(R11)       array these numbers                  00108000
                                                                 SPACE  00109000
*********************************************************************** 00110000
* Convert numbers to decimal and build resultant value.               * 00111000
* The binary values will be wiped over by the character values, but   * 00112000
* not until they are no longer needed.  The EVALBLOK overlay is:      * 00113000
*             1   1   2   2   2   3
...

read more »



Mon, 27 Sep 1993 07:01:38 GMT  
 Time conversion
We are suprised with all the great info about the TOD conversion.
We are trying one of them now.
We wrote a program that runs under CICS that gives a pageable
screen showing termids, virt addresses, real addresses and user
operator info. We want to show the time the term was last active
but cant seem to find any fields in the CICS that contain this time.
There is a field in the SNT that is supose to be a time stamp
in STCK format but its only 4 bytes. Any ideas?


Tue, 28 Sep 1993 00:27:23 GMT  
 Time conversion

Quote:

>We are suprised with all the great info about the TOD conversion.
>We are trying one of them now.
>We wrote a program that runs under CICS that gives a pageable
>screen showing termids, virt addresses, real addresses and user
>operator info. We want to show the time the term was last active
>but cant seem to find any fields in the CICS that contain this time.
>There is a field in the SNT that is supose to be a time stamp
>in STCK format but its only 4 bytes. Any ideas?

The upper 4 bytes of the STCK timestamp is effectively stepped every
1.048576 seconds.  It would be SIMPLEST to just take the upper 4 bytes
of the STCK timestamp and apply the conversions by filling in the
lower 4 bytes with 0's.

HOWEVER it is POSSIBLE they MIGHT be taking the full STCK and shifting it
to the right by 12 bits then dividing by one million exactly to come up
with an integer that is effectively incremented every 1.000000 seconds.

The reason to do that is that it would appear to SOME people that it is
easy to make date calculations on something that is stepped every 1.000000
seconds instead of something that is stepped every 1.048576 seconds.

It is in fact a slight bit faster to make such conversions, but not worth
doing the extra work to save a timestamp in this form.  My recommendation
is to save timestamps in STCK format or part thereof in binary.  Remember
if you must optimize for speed, optimize that which is executed the most.

But timestamps are not worth optmizing much either way.

Anyway you better check and see what method they are using.  Try assuming
the values are just the upper half of the STCK and see what results you
get.  If the answers are not "really close" then it is probably the other
method.
--
 /***************************************************************************\

\ Lietuva laisva -- Brivu Latviju -- Eesti vabaks                             /
 \***************************************************************************/



Tue, 28 Sep 1993 13:21:51 GMT  
 Time conversion

Quote:

>We are suprised with all the great info about the TOD conversion.
>We are trying one of them now.
>We wrote a program that runs under CICS that gives a pageable
>screen showing termids, virt addresses, real addresses and user
>operator info. We want to show the time the term was last active
>but cant seem to find any fields in the CICS that contain this time.
>There is a field in the SNT that is supose to be a time stamp
>in STCK format but its only 4 bytes. Any ideas?

The upper 4 bytes of the STCK timestamp is effectively stepped every
1.048576 seconds.  It would be SIMPLEST to just take the upper 4 bytes
of the STCK timestamp and apply the conversions by filling in the
lower 4 bytes with 0's.

HOWEVER it is POSSIBLE they MIGHT be taking the full STCK and shifting it
to the right by 12 bits then dividing by one million exactly to come up
with an integer that is effectively incremented every 1.000000 seconds.

The reason to do that is that it would appear to SOME people that it is
easy to make date calculations on something that is stepped every 1.000000
seconds instead of something that is stepped every 1.048576 seconds.

It is in fact a slight bit faster to make such conversions, but not worth
doing the extra work to save a timestamp in this form.  My recommendation
is to save timestamps in STCK format or part thereof in binary.  Remember
if you must optimize for speed, optimize that which is executed the most.

But timestamps are not worth optmizing much either way.

Anyway you better check and see what method they are using.  Try assuming
the values are just the upper half of the STCK and see what results you
get.  If the answers are not "really close" then it is probably the other
method.
--
 /***************************************************************************\

\ Lietuva laisva -- Brivu Latviju -- Eesti vabaks                             /
 \***************************************************************************/



Tue, 28 Sep 1993 13:21:51 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. UTC time conversion to internal time

2. Time conversion

3. Time conversion

4. Time Conversions

5. Date & Time Conversions on VM

6. date/time conversion

7. Time Conversion

8. string to date/time conversion

9. FILETIME <-> Ada.Real_Time.Time conversions

10. Integer - Time Conversion that actually works!

11. Time conversion

12. Date/Time conversions

 

 
Powered by phpBB® Forum Software