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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / v@m$i

Mr sharath small suggestion.
u r logic is correct.
but use current date instead of date in normal program.

Is This Answer Correct ?    3 Yes 1 No

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

Answer / adithya

procedure division.

accept a from date.

accept b from date

accept c from day-of-week

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More COBOL Interview Questions

How are the next sentence and continue different from each other?

0 Answers  


HOw can I get the negative sign while deduct high value from low value

0 Answers  


Which Search verb is equivalent to PERFORM…VARYING?

0 Answers  


I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?

0 Answers   HCL,


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

0 Answers  






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

1 Answers   Syntel,


How to open and see copy book ?

3 Answers  


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

0 Answers   Winsol Solutions,


How to read a 100 record from a file through cobol?

2 Answers  


How many maximum number of procedures can we write in one COBOL program?

5 Answers  


what if any ,is the syntex error in the following piece of code 01 B PIC A(7) 02 C PIC 9(4) ........ IF(B NUMERIC) ADD 10 TO C a.the condition in the if statement is wrong b.noting is wrong c.because C is initialised.ADD 10 TO C is wrong d.both B and C shoud have same size.

5 Answers   TCS,


write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc

0 Answers  


Categories