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
 
system date and time

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
padmaraghav

New User


Joined: 17 Dec 2003
Posts: 2

PostPosted: Thu Dec 18, 2003 1:20 am    Post subject: system date and time
Reply with quote

H y'all

can anybody tell me how to get the system date and time and how to display it??

Thanks
Back to top
View user's profile Send private message

sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 151
Location: Tokyo, Japan

PostPosted: Fri Dec 26, 2003 2:47 pm    Post subject:
Reply with quote

Hi padmaraghav,

Can you elaborate your query a little bit ?...which language,platform are you using?

If you use COBOL, you can use -

ACCEPT DATE INTO WS-DATE.
ACCEPT TIME INTO WS-TIME.
DISPLAY WS-DATE WS-TIME.

Regards,
Sandip.
Back to top
View user's profile Send private message
Sharan

New User


Joined: 22 Dec 2003
Posts: 6
Location: Banaglore

PostPosted: Mon Dec 29, 2003 5:17 pm    Post subject:
Reply with quote

Just want to add a little bit on ACCEPT DATE

When you use ACCEPT WS-DATE FROM DATE
29th, Dec , 2003 would be represented as 031229

If you want the date from the system in the format YYYYMMDD you can use ACCEPT WS-DATE FROM DATE YYYYMMDD
29th, Dec , 2003 would be represented as 20031229

If you want the date from the system in the format YYYYDDD you can use ACCEPT WS-DATE FROM DAY YYYYDDD
In this case it would give you the current year and the total number of days starting from Jan 1 of that year
29th, Dec , 2003 would be represented as 2003363

You can also use ACCEPT DAY-OF-WEEK which would give the current day of the week i.e.
1 would mean Monday, 2 would mean tuesday and so on.


If you want to get date from DB2, you could query SYSIBM.SYSDUMMY1 to get the current date or time

SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1 ---- 2003-12-29
SELECT CURRENT_DATE FROM SYSIBM.SYSDUMMY1 ---- 2003-12-29
SELECT CURRENT TIME FROM SYSIBM.SYSDUMMY1 ---- 06.43.08
SELECT CURRENT_TIME FROM SYSIBM.SYSDUMMY1 ----- 06.43.08

Please not that we can also get timestamp from SYSIBM.SYSDUMMY1


Hope this helps
Thanks,

Sharan
Back to top
View user's profile Send private message
dipakgoyal
Warnings : 1

New User


Joined: 02 Aug 2007
Posts: 18
Location: Kolkata

PostPosted: Thu Apr 17, 2008 5:57 pm    Post subject: PIC clauses for "ACCEPT FROM DATE"
Reply with quote

Thanks Sharan.

The information is very valuable.

On an additional note,
Its worth mentioning the restriction on the pic clause of the host-variable:

i.e:
for "ACCEPT WS-DATE FROM DATE "
WS-DATE should have PIC clause as 9(6).

Simliarly for " ACCEPT WS-DATE FROM DATE YYYYMMDD ",
it should be 9(8)
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: Thu Apr 17, 2008 6:54 pm    Post subject: Re: system date and time
Reply with quote

padmaraghav wrote:
can anybody tell me how to get the system date and time and how to display it??
Take a look at the ACCEPT statement and the intrinsic function CURRENT-DATE.
Then look at the DISPLAY statement.
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: Thu Apr 17, 2008 9:44 pm    Post subject: Language Environment?
Reply with quote

If you're on a COBOL version which does NOT support FUNCTION's (IE: COBOL2), then take a look at the LE (Language Environment) Callable Service routine "CEELOCT", which returns a CCYYMMDD date and an HHMMSSTHM time.

Regards,

Bill
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Apr 17, 2008 10:42 pm    Post subject:
Reply with quote

Hi,

Not sure how good it to quote the start date of this thread..
Quote:
Posted: Thu Dec 18, 2003 12:50 am


I was in college that time.. icon_smile.gif
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: Thu Apr 17, 2008 10:48 pm    Post subject:
Reply with quote

Anuj D. wrote:
Not sure how good it to quote the start date of this thread..
Quote:
Posted: Thu Dec 18, 2003 12:50 am
Geez, usually I catch those...boy, did I get sucked into that.....
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
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 Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am

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