MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Asktime to get Nanosecond

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> CICS and Middleware
View previous topic :: View next topic  
Author Message
systemz
Beginner


Joined: 19 Nov 2004
Posts: 10
Topics: 5

PostPosted: Tue Oct 31, 2006 10:29 am    Post subject: Asktime to get Nanosecond Reply with quote

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
View user's profile Send private message AIM Address
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue Oct 31, 2006 10:54 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
systemz
Beginner


Joined: 19 Nov 2004
Posts: 10
Topics: 5

PostPosted: Tue Oct 31, 2006 10:55 am    Post subject: Reply with quote

I need the miliseconds, how can i get them?
Back to top
View user's profile Send private message AIM Address
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 317
Topics: 50
Location: Germany

PostPosted: Thu Nov 02, 2006 3:19 am    Post subject: Reply with quote

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
View user's profile Send private message
systemz
Beginner


Joined: 19 Nov 2004
Posts: 10
Topics: 5

PostPosted: Thu Nov 02, 2006 9:26 am    Post subject: Reply with quote

thank you all much for your input!

sz
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> CICS and Middleware All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group