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



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

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

Postby sashidhar » Mon Dec 01, 2008 1:11 pm

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
sashidhar
 
Posts: 1
Joined: Mon Dec 01, 2008 10:25 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby arunprasad.k » Mon Dec 01, 2008 6:03 pm

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.
arunprasad.k
 
Posts: 110
Joined: Thu Dec 27, 2007 5:18 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post