problem in writing data to a ksds file



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

problem in writing data to a ksds file

Postby kirankumar1231 » Tue Sep 28, 2010 12:15 pm

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. 
kirankumar1231
 
Posts: 1
Joined: Thu Sep 02, 2010 5:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: problem in writing data to a ksds file

 

Re: problem in writing data to a ksds file

Postby NicC » Tue Sep 28, 2010 3:30 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post