I would suggest reviewing the <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books/sc092539.pdf">ILE COBOL Reference</a> and in the chapter on Procedure Division Statements the description of ACCEPT identifer-1 FROM DATE YYYYMMDD. You may also want to explore the chapter on Intrinsic Functions.
Bruce Vining
<a href="http://www.brucevining.com/">http://www.brucevining.com/</a>
Providing integrated solutions for the System i user community
ACCEPT <field> from DATE
will only return a date in YYMMDD format.
To get the full system date, try this....
Identification Division.
Program-Id. TimeDateCB.
Author. Charles Siu.
Environment Division.
Configuration Section.
Source-Computer. AS400.
Object-Computer. AS400.
Data Division.
Working-Storage Section.
01 Current-Timestamp.
05 Current-Year Pic 9(4).
05 Current-Month Pic 9(2).
05 Current-Date Pic 9(2).
05 Current-Hour Pic 9(2).
05 Current-Minute Pic 9(2).
05 Current-Second Pic 9(2).
05 Current-100thSec Pic 9(2).
05 GMT-Variation Pic X.
05 GMT-Hour-Difference Pic 9(2).
05 GMT-Min-Difference Pic 9(2).
Procedure Division.
MOVE FUNCTION CURRENT-DATE TO Current-Timestamp.
STOP RUN.
By the way, I am an RPG programmer too, in search of COBOL/400 knowledge.
Last Wiki Answer Submitted: May 5, 2010 3:40 pm by bvining6,055 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
01 WS-DATE.
05 WS-CC PIC 9(002).
05 WS-YY PIC 9(002).
05 WS-MM PIC 9(002).
05 WS-DD PIC 9(002).
01 ISO-TODAY
FORMAT DATE “@Y-%m-%d”.
ACCEPT WS-DATE FROM DATE YYYYMMDD.
MOVE FUNCTION CONVERT-DATE-TIME ( WS-DATE DATE “%Y%m%d” )
TO ISO-TODAY.