Joined: 30 Nov 2013 Posts: 917 Location: The Universe
When you specify "code" brackets, you click on the code block just above the reply area. You will see a left square bracket code code right square bracket in the reply area. Enter the text you want displayed and then type left square bracket /code right square bracket.
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
Nope - I do not get buttons with Quick Reply apart from Preview and Submit (and Mainframe SpellCheck). I use Firefox and several forums none of which give ne buttons on the Quick Reply. It is the same when I use IE whatever.
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hi Nic,
I use IE multiple places on multiple machines. These are different IE releases (8, 10, 11) and right now (IE111-home) I have all of the tags on the Quick Rely editor.
I notice here i'm a moderator and you are a Senior Member. Wonder if this is controlled by "grade/level"?
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
In the Profile, the Quick Reply can be set to Basic or Advanced. It can also be turned off (which I do, else I get unwanted e-mails and Watched Topics if I accidently use it).
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
Using SMF date/time data to compute elapsed time.
The data
In SMF data a date/time is always in an 8 byte data area that is formatted like
Code:
TIMEOFDAY DS FL4
DATE DS PL4
The time of day is a binary value, in units of 1/100th of a second. A value of 60000, for example represents 1 AM. The maximum value is 8639999: 23:59:59.99.
The decimal digits in the date are 0cyyddd. cyy is the year c is 0 for dates from 1900 through 1999, and 1 for dates from 2000 through 2099. At least in concept, this date and time are derived in the data by code like this
Code:
TIME BIN
STM 0,1,TIMEOFDAY
The TIME macro is a standard MVS macro that dates back to OS/360. There are a number of options; in OS/360 the BIN option directed the macro to return the time of day in binary. In OS/360, the nominal precision of the value that was returned was actually greater than the precision of the hardware timing facilities and there were a lot of other issues; for example the value was tallied in the operating system thousands of times a day and could drift off the true time of quite easily. The final problem was the initial date and time of day were manually entered by the system operator. Another problem is the date and time of day generally represent the local time, with no convenient and accepted method to convert it to some sort of “universal” time.
There are two major problems dealing with this data.
It is not continuous, like the time of day clock in the hardware. The date and time of day must be analyzed separately, and it is difficult to combine them for the purpose of calculating an elapsed time. The date, too, is not continuous; the day of year restarts every January first.
Elapsed time, on the other hand, is continuous, so the implementation must translate the input values to some sort of continuous value, and the implementation must select the output precision.
The selection in SMFETIME was to create output in 1/100th seconds, the same precision of the time of day in the input. This choice is not perfect; a 32-bit signed number overflows after about 248 days, and is not all that useful directly displayed. An overflow, while rare, would not be unheard of. Since some uses of the data would be to add the values, there could be trouble with the addition. A lower output precision would reduce the chances of overflow. For example, one second precision would extend the range of 248 days to 24800 days.
The Method
Same day
Subtract starting time of day from ending time of day
Multiple days
Dates are in different years
Verify the ending year is no more than the starting year + 1
”Normalize” the ending date so the ending year matches the starting year by adding the number of days in the starting year to the day of year in the ending year.
Compute time used for the first day by subtracting the time of day for the first day from 8640000
For intermediate days add 8640000 for each day.
For the last day add the time of day to the tally
The 2 dates are in the same year
Without “normalizing” the date, perform the same calculation previously described.
The programs
Two programs follow. The first program is SMFETIME, the program that implements the first calculation. The second program just exercises SMFETIME using data in SMF type 34 records. These records represent TSO sessions. The SMF type 34 record is simpler for illustration purposes than the more commonly used type 30 record for two reasons.
It is not necessary to determine if the record is for a TSO user.
The session start time is in the root part of the record. In a type 30 record the session start time can only be determined by finding a specific segment within the record..
The test program also shows how to translate the elapsed time to an hour.minute format for display purposes.
Code:
SMFETIME TITLE ' CONVERT SMF DATE/TIME DATA PA>
IRS TO ELAPSED TIME'
***********************************************************************
* *
* Title -- SMFETIME *
* *
* Function / Operation -- SMFETIME calculates the elapsed time *
* between two SMF date/time pairs. An SMF date time pair is an *
* 8 byte data area; the first 4 bytes are a binary time of day *
* and the second 4 bytes are a date as a packed decimal number *
* with the format P'0cyyddd'. SMFETIME can handle dates that *
* extend to a second year. In other words, the start date *
* can be in 2013 and the end date can be in 2014. *
* *
* SMFETIME verifies the input data is valid and reasonable. The *
* first 4 bytes must be between 0 and 8639999 (23:59:59.99), and *
* the second 4 bytes must be packed decimal. *
* *
* Calling Sequence -- *
* CALL SMFETIME,(start,end,RESULT) (or equivalent) *
* ... *
* start DC F'time-of-day',PL4'0cyyddd' *
* end DC F'time-of-day',PL4'0cyyddd' *
* RESULT DC F'elapsed-time' *
* *
* Attributes -- SMFETIME is reenterable, refreshable and reusable. *
* It operates in any AMODE and RMODE that is compatible with *
* the caller; it is declared AMODE 31, RMODE ANY. The result *
* is in units of 1/100th of a second. The progran operates in *
* TCB mode, problem state and problem key. Since it uses no *
* external resources, its APF status is undefined. *
* *
* Register 15 return code - *
* 0 -- The result area contains the elapsed time. *
* 4 -- The input data is invalid. *
* - The date areas are not packed decimal. *
* - The time of day values are not in the range of 0 to *
* 8639999. *
* The result overflowed the capacity of a 32-bit register; *
* (248+ days). *
* *
* Restrictions -- SMFETIME uses the TP instruction to test the date *
* areas. If the instruction is not available, SMFETIME will fail *
* with an S0C1 ABEND; if the Assembler does not support the *
* instruction the assembly will fail. An alternate test using the *
* TRT instruction and two translate and test tables is provided as *
* comments. This code has not been tested. *
* *
* SMFETIME requires z/Architecture level set 1. This level set *
* does not provide the TP instruction. *
* *
***********************************************************************
SPACE 5
SMFETIME RSECT DEFINE PROGRAM CSECT
SMFETIME AMODE 31 DEFINE PROGRAM AMODE
SMFETIME RMODE ANY DEFINE PROGRAM RMODE
WORKAREA DSECT DEFINE WORK AREA DSECT
ORG WORKAREA+72-8 RESET POSITION TO THE SAVE AREA ->
REGISTER 11 AREA
DWORK DS D DEFINE A DOUBLE WORD WORK AREA
SMFETIME RSECT RETURN TO THE PROGRAM CSECT
USING *,10 ESTABLISH PROGRAM ADDRESSABILITY
USING WORKAREA,13 ESTABLISH WORK AREA ADDRESSABILITY
SAVE (14,10),,'SMFETIME &SYSDATE &SYSTIME' SAVE REGISTERS
LR 10,15 COPY ENTRY POINT ADDRESS TO REG 10
LM 2,4,0(1) LOAD THE PARAMETER LIST
* TRT 4(3,2),TRTTAB1 VERIFY
* JNZ EXIT4 THE
* TRT 4(3,3),TRTTAB1 DATE
* JNZ EXIT4 AREAS
* TRT 7(1,2),TRTTAB2 CONTAIN
* JNZ EXIT4 PACKED
* TRT 7(1,3),TRTTAB2 DECIMAL
* JNZ EXIT4 DATA
TP 4(4,2) TEST START DATE
JNZ EXIT4 BR IF NOT PACKED DECIMAL
TP 4(4,3) TEST END DATE
JNZ EXIT4 BR IF NOT PACKED DECIMAL
ICM 0,B'1111',0(2) LOAD STARTING TIME OF DAY
JM EXIT4 BR IF BAD
ICM 1,B'1111',0(3) LOAD ENDING TIME OF DAY
JM EXIT4 BR IF BAD
C 0,=A(100*24*60*60-1) TEST START TIME OF DAY
JH EXIT4 BR IF TOO HIGH
C 1,=A(100*24*60*60-1) TEST END TIME OF DAY
JH EXIT4 BR IF TOO HIGH
CP 4(4,2),4(4,3) TEST IF START DATE = END DATE
JNE MDAYS BR IF NOT
SR 1,0 COMPUTE ELAPSED TIME
ST 1,0(,4) STORE ELAPSED TIME
JM EXIT4 BR IF BAD
J EXIT0 EXIT WITH A SMILE
MDAYS ZAP DWORK,4(4,2) CONVERT START DATE
CVB 7,DWORK TO BINARY
ZAP DWORK,4(4,3) CONVERT END DATE
CVB 9,DWORK TO BINARY
SR 6,6 SEPARATE
SR 8,8 CYY
D 6,=F'1000' AND
D 8,=F'1000' DDD
* REG CONTENTS
* 6 DAY OF YEAR OF STARTING DATE
* 7 CYY OF STARTING YEAR
* 8 DAY OF YEAR OF ENDING DATE
* 9 CYY OF ENDING YEAR
LR 1,9 COPY END CYY TO REG 1
SR 1,7 SUBTRACT END CYY FROM START CYY
JZ SAMEYEAR BR IF END CYY = START CYY
JM EXIT4 BR IF END CYY < START CYY
CHI 1,1 TEST IF END CYY = START CYY + 1
JNE EXIT4 BR IF NOT
LR 1,7 COPY START CYY TO REG 1
AHI 1,1900 CONVERT START CYY TO TRUE YEAR
LR 14,1 COPY START YEAR TO REG 14
N 14,=A(B'11') TEST IF POSSIBLE LEAP YEAR
JNZ NOTLEAP BR IF NOT A LEAP YEAR
LR 15,1 COPY START YEAR TO REG 15
D 14,=F'100' DIVIDE START YEAR BY 100
LTR 14,14 TEST THE REMAINDER
JNZ ISLEAP BR IF START YEAR IS NOT A CENTURY ->
YEAR
N 15,=A(B'11') TEST IF START YEAR IS A CENTURY ->
LEAP YEAR
JZ ISLEAP BR IF SO
NOTLEAP LHI 0,365 SET REG 0 = DAYS IN A REGULAR YEAR
J ADJUST
ISLEAP LHI 0,366 SET REG 0 = DAYS IN A LEAP YEAR
ADJUST AR 8,0 UPDATE END DDD
* NOW COMPUTE THE ELAPSED TIME
* COMPUTE TIME ON THE FIRST DAY
SAMEYEAR L 0,=A(100*24*60*60) LOAD MIDNIGHT TIME OF DAY
S 0,0(,2) SUBTRACT START TIME OF DAY
NEXTDAY AHI 6,1 ADD 1 TO START DAY OF YEAR
CR 6,8 COMPARE WITH END DAY OF YEAR
JE LASTDAY BR IF LAST DAY
A 0,=A(100*24*60*60) ADD TIME IN 1 FULL DAY
JO EXIT4 BR IF OVERFLOW
J NEXTDAY AND DO IT AGAIN
LASTDAY A 0,0(,3) ADD TIME IN THIS DAY
JO EXIT4 BR IF MATH OVERFLOW
ST 0,0(,4) STORE RESULT
EXIT0 SR 15,15 SET RC = 0
J EXIT
EXIT4 LHI 15,4 SET RC = 4
EXIT RETURN (14,10),T,RC=(15) RESTORE REGISTERS & RETURN
DC 0D'0'
* USE TRTTAB1 TO VERIFY THE FIRST 3 BYTES AND TRTTAB2 TO VERIFY THE
* 4TH BYTE OF PACKED DECIMAL DATA.
** 0 1 2 3 4 5 6 7 8 9 A B C D E F
*TRTTAB1 DC 10X'00000000000000000000040404040404'
* DC 6X'04040404040404040404040404040404'
*TRTTAB2 DC 10X'00000000000000000000000000000000'
* DC 6X'04040404040404040404040404040404'
LTORG , DEFINE THE SMFETIME LITERALS
DC 0D'0' ROUND CSECT TO 8 BYTES
END ,
Code:
* TEST SMFETIME USING REAL SMF DATA. THE OUTPUT LINE IS
* (1) (2) (3) (4) (5) (6) (7)
* UUUUUUUU DDDDDDDDD HHH:MM DDDDDDD CYY/DDD DDDDDDD CYY/DDD
* (1) UUUUUUUU IS A USERID
* (2) DDDDDDDDD IS THE "RAW" ELAPSED TIME FROM SMFETIME, DISPLAYED AS A
* 9 DIGIT DECIMAL NUMBER
* (3) HHH:MM IS THE ELAPSED TIME FROM SMFETIME. HHH REPRESENTS HOURS,
* MM REPRESENTS MINUTES
* (4) DDDDDDD IS THE START TIME OF DAY IN 1/100TH OF A SECOND
* (5) CYY/DDD IS THE START DATE
* (6) DDDDDDD IS THE END TIME OF DAY
* (7) CYY/DDD IS THE END DATE
SPACE 1
* THE PRIMARY PURPOSE OF THE PROGRAM IS TO DEMONSTRATE THE USE OF
* SMFETIME; NOT DO REALISTIC SMF RECORD ANALYSIS. THE SMF 34 RECORD
* IS CONVENIENT FOR THIS PURPOSE, SINCE BOTH THE RECORD DATE/TIME
* AND THE SESSION START DATE/TIME ARE IN THE ROOT PART OF THE RECORD,
* RATHER THAN MUCK AROUND IN A TYPE 30 RECORD.
SPACE 1
* THE CONVERSION FROM A 1/100TH SECOND VALUE TO A H:MM VALUE IS AN
* CUSTOM DATA CONVERSION TO AID REPORT READABILITY.
SPACE 1
DRIVER CSECT ESTABLISH PROGRAM CSECT
PUSH PRINT
PRINT NOGEN
SMFREC DSECT DEFINE A DSECT FOR SMF DATA
IFASMFR 34 DEFINE THE DSECT FOR SMF 34 RECORDS
POP PRINT
DRIVER CSECT RETURN TO PROGRAM CSECT
USING *,12 ESTABLISH PROGRAM ADDRESSABILITY
SAVE (14,12),,* SAVE CALLER'S REGISTERS
LR 12,15 COPY ENTRY POINT ADDRESS TO REG 12
LA 15,SAVEAREA LOAD ADDRESS OF THE NEW SAVE AREA
ST 13,4(,15) ADD NEW SAVE AREA TO THE
ST 15,8(,13) SAVE AREA CHAIN
LR 13,15 ESTABLISH A NEW SAVE AREA POINTER
OPEN MF=(E,OPARM) OPEN THE DATA SETS
LOOP GET SMFDCB READ A RECORD
LR 2,1 COPY THE RECXORD ADDRESS TO REG 2
USING SMFREC,2 ESTABLISH SMF RECORD ADDRESSABILITY
CLI TIVRCDTY,34 TEST IF TYPE 34 RECORD
JNE LOOP BR IF NOT
L 15,=V(SMFETIME) LOAD ADDRESS OF SMFETIME
CALL (15),(TIVONTME,TIVRCDTS),MF=(E,CALLPARM) COMPUTE THE ->
ELAPSED TIME FOR THE SESSION
MVC STIME,EDMASK3 COPY
MVC ETIME,EDMASK3 EDIT
MVC SDATE,EDMASK4 MASKS
MVC EDATE,EDMASK4 TO THE OUTPUT LINE
ED SDATE,TIVONTME+4 CONVERT LOGON AND LOGOFF DATE TO
ED EDATE,TIVRCDTS+4 CYY/DDD
ICM 0,B'1111',TIVONTME LOAD LOGON TIME OF DAY
CVD 0,16(,13) CONVERT LOGON TIME TO PACKED DECIMAL
ED STIME,16+4(13) AND DECIMAL DIGITS
ICM 0,B'1111',TIVRCDTS LOAD LOGOFF TIME OF FDAY
CVD 0,16(,13) CONVERT LOGOFF TIME OF DAY TO PACKED
ED ETIME,16+4(13) DECIMAL AND DECIMAL DIGITS
L 1,RESULT LOAD THE RESULT
* CONVERT ELAPSED TIME TO HHH.MM (HOURS/MINUTES)
SR 0,0 SET REG 0 = 0
D 0,=A(100*60*60) DIVIDE ELAPSED TIME BY THE NUMBER ->
OF 1/100TH SECONDS IN ONE HOUR. ->
REGISTER 1 CONTAINS THE NUMBER ->
HOURS AND REGISTER 2 CONTAINS ->
THE NUMBER OF MINUTES AND ->
SECONDS IN THE SESSION
MHI 1,100 MULTIPLY HOURS BY 100
LR 3,1 COPY HOURS TO REG 3
LR 1,0 COPY MINUTES AND SECONDS TO REG 1
SR 0,0 SET REG 0 = 0
D 0,=A(100*60) DIVIDE MINUTES AND SECONDS BY THE ->
NUMBER OF 1/100TH SECONDS IN ONE ->
MINUTE
AR 3,1 ADD MINUTES TO HOURS. WE NOW HAVE ->
COMPOSITE VALUE HHMM
CVD 3,16(,13) CONVERT HHMM TO DECIMAL
MVC ETIME1,EDMASK1 COPY THE EDIT MASK TO A WORK AREA
ED ETIME1,16+5(13) CONVERT HHMM TO AN HH.MM FORMAT
L 0,RESULT LOAD THE RAW ELAPSED TIME
CVD 0,16(,13) CONVERT TO DECIMAL
MVC ETIME2,EDMASK2 COPY AN EDIT MASK TO THE OUTPUT LINE
ED ETIME2,16+3(13) CONVERT ELAPSED TIME TO DIGITS
MVC OUTUSER,TIVUIF COPY THE USERID TO THE LINE
PUT PRINT,OUTLINE WRITE THE COMPLETED OUTPUT LINE
J LOOP DO IT AGAIN
EOF CLOSE MF=(E,CPARM) CLOSE THE DATA SETS
L 13,4(,13) LOAD ADDRESS OF THE HIGHER SAVE AREA
RETURN (14,12),T,RC=0 RESTORE REGISTERS & RETURN
SAVEAREA DC 9D'0' 72 BYTE OS/260 SAVE AREA
PUSH PRINT
PRINT NOGEN
OPARM OPEN (PRINT,OUTPUT,SMFDCB,INPUT),MF=L OPEN PARM LIST
CPARM CLOSE (PRINT,,SMFDCB),MF=L CLOSE PARM LIST
PRINT DCB DSORG=PS,MACRF=PM,DDNAME=SYSPRINT,RECFM=VBA,LRECL=125
SMFDCB DCB DSORG=PS,MACRF=GL,DDNAME=SMF,BFTEK=A,EODAD=EOF
POP PRINT
* PARAMETER LIST SENT TO SMFETIME. THE FIRST TWO PARAMETER POINTERS
* POINT TO THE LOGON AND LOGOFF DATE / TIMES AND ARE FILLED IN THE
* "EXECUTE" FORM OF THE CALL MACRO THAT SPECIFIES THIS PARAMETER LIST.
CALLPARM CALL ,(*-*,*-*,RESULT),MF=L
RESULT DC F'0' ELAPSED TIME CALCULATED BY SMFETIME
* EDIT MASKS
EDMASK1 DC 0C' HHH.MM',C' ',X'202120',C'.',X'2020'
EDMASK2 DC 0C' DDDDDDDDD',C' ',7X'20',X'2120'
EDMASK3 DC 0C' DDDDDDD',C' ',5X'20',X'2120'
EDMASK4 DC 0C' CYY/DDD',C' ',X'20202120',C'/',X'202020'
* OUTPUT LINE BUILD AREA
OUTLINE DC AL2(OUTLINEL,0),C' '
OUTUSER DC CL8' '
ETIME2 DC C' DDDDDDDDD'
ETIME1 DC C' HHH.MM'
STIME DC C' DDDDDDD'
SDATE DC C' CYY/DDD'
ETIME DC C' DDDDDDD'
EDATE DC C' CYY/DDD'
OUTLINEL EQU *-OUTLINE
DC 0D'0'
LTORG ,
DC 0D'0'
END DRIVER