IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Time Computation in Cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
santhukumar

New User


Joined: 18 Sep 2009
Posts: 3
Location: India

PostPosted: Wed Mar 03, 2010 6:20 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Wed Mar 03, 2010 6:48 pm
Reply with quote

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.
Back to top
View user's profile Send private message
bijal.awhad

New User


Joined: 19 Mar 2008
Posts: 51
Location: Pune

PostPosted: Wed Mar 03, 2010 6:53 pm
Reply with quote

Hi,

Convert the system generated time into seconds. Subtract 300 secconds from that.

Convert the result back to HHMMSS.

Regards
Bijal
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Mar 03, 2010 6:55 pm
Reply with quote

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
Back to top
View user's profile Send private message
santhukumar

New User


Joined: 18 Sep 2009
Posts: 3
Location: India

PostPosted: Wed Mar 03, 2010 6:58 pm
Reply with quote

Hi Bijal,

Thanks for your reply.

What if the system generated time in seconds is less than 300?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Mar 03, 2010 7:02 pm
Reply with quote

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


that' s an issue You have to solve Yourself icon_biggrin.gif

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
Back to top
View user's profile Send private message
bijal.awhad

New User


Joined: 19 Mar 2008
Posts: 51
Location: Pune

PostPosted: Wed Mar 03, 2010 7:23 pm
Reply with quote

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
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Wed Mar 03, 2010 7:49 pm
Reply with quote

Take a look at the LE Callable Service routine "CEESECS".

Bill

PS: Oops, sorry Enrico, just saw your link.... icon_eek.gif
Back to top
View user's profile Send private message
santhukumar

New User


Joined: 18 Sep 2009
Posts: 3
Location: India

PostPosted: Wed Mar 03, 2010 8:12 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Wed Mar 03, 2010 8:20 pm
Reply with quote

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
Back to top
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Wed Mar 03, 2010 8:33 pm
Reply with quote

santhukumar wrote:
What if the system generated time in seconds is less than 300?
You will have to borrow from the DD column.....
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Mar 03, 2010 9:44 pm
Reply with quote

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. . .
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top