Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
Posted: Mon Jun 02, 2008 9:55 am Post subject:
If you need a "real" microsecond value, go with koluso's suggestion. If a "pseudo" value will suffice, like it did for me one time, use the hhmmss value from COBOL and suffix it with your own generated microsecond value. _________________ ....Terry
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
Posted: Thu Jun 05, 2008 11:31 am Post subject:
The following will give you time upto microseconds :
Code:
TIMEMSEC RMODE ANY
TIMEMSEC AMODE ANY
TIMEMSEC CSECT 00000270
*
* Author: Nagesh Subrahmanyam .
*
*This program will get the current date and time upto the level of
*micro-seconds. They will be stored in packed-decimal format which
*needs to be formatted in the calling program.
*
*COBOL calling format:
*
* Call 'TIMEMSEC' Using Current-Time End-Call .
*where,
* Current-Time is defined as X(12). This field must be redefined
* accordingly to get the correct format.
*
BALR R12,0 00000300
USING *,R12 Establish addressability 00000300
STM R14,R12,12(R13) Save the registers 00000280
LA R2,SAVEAREA Locate new savearea
ST R13,4(,R2) Set back pointer
ST R2,8(,R13) Set forward pointer
LR R10,R1 Save R1 before calling macro
*
TIMEMAC DS 0H
TIME DEC,TIMEDATE,ZONE=LT,LINKAGE=SYSTEM,DATETYPE=YYYYMMDD
MVO TIMEO,TIMEONLY Move time and append sign nibble
MVO DATEO,DATEONLY Move date and append sign nibble
DS 0H
*
LR R1,R10 Re-load R1
L R1,0(,R1) R1 points to passed arguement
MVC 0(L'TSTAMP,R1),TSTAMP Arguement has Timestamp
*
L R13,4(R2) Find caller savearea 00000400
LM R14,R12,12(R13) Restore registers 00000400
XR R15,R15 Clear R15 00000420
BR R14 Goback 00000420
*
DS 0F
SAVEAREA DS 18F Savearea
*
TIMEDATE DS 0XL16 Time and date returned
TIMEONLY DS XL06 Time part only
DS XL02
DATEONLY DS XL04 Date part only
DS XL04
*
TSTAMP DS 0PL12
DATEO DS PL5 0C CY YM MD DF
TIMEO DS PL7 0H HM MS SS SS SS SF
*
*Register equates
*
R0 EQU 0 00000900
R1 EQU 1 00001000
R2 EQU 2 00001100
R3 EQU 3 00001200
R4 EQU 4 00001300
R5 EQU 5 00001400
R6 EQU 6 00001500
R7 EQU 7 00001600
R8 EQU 8 00001700
R9 EQU 9 00001800
R10 EQU 10 00001900
R11 EQU 11 00002000
R12 EQU 12 00002100
R13 EQU 13 00002200
R14 EQU 14 00002300
R15 EQU 15 00002400
*
END TIMEMSEC 00000470
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum