View previous topic :: View next topic |
Author |
Message |
systemz Beginner
Joined: 19 Nov 2004 Posts: 10 Topics: 5
|
Posted: Tue Oct 31, 2006 10:29 am Post subject: Asktime to get Nanosecond |
|
|
Hi,
Can any one help me use the ASKTIME command to get Nanoseconds?
This if the Format that i need to get : HHMMSSNNN.
thanks! |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue Oct 31, 2006 10:54 am Post subject: |
|
|
what about the tenths, hundredths, milli, micro, etc seconds? I think you are confused about what a nanosecond is (10E-9 seconds, or per Grace Hopper's famous definition, roughly the time it takes an electron in a circuit to go 1 foot). |
|
Back to top |
|
 |
systemz Beginner
Joined: 19 Nov 2004 Posts: 10 Topics: 5
|
Posted: Tue Oct 31, 2006 10:55 am Post subject: |
|
|
I need the miliseconds, how can i get them? |
|
Back to top |
|
 |
bauer Intermediate
Joined: 10 Oct 2003 Posts: 317 Topics: 50 Location: Germany
|
Posted: Thu Nov 02, 2006 3:19 am Post subject: |
|
|
systemz,
try this PL1 sample and pls see remarks in CICS programming reference according the precission.
Code: |
DCL Message AUTO CHAR(60) INIT('');
DCL MILLISEC_CUR DEC FIXED(15) AUTO INIT(0) ;
DCL MILLISEC_DIF DEC FIXED(15) AUTO INIT(0) ;
DCL BUFFER DEC FIXED(15) AUTO INIT(0) ;
DCL HOURS DEC FIXED(15) AUTO INIT(0) ;
DCL MIN DEC FIXED(15) AUTO INIT(0) ;
DCL SEC DEC FIXED(15) AUTO INIT(0) ;
DCL SSMMSS_C CHAR(6) BASED(ADDR(TIMEEXT.SSMMSS));
DCL TIMEEXT_C CHAR(9) BASED(ADDR(TIMEEXT)) ;
DCL 1 TIMEEXT UNAL AUTO
,2 SSMMSS,
3 HOURS PIC'99' INIT(0)
,3 MIN PIC'99' INIT(0)
,3 SEC PIC'99' INIT(0)
,2 MSEC PIC'999' INIT(0)
;
DCL COUNT1 BIN FIXED(31) AUTO INIT(0);
EXEC CICS ASKTIME ABSTIME(MILLISEC_CUR);
EXEC CICS FORMATTIME
ABSTIME(MILLISEC_CUR)
TIME(SSMMSS_C)
DAYCOUNT(COUNT1) ;
HOURS = TIMEEXT.HOURS ;
MIN = TIMEEXT.MIN ;
SEC = TIMEEXT.SEC ;
BUFFER = COUNT1 - 1 ;
BUFFER = MULTIPLY(BUFFER ,86400000,15);
BUFFER = BUFFER + MULTIPLY(HOURS , 3600000,15);
BUFFER = BUFFER + MULTIPLY(MIN , 60000,15);
BUFFER = BUFFER + MULTIPLY(SEC, 1000,15);
MILLISEC_DIF = BUFFER - MILLISEC_CUR ;
IF MILLISEC_DIF < 0 THEN DO;
TIMEEXT.MSEC = 500 + ABS(MILLISEC_DIF) ;
END;
ELSE DO;
TIMEEXT.MSEC = 500 - MILLISEC_DIF ;
END;
Message = TIMEEXT_C ;
EXEC CICS SEND TEXT
FROM(MESSAGE)
TERMINAL
ERASE
FREEKB
NOHANDLE;
|
The better solution using PL1 is, to use DATETIME function or try EXEC SQL SELECT CURRENT TIMESTAMP FROM SYSIBM.SYSDUMMY1.
regards,
bauer |
|
Back to top |
|
 |
systemz Beginner
Joined: 19 Nov 2004 Posts: 10 Topics: 5
|
Posted: Thu Nov 02, 2006 9:26 am Post subject: |
|
|
thank you all much for your input!
sz |
|
Back to top |
|
 |
|
|