Page 1 of 1

How to accept multiple lines of Instream data

PostPosted: Thu Apr 29, 2010 12:38 pm
by shruti
Hi,

I have to pass 10 lines of instream data from jcl to cobol.
How to achieve it through accept statement in cobol and how can we make sure that end of data has been reached.

This has been asked in one of the interview.Can somebody please help me out in getting answer.

Thanks
Shruti

Re: How to accept multiple lines of Instream data

PostPosted: Thu Apr 29, 2010 12:48 pm
by swd
Shruti,

look at the "The COBOL Program using SYSIN with Multiple Parameters" section of this web site http://www.simotime.com/cblpar01.htm

It explains it quite well

Cheers
Steve

Re: How to accept multiple lines of Instream data

PostPosted: Thu Apr 29, 2010 4:45 pm
by Robert Sample
Why not use SELECT ... ASSIGN TO SYSIN and handle this with COBOL'S READ statement, which is designed for it?

Re: How to accept multiple lines of Instream data

PostPosted: Fri Apr 30, 2010 2:57 am
by dick scherrer
Hello,

If an interviewer asked me how to handle multiple SYSIN records using ACCEPT, my answer would be that this is not permitted on systems with any kind of good programming standards.

As Robert mentioned, this should be done with SELECT/ASSIGN and then OPEN/READ/CLOSE within the code - not ACCEPT.