|
Oh boy, I don't know why IBM hasn't done something to make this easier,
but there really isn't a direct way to load a timestamp variable in COBOL.
(Actually, I'm sure there is some legitimate reason, but it would be
awfully nice to see them do it.) You've got to get do a series of moves.
In working storage:
01 Change-time pic x(21).
01 Change-timestamp pic x(26).
And in the procedure division:
move function current-date to Change-time
string Change-time(1:4) delimited by size
'-' delimited by size
Change-time(5:2) delimited by size
'-' delimited by size
Change-time(7:2) delimited by size
'-' delimited by size
Change-time(9:2) delimited by size
'.' delimited by size
Change-time(11:2) delimited by size
'.' delimited by size
Change-time(13:2) delimited by size
'.000000' delimited by size
into Change-timestamp
end-string
move Change-timestamp to LastChange
This is where LastChange is the real timestamp variable.
HTH
P.S. This really would be a better question for the cobol400-l list or in
the COBOL forum on the iSeriesNetwork. !-)
Original message:
-----------------------
date: Tue, 13 Jan 2004 11:53:09 -0600
from: "Bruce.Vest" <Bruce.Vest@xxxxxxxxxxxxxx>
subject: [WDSCI-L] COBOL Question
I know this isn't technically a WDSC question but...
How do you get the system time into a timestamp variable in COBOL? I know
in RPG you can do it with the following D-spec:
DCurTime S T Inz(*SYS)
Bruce
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.