Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
santhukumar

New User

Joined: 18 Sep 2009
Posts: 3
Location: India

 Posted: Wed Mar 03, 2010 6:20 pm    Post subject: Time Computation in Cobol 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    Post subject: 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    Post subject: Reply to: Time Computation in Cobol Hi, Convert the system generated time into seconds. Subtract 300 secconds from that. Convert the result back to HHMMSS. Regards Bijal
enrico-sorichetti

Senior Member

Joined: 14 Mar 2007
Posts: 10701
Location: italy

 Posted: Wed Mar 03, 2010 6:55 pm    Post subject: Reply to: Time Computation in Cobol see http://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    Post subject: Reply to: Time Computation in Cobol Hi Bijal, Thanks for your reply. What if the system generated time in seconds is less than 300?
enrico-sorichetti

Senior Member

Joined: 14 Mar 2007
Posts: 10701
Location: italy

Posted: Wed Mar 03, 2010 7:02 pm    Post subject: Reply to: Time Computation in Cobol

 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
http://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    Post subject: 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: 2504
Location: Atlanta, Georgia, USA

 Posted: Wed Mar 03, 2010 7:49 pm    Post subject: Reply to: Time Computation in Cobol 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    Post subject: Reply to: Time Computation in Cobol 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: 2504
Location: Atlanta, Georgia, USA

 Posted: Wed Mar 03, 2010 8:20 pm    Post subject: Reply to: Time Computation in Cobol 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: 2149
Location: At my coffee table

Posted: Wed Mar 03, 2010 8:33 pm    Post subject: Re: Reply to: Time Computation in Cobol

 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: 19254
Location: Inside the Matrix

 Posted: Wed Mar 03, 2010 9:44 pm    Post subject: 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. . .
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Missing Negative sign in COBOL jzhardy COBOL Programming 6 Sat Sep 26, 2020 11:32 am COBOL reading from SYSIN jzhardy COBOL Programming 1 Mon Sep 21, 2020 2:37 pm how to read accounting information in... jzhardy COBOL Programming 1 Mon Sep 21, 2020 9:57 am How to process dependent file based o... HithaSri JCL & VSAM 8 Sun Sep 06, 2020 12:42 pm NOT IN clause in COBOL pgm mramvivek COBOL Programming 8 Thu Aug 20, 2020 4:48 am

 © 2003-2020 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us