Page 1 of 1

problem in writing data to a ksds file

PostPosted: Tue Sep 28, 2010 12:15 pm
by kirankumar1231
hello freinds,i am new to this ibm mainframes.i have written a sample code to write things to my ksds.but i am not successfull with it.this is the sample code which i wrote.can any body help me out.

identification division
program-id test.
data division.
working-storage section.
01 inrec.
   02 empcode pic x(4).
   02 f pic x.
   02 dayspresent pic x(2).
   02 f pic x.
   02 daysabsent pic x(2).
   02 f pic x.
   02 overtimehrs pic x(2).
   02 f pic x.
77 ke pic x(4).
77 ov pic x(2).
procedure division.
   accept inrec.
   move empcode of inrec to ke.
   move overtimehrs of inrec to ov.
   call 'checkgrade' using ke ov.
   stop run.
identification division.
program-id checkgrade.
................................
................................
...............................
................................
if   (a condition was checked)
call 'ins'.
end-if.

identification division
program-id ins.
environment division.
input-output section.
file-control.
            select infile assign to dd1
            organization indexed
            access is empcode
            record key is empcode
            file status is fs1.
data division.
file section.
fd infile.
   01 inrec.
   02 empcode pic x(4).
   02 f pic x.
   02 dayspresent pic x(2).
   02 f pic x.
   02 daysabsent pic x(2).
   02 f pic x.
   02 overtimehrs pic x(2).
   02 f pic x.
working-storage sectio.
77 fs1 pic x(2).
procedure division.
   open extend infile.
   if fs1 not = '00'
   display fs1.
   close infile.
   enf-if.
   perform wr-pa.
   perform cp-pa.
   wr-pa.              //this is the problamatic para
      accept inrec.
      write inrec.
cp-pa.
      close infile.
      exit program. 

Re: problem in writing data to a ksds file

PostPosted: Tue Sep 28, 2010 3:30 pm
by NicC
for starters you haven't passed your data from your first program to your second program. You need a linkage section and your second program should have using clause on procedure division.