View previous topic :: View next topic
|
Author |
Message |
tushar_study
New User
Joined: 01 Feb 2007 Posts: 30 Location: Mumbai
|
|
|
|
I have a scenario wherein I am required to read records from a SYSIN
file. The SYSIN file can have variable number of records. In my cobol
program I need to read these records and load them into a cobol table and do further processing.
How to read the SYSIN file in my cobol. (I can use ACCEPT verb in my cobol but what will be the terminating condition of the PERFORM i.e. how do I know that the End of SYSIN file has been reached).
I will be using an OCCURS ...DEPENDING ON clause in my COBOL.
Regards |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Your process will work better if you use a SELECT, an FD, etc rather than ACCEPT. Many systems will not allow ACCEPT from SYSIN n production programs.
If you use an FD, eof of file is not an issue. |
|
Back to top |
|
|
tushar_study
New User
Joined: 01 Feb 2007 Posts: 30 Location: Mumbai
|
|
|
|
I have been asked specifically to use a SYSIN card.
Regards |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
I believe that you have to control the end-of-data by creating your own delimiter. ACCEPT until you read the delimiter.
See this previous topic. |
|
Back to top |
|
|
tushar_study
New User
Joined: 01 Feb 2007 Posts: 30 Location: Mumbai
|
|
|
|
Thanks Superk and the entire forum.
Regards,
Tushar |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I have been asked specifically to use a SYSIN card. |
Yes, and if you use an FD and assign the ddname to SYSIN, you will meet that requirement and not use the (at best) questionable process of trying to ACCEPT the input data and creating your own logical end-of-file value..
If you look at the topic referred to, you will also see the SELECT/FD alternative recommended there.
FWIW. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
dick scherrer wrote: |
Quote: |
I have been asked specifically to use a SYSIN card. |
Yes, and if you use an FD and assign the ddname to SYSIN you will meet that requirement |
Yes in my shop as well ACCEPT is not permitted. Talk to Your peers once. |
|
Back to top |
|
|
|