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

What will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(9) VALUE SPACES. 01 WS-VARN REDEFINES WS-VARX PIC 9(9).

8 Answers  


What do you do to resolve SOC-7 error?

2 Answers   Sun Life, Wipro,


Explain complete concept of table handling in COBOL with an example?

2 Answers   IBM, TCS, Wipro,


Study the DATA DIVISION entries and the three PROCEDURE DIVISION entries given below: 01 END-OF-FILE-SWITCH PIC XXX. 88 NO-MORE-RECS VALUE "YES". 88 MORE-RECS VALUE "NO". (i) READ SAMPLE-FILE AT END MOVE "YES" TO NO-MORE-RECS. (ii) IF NO-MORE-RECS = "YES" GO TO LAST-PARA. (iii) IF NO-MORE-RECS GO TO LAST-PARA. Which are wrong? (a) (i) and (ii) (b) (ii) and (iii) (c) (i) and (iii) (d) all

5 Answers   TCS,


if one main program ,n -subprograms are then which call you follow ?why reasonuhg

4 Answers   UHG,






Can we move X(7) to S9(7) COMP?

1 Answers  


what is the advantage of using redefines instead of delaring the variables ?

5 Answers   HCL,


What is diff betn PS and ESDS file? What is the diffrent compiler options in cobol and there discription? What is retrive nth maximum salary from salary DB2 table. Can we redefine COM-3 variable with varchar variable?

4 Answers  


01 NAME1 PIC X(13) VALUE "COBOL PROGRAMMING". 01 NAME2 PIC X(13). now I want to display the value of NAME1 in reverse order i.e value should be displayed as "GNIMMARGORP LOBOC" HOW can I do that ??? please let me know if any one knows it.

11 Answers   FirstApex, NIIT,


using redefine can you redefine lower variable size to higher variable size?

3 Answers   Patni,


What are INPUT PROCEDURE and OUTPUT PROCEDURE?

0 Answers  


can u give result for the fallowing example... 05 a pic 9(2) 05 b redifines a pic x(2). move 'xy' to b. display a,b.

10 Answers   IBM,


Categories