A date with CICS

A date with CICS

Excerpt from Murach's CICS for the COBOL Programmer

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

    Requires Free Membership to View

    When you register, you’ll also receive targeted alerts from my team of editorial writers and independent industry experts with the latest news, tips, and advice to help you do your job more efficiently and effectively. Our goal is to keep you informed on the hottest topics and biggest challenges faced by IT professionals today working with data center technologies.

    Cathleen A. Gagne, Senior Editorial Director

    By submitting your registration information to SearchDataCenter.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDataCenter.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

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:
 

EXEC CICS

ASKTIME [ABSTIME (date-name]
END EXEC


This is the code to retrieve the absolute time

WORKING-STORAGE-SECTION.

.
.
01 DATE-AND-TIME-FIELDS.
05 ABSOLUTE-TIME PIC S9(15) COMP-3.
.
.
PROCEDURE DIVISION.
.
.
EXEC CICS
ASKTIME ABSTIME(ABSOLUTE-TIME)
END-EXEC.
.
.


Using the FORMATTIME command

Here is the syntax of the command:
 

EXEC CIS

FORMATTING ABSTIME (data-name)

[DATE(date-name)]
[FULLDATE(date-name)]
[MMDDYYYY(date-name)]
[DDMMYYYY(date-name)]
[YYYYMMDD(date-name)]
[YYYYDDMM(date-name)]
[YYYYDDD(date-name)]
[DATESEP[(date-name | literal)]
[DATEFORM(date-name)]

[DAYCOUNT(date-name)]
[DAYOFWEEK(date-name)]
[DAYOFMONTH(date-name)]
[MONTHOFYEAR(date-name)]
[YEAR(date-name)]

[TIME(date-name) [TIMESEP[(data-name | literal)]]]

END-EXEC


 

This was first published in January 2005

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.