Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to get SYSIN data into COBOL program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to get SYSIN data into COBOL program
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

Site Director


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

PostPosted: Tue Mar 04, 2008 11:09 pm    Post subject:
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    Post subject: Reply to: How to get SYSIN data into COBOL program
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

Moderator Team Head


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

PostPosted: Tue Mar 04, 2008 11:27 pm    Post subject: Reply to: How to get SYSIN data into COBOL program
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    Post subject: Reply to: How to get SYSIN data into COBOL program
Reply with quote

Thanks Superk and the entire forum.



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

Site Director


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

PostPosted: Wed Mar 05, 2008 1:43 am    Post subject:
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

Senior Member


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

PostPosted: Wed Mar 05, 2008 3:08 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us