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 to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that

2734


How do define dynamic array in cobol.

673


What is the default value(s) for an initialize? What keyword will allow for an override of the default?

661


What are the different rules of SORT operation?

700


please..could u give an example about USAGE IS POINTER ..and explain why and when we use it ?

1958






Write some characteristics of cobol as means of business language.

621


IF I mention stop run in CICS what happens?

1898


What rules are to be followed while using the corresponding options?

641


Can we redefine the field of x(200) to less than 200?

821


Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning

686


What is the difference between perform … with test after and perform … with test before?

885


what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.

8167


What are the pertinent COBOL commands?

2626


What is the problem of ordered sequential files access?

703


What is the difference between binary search and sequential search?

643