# Time Computation in Cobol

Author Message
santhukumar

New User

Joined: 18 Sep 2009
Posts: 3
Location: India

 Posted: Wed Mar 03, 2010 6:20 pm I'm facing a problem in deducting 5 minutes from a given time. I get the system generated date and time and I need to populate the time by subtracting 5 minutes from the system generated time. Need a help in subtracting the minutes from HHMMSS. Please let me know if there is any function like Integer of Date for DATE.
Craq Giegerich

Senior Member

Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

 Posted: Wed Mar 03, 2010 6:48 pm I am sorry I didn't answer you immediately, 11 minutes is a long time to wait. Just separate the time into three signed numeric fields hh, mm, and ss. Subtract 5 from mm, if the result is less than 0 add 60 to mm and subtract 1 from hh. Then recombine the three fields into one field. If hh is less than 0 you have a problem and you will have to figure it out your self.

New User

Joined: 19 Mar 2008
Posts: 51
Location: Pune

 Posted: Wed Mar 03, 2010 6:53 pm Hi, Convert the system generated time into seconds. Subtract 300 secconds from that. Convert the result back to HHMMSS. Regards Bijal
enrico-sorichetti

Superior Member

Joined: 14 Mar 2007
Posts: 10863
Location: italy

 Posted: Wed Mar 03, 2010 6:55 pm see publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA2130/3.9.6.3.2?SHELF=&DT=20020626105928 but beware about times between 00:00:01 and 00:04:99
santhukumar

New User

Joined: 18 Sep 2009
Posts: 3
Location: India

 Posted: Wed Mar 03, 2010 6:58 pm Hi Bijal, Thanks for your reply. What if the system generated time in seconds is less than 300?
enrico-sorichetti

Superior Member

Joined: 14 Mar 2007
Posts: 10863
Location: italy

Posted: Wed Mar 03, 2010 7:02 pm

 Quote: What if the system generated time in seconds is less than 300?

that' s an issue You have to solve Yourself

if the time is a full timestamp, a proper algorithm will take You back to the previous day

hint ... convert the full timestamp to seconds/minutes subtract reconvert !

see
ibmmainframes.com/viewtopic.php?t=45058&highlight=subtract
a rexx prototype for the issue

New User

Joined: 19 Mar 2008
Posts: 51
Location: Pune

 Posted: Wed Mar 03, 2010 7:23 pm Hi Santhosh As suggested by enrico, you have to take care of it in your code. Please try & if you still face the issue, let us know. I think you have got enough of suggestions to get started. So All the Best. Regards Bijal
Bill O'Boyle

CICS Moderator

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

 Posted: Wed Mar 03, 2010 7:49 pm Take a look at the LE Callable Service routine "CEESECS". Bill PS: Oops, sorry Enrico, just saw your link....
santhukumar

New User

Joined: 18 Sep 2009
Posts: 3
Location: India

 Posted: Wed Mar 03, 2010 8:12 pm Hi, Thanks for your replies. When I am using INTEGER-OF-DATE function in my program i am getting the following error message. Compiler is ,NOCMPR2 (IBM VS COBOL II Release 4.0 09/15/92) 1. "FUNCTION" was not defined as a data-name. The statement was discarded. 2. "INTEGER-OF-DATE" was invalid. Skipped to the next verb, period or procedure-name definition. 3. "DATE-OF-INTEGER" was invalid. Skipped to the next verb, period or procedure-name definition. Please help.
Bill O'Boyle

CICS Moderator

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

 Posted: Wed Mar 03, 2010 8:20 pm COBOL Intrinsic Functions were introduced with COBOL/370, which was the successor to VS/COBOL II (your COBOL version/release), so you're out of luck with this idea. Check with your System's staff as to whether Language Environment is installed in your LPAR and then review "CEESECS". If not, then it will be a manual process, which may not be as difficult as you perceive. Bill
CICS Guy

Senior Member

Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

Posted: Wed Mar 03, 2010 8:33 pm

 santhukumar wrote: What if the system generated time in seconds is less than 300?
You will have to borrow from the DD column.....
dick scherrer

Moderator Emeritus

Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

 Posted: Wed Mar 03, 2010 9:44 pm Hello, Suggest you work thru a few "samples" using the process Craig posted (including the case when the calculated "time" is the preceeding day). Once you have written down the individul steps as you work the samples with a pencil, you can convert these steps to code. If you cannot document the steps you follow, code should not be undertaken. . .
 View Bookmarks All times are GMT + 6 Hours

 Topic Forum Replies Similar Topics Changeman - how can we know the curr... Compuware & Other Tools 2 Parallelization in CICS to reduce res... CICS 3 Dynamically pass table name to a sele... DB2 2 REXX code to expand copybook in a cob... CLIST & REXX 2 Looking for COBOL, C/C++ developer Mainframe Jobs 0
Search our Forums:

 IBMMainframes.com is not an official and/or affiliated with IBM® in anyway Board Rules | FAQ | Downloads | Wiki | SiteMap | Contact Us