How do you fetch current date in normal cobol pgm and in
cobol-db2 pgm?

Answer Posted / sharath

Normal program
--------------
WORKING-STORAGE SECTION..
01 WS-DATE PIC X(6).
01 CURDATE.
05 WS-DATE-20 PIC X(2) VALUE '20'.
05 WS-DATE-YR PIC X(2).
05 FILLER PIC X(1) VALUE '/'.
05 WS-DATE-MT PIC X(2).
05 FILLER PIC X(1) VALUE '/'.
05 WS-DATE-DT PIC X(2).
PROCEDURE DIVISON..
ACCEPT WS-DATE FROM DATE
MOVE WS-DATE(1:2) TO WS-DATE-YR
MOVE WS-DATE(3:2) TO WS-DATE-MT
MOVE WS-DATE(5:2) TO WS-DATE-DT
DISPLAY CURDATE

Cobol-DB2
--------

Just writing the query..

Select CURRENT DATE into
:ws-date
from SYSIBM.SYSDUMMY




Is This Answer Correct ?    14 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you reference the following file formats from cobol programs?

688


Name the divisions, which are available in a cobol program?

675


Why did you choose to work with ibm mainframe cobol programming?

623


When is inspect verb is used in cobol?

666


how do you reference the variable block file formats from cobol programs

672






What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?

666


Why would you use find and get rather than to obtain?

673


How do we get current date from system with century in COBOL?

792


2 input fles: 2 flat files, with different number of records. both are having unique key for each record and already sorted in ascending order . match these files using unique key and in output only matching key value has to be written. please procide cobol logic

2086


What is the utilization of copybook in cobol? Could we utilize a similar copybook?

704


What is the difference between next sentence and continue in cobol programing language?

695


What are the different rules of SORT operation?

689


State the various causes of s0c1, s0c5 and s0c7.

654


what is the use of outrecord?

1763


What rules are followed by the search verb.

629