Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To get GMT time in a Assembler Program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Dec 02, 2009 6:04 pm    Post subject: To get GMT time in a Assembler Program
Reply with quote

Hi All,

Have a requirement where in I need to get the GMT time or atleast the difference between the GMT and LOCAL time.
The existing program is in Assembler with CICS.

Is there any way to get the information ?

I have looked into using the LE routines but for an assembler CICS program it seems to be a bit complicated with a lot of initial setup required... icon_sad.gif
At this point looking for an easier option... icon_redface.gif
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Wed Dec 02, 2009 6:15 pm    Post subject: Reply to: To get GMT time in a Assembler Program
Reply with quote

what about using EIBDATE and EIBTIME

but be aware of the consistency issues about timestamps...

for example if You need to timestamp all the records/rows updated by a transaction
is generally wrong to build the timestamp just before the udates
it would be difficult to correlate them ( the updates I mean )
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Dec 02, 2009 6:17 pm    Post subject:
Reply with quote

Which version of CICS? The version 3.2 Application Programming Reference manual (link at the top of the page) has FORMMATTIME command option STRINGFORMAT(RFC1123) which returns GMT -- so EXEC CICS ASKTIME followed by EXEC CICS FORMATTIME will do it.

The TIME Assembler macro has ZONE=LT or ZONE=GMT to determine which to return, but I don't recall if it can be invoked by a CICS program (probably not, but my coffee hasn't kicked in yet so I'm not committing to anything).
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Dec 02, 2009 6:23 pm    Post subject:
Reply with quote

Hi Enrico,

Thank you for your reply... icon_smile.gif

Quote:
what about using EIBDATE and EIBTIME

They EIBDATE and EIBTIME seems to have the LOCAL time and dates. As mentioned we wanted the time difference so we were thinking of using the EIB date and time to calculate the difference from the LOCAL time.

Quote:
but be aware of the consistency issues about timestamps...

for example if You need to timestamp all the records/rows updated by a transaction
is generally wrong to build the timestamp just before the udates
it would be difficult to correlate them ( the updates I mean )
thanks a lot for the suggestion... icon_smile.gif ... but as mentioned just interested in the time difference ... This is not used for any reports...
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Dec 02, 2009 9:29 pm    Post subject:
Reply with quote

Hi Robert,

Thanks for the reply... and yes option STRINGFORMAT(RFC1123) is giving me the GMT time... icon_biggrin.gif

Would like a small clarification on this.

Actually this option I had tested in one environment ( specific to my company ). When i tested here, it was giving me the same time - i.e. both EIBTIME and STRINGFORMAT(RFC1123).

But after Robert's suggestion I tried using the same in the client environment and its working.

After some research, the only place where I could find some difference is when i tried issuing the CECI INQ MONITOR statement in which the TIME option was returning a value 604 ( GMT ) in the client environment while the other enviroment was returning 605 ( LOCAL ). Is it because of this ?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Wed Dec 02, 2009 10:17 pm    Post subject: Reply to: To get GMT time in a Assembler Program
Reply with quote

If you make the CICS/Assembler routine LE compliant or use CEEPIPI to make it temporarily LE compliant, then you can call LE Callable Service routine "CEEGMTO", which will return the hours/minutes difference between GMT and Local, in two separate binary-fwords.

There are 3600000 milliseconds in an hour and 60000 milliseconds in a minute.

