IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to get SYSIN data into COBOL program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
tushar_study

New User


Joined: 01 Feb 2007
Posts: 30
Location: Mumbai

PostPosted: Tue Mar 04, 2008 10:59 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Mar 04, 2008 11:09 pm
Reply with quote

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
View user's profile Send private message
tushar_study

New User


Joined: 01 Feb 2007
Posts: 30
Location: Mumbai

PostPosted: Tue Mar 04, 2008 11:16 pm
Reply with quote

I have been asked specifically to use a SYSIN card.

Regards
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Mar 04, 2008 11:27 pm
Reply with quote

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
View user's profile Send private message
tushar_study

New User


Joined: 01 Feb 2007
Posts: 30
Location: Mumbai

PostPosted: Tue Mar 04, 2008 11:47 pm
Reply with quote

Thanks Superk and the entire forum.



Regards,
Tushar
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 05, 2008 1:43 am
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Mar 05, 2008 3:08 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
Search our Forums:

Back to Top