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

system date and time


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 150
Location: Tokyo, Japan

PostPosted: Fri Dec 26, 2003 2:47 pm
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
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
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: 2146
Location: At my coffee table

PostPosted: Thu Apr 17, 2008 6:54 pm
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Apr 17, 2008 9:44 pm
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

Superior Member


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

PostPosted: Thu Apr 17, 2008 10:42 pm
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: 2146
Location: At my coffee table

PostPosted: Thu Apr 17, 2008 10:48 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Sysplex System won't IPL at DR site I... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts RC query -Time column CA Products 3
Search our Forums:

Back to Top