Four ways in CICS to write error free TIME logic

There are four kinds of issues…

The number one is…

ASK TIME

You will get time in the format as mentioned by your admin. By mistake if you use this time, you may get incorrect result. Always use FORMATTIME to change date or time into your local format.

The second one is…

You do not know, but during changing of local time , admin must reset the time.

CEMT PERFORM RESET

Then it syncs to local time

The third one is..

Why ASKTIME and FORMATTIME you need

Time already there in EIBDATE and EIBTIME fields

You should know how to use above fields. Else, you will get incorrect time.

The fourth one is…

You need to know why ASKTIME is being used in CICS programs.

The reason is to get timestamp for logging purpose.


Employment Change and Projections

 


Subscribe to our emailing list


Syntax for FORMATTIME and ASKTIME

CICS Date/Time Functions

 WORKING-STORAGE SECTION.
 01  WS-TIME                                      PIC S9(15) COMP-3 VALUE 0.
 01  PRINT-DATE                                   PIC X(08)  VALUE ‘12/01/99’.
 01  PRINT-TIME                                   PIC X(08)  VALUE ‘09:30:00’.
 …
 PROCEDURE DIVISION.
 …
 EXEC CICS
          ASKTIME  ABSTIME(WS-TIME)
 END-EXEC
 …
 EXEC CICS
          FORMATTIME  ABSTIME(WS-TIME)
                      MMDDYY(PRINT-DATE)
                      DATESEP(‘/’)

 END-EXEC
 …
 EXEC CICS
          FORMATTIME  ABSTIME(WS-TIME)
                      TIME(PRINT-TIME)
                      TIMESEP(‘:’)
 END-EXEC
**********   Other Formats Available   (There are more!)   **************
 EXEC CICS
          FORMATTIME  ABSTIME(WS-TIME)
                       YYDDD(DATA-AREA)              YY/DDD
                       YYMMDD(DATA-AREA)          YY/MM/DD
 DATESEP(‘-‘)                               YY-MM-DD ]
*                 Following 4 receiving fields are defined as:   PIC S9(08) COMP.
                       DAYOFWEEK(DATA-AREA)   Sun=0, Mon=1,…
                       DAYOFMONTH(DATA-AREA)
                       MONTHOFYEAR(DATA-AREA) Jan=1, Feb=2,…
                       YEAR(DATA-AREA)                  4 DIGIT YEAR!!
 END-EXEC

 

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.