Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Time Computation in Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Time Computation in Cobol
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    Post subject:
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    Post subject: Reply to: Time Computation in Cobol
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Wed Mar 03, 2010 6:55 pm    Post subject: Reply to: Time Computation in Cobol
Reply with quote

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
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    Post subject: Reply to: Time Computation in Cobol
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

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

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

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

PostPosted: Wed Mar 03, 2010 8:33 pm    Post subject: Re: Reply to: Time Computation in Cobol
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

Site Director


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

PostPosted: Wed Mar 03, 2010 9:44 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
This topic is locked: you cannot edit posts or make replies. 00D3003B - time outs in DB2 when invo... chavinash2004 DB2 2 Mon Oct 09, 2017 4:39 pm
No new posts VSAM RLS Wait time blayek JCL & VSAM 2 Mon Oct 02, 2017 9:05 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us