Page 1 of 1

reading data(10 dates) from file& displaying changed dates

PostPosted: Mon Dec 01, 2008 1:11 pm
by sashidhar
The program to read a physical sequential file which contains 10 dates in YYYYMMDD format, and it should also display after 6 spaces the date which is 6 months after this date and after another 6 spaces from this it ashould display date which is six months prior to the first mentioned date in the ps file ,,for all 10 dates [/code

Re: reading data(10 dates) from file& displaying changed dates

PostPosted: Mon Dec 01, 2008 6:03 pm
by arunprasad.k
Hello sashidhar,

In the post there is no restriction that we should not use SQL statements, so I assumed that we can use SQL statements in the program.

Read the file and move the date to the vairable DATE-FROM-INP-FILE and execute the below SQL code in your COBOL program.

SELECT (DATE(:DATE-FROM-INP-FILE) + 6 MONTH), (DATE(:DATE-FROM-INP-FILE) - 6 MONTH)
INTO :DATE-PLUS-SIX-MON, :DATE-MINUS-SIX-MON
FROM SYSIBM.SYSDUMMY1


Post if you have any questions.

Arun.