Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 2502
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
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 3 Sat May 06, 2017 12:59 am
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts Application not run by time HH:MM tri... jzhardy IBM Tools 1 Sun Apr 09, 2017 3:22 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us