Note that (for example) your CPU was located in the US EST (which is currently GMT-0500), the value in the hours-fword will be a negative five (=F'-5). So you would need to set this value (temporarily and save the original as a failsafe) as a positive five (CVD into a DBLWORD), multiply the DBLWORD BY 3600000, issue an ASKTIME ABSTIME and add the calculated DBLWORD to the ABSTIME millisecond value.

A FORMATTIME can then be used against the adjusted ABSTIME value, resulting in dates/times which reflect local date/time plus their GMT offset (in other words, GMT).

Having said this, LE also offers "CEEGMT" and (an alias to "CEEGMT", named "CEEUTC") which will return the date/time as GMT, in a fword and dblword format.

One other tidbit is if your TOD clock is set to GMT, you could calculate the offset between a STCK and the local date/time converted to a local STCK value.

HTH....

Bill
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Thu Dec 03, 2009 3:23 am    Post subject: Reply to: To get GMT time in a Assembler Program
Reply with quote

This is a sub-program, which will return the hours millisecond-adjustment DBLWORD, which needs to be added to an ABSTIME value. Note that the sign-nibble is either positive or negative, so the ADD will work, regardless.

Code:

         PRINT NOGEN               SUPPRESS MACRO EXPANSION
         CVT   DSECT=YES,LIST=YES  GENERATE 'CVT' DSECT
         PRINT GEN                 ACTIVATE MACRO EXPANSION
DFHEISTG DSECT                     DYNAMIC-STG (R13)
DBLWORD  DS    D                   ALIGNED-DBLWORD WORKAREA
WRKCVTTZ DS    F                   CVTTZ-SAVEAREA
RETNCODE DS    H                   RETURN-CODE HWORD
GETOFFST DFHEIENT CODEREG=R3,DATAREG=R13,EIBREG=R11
         MVC   RETNCODE,=H'16'     SET 'BAD' RETURN-CODE
         LH    R15,EIBCALEN        ACTUAL COMMAREA-LGTH
         CHI   R15,L'DBLWORD       MINIMUM COMMAREA-LGTH?
         BL    CICSRETN            NO, RETURN TO CALLER
         L     R7,DFHEICAP         LOAD COMMAREA-ADDRESS
         L     R15,CVTPTR          CVT-ADDRESSABILITY
         L     R15,CVTTZ-CVT(,R15) LOAD INTO R15
         ST    R15,WRKCVTTZ        STORE IN FWORD
         LPR   R15,R15             MAKE IT POSITIVE
         CVD   R15,DBLWORD         MAKE IT DECIMAL
         MP    DBLWORD,=P'1048576' CALCULATE NBR-OF-SECONDS
         SRP   DBLWORD,(64-6),0    DIVIDE BY 1000000/NO ROUNDING
         CVB   R14,DBLWORD         MAKE IT BINARY
         SRDA  R14,32              PREPARE FOR BINARY-DIVIDE
         D     R14,=F'3600'        CALCULATE HOURS
         CVD   R15,DBLWORD         MAKE IT DECIMAL
         MP    DBLWORD,=P'3600000' CALCULATE MSECS-ADJUSTMENT
         MVI   RETNCODE+L'RETNCODE-1,X'00'
         TM    WRKCVTTZ,X'80'      ORIGINALLY NEGATIVE?
         BO    UPDTCOMA            YES, UPDATE COMMAREA
         OI    DBLWORD+L'DBLWORD-1,X'01'
UPDTCOMA EQU   *
         MVC   0(L'DBLWORD,R7),DBLWORD
CICSRETN EQU   *
         LH    R15,RETNCODE        LOAD HWORD RETURN-CODE
         DFHEIRET RCREG=R15        RETURN TO CALLER
         LTORG ,
         YREGS ,
GETOFFST AMODE 31
GETOFFST RMODE ANY
         END   ,

Bill
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Thu Dec 03, 2009 7:01 am    Post subject: Reply to: To get GMT time in a Assembler Program
Reply with quote

Just found an error in the above sub-program. The BZ following the TM -

Code:

        TM    WRKCVTTZ,X'80'      ORIGINALLY NEGATIVE?
        BZ    UPDTCOMA            NO, UPDATE COMMAREA

Needs to be changed to -

Code:

        BO    UPDTCOMA            YES, UPDATE COMMAREA

When the DBLWORD is added to the ABSTIME, it will always be correct, because if the original the GMT Offset were NEGATIVE (behind GMT), then the DBLWORD must remain as POSITIVE. Otherwise, if the offset were POSITIVE and greater than zero (ahead of GMT), the sign-nibble of DBLWORD must be set to NEGATIVE.

I did leave out consideration for sites (primarily Britain) which sit directly on GMT and so, their DBLWORD value must be set to P'0', because GMT and LOCAL are the same.

Bill
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Thu Dec 03, 2009 11:01 am    Post subject:
Reply with quote

Hi Bill,

Thanks a ton for the suggestions, ideas and the code... icon_biggrin.gif

As mentioned in my previous post, I think I will use the STRINGFORMAT option in the FORMATTIME to get the value as it is working in my client environment.

I am certainly going to have a look into LE suggestions and supporting code and try understand the logic. I am still at a stage in Assembler where each instruction I need to go back to the manual and understand what it is doing... icon_razz.gif .. it will take some time... but hope I will get there soon... icon_cool.gif

Thanks again Bill...
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Thu Dec 03, 2009 11:06 am    Post subject:
Reply with quote

Coding in a DSECT, how is that executed?
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Dec 03, 2009 1:07 pm    Post subject:
Reply with quote

Quote:
Coding in a DSECT, how is that executed


Where is there code shown in a DSECT ? I think you'll find that the DFHEIENT macro will generate CSECT.

Garry.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Thu Dec 03, 2009 1:21 pm    Post subject:
Reply with quote

I stand corrected. I had the feeling it would, but didnt know for sure.
Should have looked it up.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Thu Dec 03, 2009 8:28 pm    Post subject:
Reply with quote

Binop B wrote:
Hi Bill,

Thanks a ton for the suggestions, ideas and the code...

Binop,

The introduction of GMT calculation was not until TS 3 (3.1 or 3.2, can't recall).

So, the sub-program can be used in any CICS version/release and can be LINKED-TO by Assembler, PL/I or COBOL (with an 8-byte commarea), returning the adjustment in the 8-byte commarea, defined as 8-bytes packed-decimal, which will either be a positive (when the offset is behind GMT) or negative (when the offset is ahead of GMT and greater than P'0').

The sub-program doesn't deal with offset-minutes, but it gives someone the basis of performing this calculation, with a little bit of ingenuity, providing offset-minutes are non-zero, such as in India, Newfoundland and other areas of the globe.

Bill
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Fri Dec 04, 2009 10:32 am    Post subject:
Reply with quote

Hi,

Quote:
The sub-program doesn't deal with offset-minutes, but it gives someone the basis of performing this calculation, with a little bit of ingenuity, providing offset-minutes are non-zero, such as in India, Newfoundland and other areas of the globe.

Yup... didn't miss the trick... icon_lol.gif ... as soon as I saw your code, we were using it as a basis for the calculation and since our client are US... hours is all that's required... icon_wink.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
This topic is locked: you cannot edit posts or make replies. Get a job submitted itself every time... arunsoods JCL & VSAM 3 Tue Nov 22, 2016 4:05 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us