rakeshnaredlla New User Joined: 04 Aug 2008 Posts: 26 Location: Hyderabad
I have a program which will be called both in Batch and Online . This routine has current date in its Code. The code function Current- date is not working in this program. Please suggest me any code which would run both in Batch and Online.
Robert Sample Global Moderator Joined: 06 Jun 2008 Posts: 8280 Location: Dubuque, Iowa, USA
From the COBOL Programming Guide:
22.214.171.124 Retrieving the system date and time
You cannot use a format-1 ACCEPT statement in a CICS program.
You can use these format-2 ACCEPT statements in the CICS environment to get the system date:
* ACCEPT identifier-2 FROM DATE
* ACCEPT identifier-2 FROM DATE YYYYMMDD
* ACCEPT identifier-2 FROM DAY
* ACCEPT identifier-2 FROM DAY YYYYDDD
* ACCEPT identifier-2 FROM DAY-OF-WEEK
You can use this format-2 ACCEPT statement in the CICS environment to get the system time:
* ACCEPT identifier-2 FROM TIME
The recommended way to retrieve system date and time information is to use the ACCEPT statement, because it works in all environments (CICS and non-CICS).
Bill O'Boyle CICS Moderator Joined: 14 Jan 2008 Posts: 2504 Location: Atlanta, Georgia, USA
Your COBOL version/release must be (at a minimum), COBOL/370, which is the version/release COBOL FUNCTION's were introduced.
Otherwise, review the Callable Service routine "CEELOCT" in the appropriate Language Environment manual, which can be used in COBOL II as well as its predecessor, OS/VS COBOL.
FWIW, LE is available in COBOL/370 and greater and is an integral part of the compiler.
All times are GMT + 6 Hours