View previous topic :: View next topic
|
Author |
Message |
dsivapradeep
New User
Joined: 06 Jul 2012 Posts: 43 Location: INDIA
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
dsivapradeep
New User
Joined: 06 Jul 2012 Posts: 43 Location: INDIA
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why do you want to display the time down to mirco-seconds (or lower) at the start/end of a program? |
|
Back to top |
|
|
dsivapradeep
New User
Joined: 06 Jul 2012 Posts: 43 Location: INDIA
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
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 |
|
|
Grant Goodale
New User
Joined: 13 Nov 2010 Posts: 67 Location: Brampton, Ontario, Canada
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Use the TIMEUSED macro. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Peter,
Exactly.... |
|
Back to top |
|
|
|