By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
This tip is based on "Murach's CICS for the COBOL Programmer." If you would like to purchase a copy of the book, click here.
So you are putting a CICS application together and you need date information. You use the EIBDATE and the EIBTIME fields in the Execute Interface Block, right? Yes and no. Those fields return the date and time information from when the task was started which is usually the same as the current time but not necessarily.
You would be better off using the ASKTIME and FORMATTIME commands. This tip will examine exactly how to use those commands. First, let's define what the commands actually do. The ASKTIME command is used to get an absolute time, the number of miliseconds since January 1, 1900. For example, 2:24 p.m. on Feb. 1, 2001 would be +003190026294970. When it is run, the date and time in EIBDATE and EIBTIME fields are updated. You can designate the date and time to be stored in a field you name by using the ABSTIME option.
The FORMATTIME command is used to format the date and time. It can be used to render the date in a variety of ways. For example, you can have it month-date-year or year-day. You can use it to get the number days represented by the absolute time (DAYCOUNT), the day of the week (DATEOFWEEK) or the day of the month (DATEOFMONTH).
Using the ASKTIME command
Here is the syntax for the command:
ASKTIME [ABSTIME (date-name]
This is the code to retrieve the absolute time
05 ABSOLUTE-TIME PIC S9(15) COMP-3.
Using the FORMATTIME command
Here is the syntax of the command:
FORMATTING ABSTIME (data-name)
[DATESEP[(date-name | literal)]
[TIME(date-name) [TIMESEP[(data-name | literal)]]]