Home > Software > Mainframe > Cobol
Interview Questions   Tutorials   Discussions   Programs   

Cobol - How can we get current date and time through Cobol program?




403
views
asked mar August 3, 2014 03:07 AM  

How can we get current date and time through Cobol program?


           

1 Answers



 
answered By Mswami   0  
By using Intrinsic function, FUNCTION CURRENT-DATE.
CURRENT DATE -  Returns 21 Chars alphanumeric value – YYYYMMDDHHMMSSnnnnnn

ACCEPT can transfer data from input device or system information contain in the reserved data items like DATE, TIME, DAY.

ACCEPT WS-VAR1 (FROM DATE/TIME/DAY/OTHER SYSTEM VARS).
If FROM Clause is not coded, then the data is read from terminal. At the time of execution, batch program will ABEND if there is no in-stream data from JCL and there is no FROM clause in the ACCEPT clause.

DATE option returns six digit current date in YYYYMMDD
DAY returns 5 digit current date in YYDDD
TIME returns 8 digit RUN TIME in HHMMSSTT
DAY-OF-WEEK returns single digit whose value can be 1-7 (Monday-Sunday respectively)


flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert