IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

TIME Macro usage in Assembler


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Mon Apr 08, 2013 6:05 pm
Reply with quote

Hi,

I'm trying to use TIME macro to get complete TIMESTAMP from the reference publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA1A741/144.2.11?SHELF=&DT=20001020155112 and using the below code:

Code:

TIMEMCR  START 0                               
BEGIN    SAVE  (14,12)                         
         BALR  12,0                             
         USING *,12                             
         ST    13,SAVE+4                       
         LA    13,SAVE                         
         BALR 12,0                             
         USING *,12                             
         TIME DEC,TIMEDAT,ZONE=LT,LINKAGE=SYSTEM,DATETYPE=YYYYMMDD 
         TPUT TIMEDAT,L'TIMEDAT                 
         WTO 'HELLO'                           
         L     13,SAVE+4                       
         RETURN (14,12),RC=0                   
TIMEDAT  DS CL16                               
SAVE     DS 18F                                 
         END TIMEMCR                           


But TIMESTAMP in TIMEDAT variable is in non-readable format.
Code:

:::/::  :::q
HELLO       
***         


Kindly guide me to make this TIME macro output in readable format.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Mon Apr 08, 2013 6:34 pm
Reply with quote

the same manual explains the format of the data returned,
and what other macros should/could be used to Reformat the returned <time>
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Apr 08, 2013 10:37 pm
Reply with quote

The date/time is in packed/unsigned (hex) format. Bytes 1-6 of "TIMEDAT" has a format of X'HHMMSSTHMIJU' and bytes 9-12 has a format of X'CCYYMMDD', which includes the correct century (CC), no added arithmetic necessary.

It's just a matter of converting these values into a readable-format, such as display-numeric. Here's a simple example -

Code:

HEXWORK  DS    CL16           UNPACK-WORKAREA
GREGDATE DS    CL8            GREGORIAN-DATE AS C'CCYYMMDD'
CURRTIME DS    CL12           CURRENT-TIME AS C'HHMMSSTHMIJU'
*
         UNPK  HEXWORK(9),TIMEDAT+8(5)
         MVC   GREGDATE,HEXWORK
         UNPK  HEXWORK(13),TIMEDAT(7)
         MVC   CURRTIME,HEXWORK

If you intend on using this as a Called sub-program in CICS, the data-areas need to be reentrant (passed by the caller) and 'TIMEDAT' needs to be GETMAIN'd as 16-bytes of CICSKEY storage and FREEMAIN'd before returning to the caller. The GETMAIN'd CICSKEY storage is necessary, even if the PPT entry defines the program as CICSKEY, the allocated WS (DFHEISTG) runs in key 9 (USERKEY). CICSKEY is key 8. This version of the TIME Macro uses cross-memory transfers (PC/PT instructions) to a different address space and if STGPROT is active in the SIT (default is inactive) and 'TIMEDAT' is defined to USERKEY, a S0C4 will be raised as you've violated the Storage Protection rule. The default-standard version of the TIME Macro, expands into an SVC (11) and should NOT be used in CICS. Plus, the date returned (Julian) is in R1, with a format of PL4'0CYYDDD' (add 1900000 to make it Y2K compliant as the 0C will equal 01 since 1 January 2000) and the time-returned is in R0, with a format of XL4'HHMMSSTH'. Your CICS System Programmer needs to be consulted before implementation.

HTH....
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Tue Apr 09, 2013 4:09 pm
Reply with quote

Hi Bill,

Thanks for the help. I'm able to use this Assembler routine from COBOL to get time stamp with microsecond precision. This is the highest precision for timestamp right? or any other method is available to get precision less than 1 micro second ?

In my COBOl application, i'm displaying this timestamp at the start and end of the program and now i want to do the same in CICS but faced the problem in LINKEDIT itself. 'Member could not be included from the designated call cibrary'

Used the call,
CALL 'TIMSTAMP' USING WS-PARM-FOR-ASM
END-CALL
like how i did for a COBOL program.
Not sure whether i can call ASSEMBLER module in this format in a COBOL-CICS program.

I didn't understand your explaination totally for accessing this assembler program as a called-program from a CICS-COBOL. where Can i search for reference on this operation?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Tue Apr 09, 2013 4:41 pm
Reply with quote

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA4160/CCONTENTS?SHELF=CEE2BK90&DN=SA22-7563-06&DT=20080602121454

will tell all you might want to know about interlanguage <communication>

together wit the CObol manuals related to Your COBOL compiler level
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 09, 2013 4:55 pm
Reply with quote

Why do you want to display the time down to mirco-seconds (or lower) at the start/end of a program?
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Tue Apr 09, 2013 5:02 pm
Reply with quote

Reason is analyzing the execution time being taken by an application.

We have an application which has the business logic in 2 different ways. Want to know which logic is taking minimum CPU execution time in terms of business logic. For this reason, displaying time at starting and ending of program for analyzing the time difference manually precisely!

It's working fine for a COBOL program but for a CICS transaction, i'm finding difficult in calling this assembler routine using CICS-COBOL.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 09, 2013 5:06 pm
Reply with quote

But you're using the Clock time, not the CPU time. You're not measuring CPU, you're measuring "elapsed".

If you want the CPU time, you're going to need to go through Control Blocks. Here's a Cobol program which you could easily adapt to Assembler, I've been waiting for someone to do it :-)

This can get you less than microseconds, as well, but I don't see the point in taking any notice of them.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Tue Apr 09, 2013 5:20 pm
Reply with quote

Quote:
It's working fine for a COBOL program but for a CICS transaction, i'm finding difficult in calling this assembler routine using CICS-COBOL.


completely wrong approach
for a CICS transaction/program,
picking things out of the MVS control blocks will give You the CICS data, not the transaction/program data

and using zOS macros in CICS program is pretty inconsiderate

seems that this topic is a quasi duplicate of
ibmmainframes.com/viewtopic.php?t=60760&highlight=

did You look at the link I provided You on how to process SMF CICS 110 type records
( that' a full application, written in COBOL, and it provides pretty good reports )
Back to top
View user's profile Send private message
Grant Goodale

New User


Joined: 13 Nov 2010
Posts: 67
Location: Brampton, Ontario, Canada

PostPosted: Tue Apr 09, 2013 7:09 pm
Reply with quote

If you really want fine timing, use the Store Clock Extended instruction (STCKE) along with the STCKCONV macro. That will give you timings to approximately 244 picoseconds. I have no idea why you would want it that fine but there it is.

As others have stated here, that gives you clock time, not CPU time.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sun Apr 14, 2013 7:21 am
Reply with quote

Grant,

Depending on the shop, STCK(E) can be initialized to reflect GMT, but I think the OP want's LOCAL (ZONE=LT, which is the default), so he'd have to do some arithmetic.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sun Apr 14, 2013 11:13 pm
Reply with quote

Use the TIMEUSED macro.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sun Apr 14, 2013 11:34 pm
Reply with quote

Peter,

Exactly....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts SDUMPX macro fails to dump requested ... PL/I & Assembler 5
No new posts Access to macro definitions PL/I & Assembler 4
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts RC query -Time column CA Products 3
No new posts C Compile time time stamps Java & MQSeries 10
Search our Forums:

Back to Top