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 accept keyboard input in COBOL program.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
kailas girase

New User


Joined: 20 Nov 2008
Posts: 6
Location: New Bombay

PostPosted: Thu Feb 11, 2010 4:49 pm    Post subject: How to accept keyboard input in COBOL program.
Reply with quote

I have tried below program but given compiler error for CONSOLE word.
Code:

IDENTIFICATION DIVISION.                     
PROGRAM-ID HELLO1.                           
ENVIRONMENT DIVISION.                         
CONFIGURATION SECTION.                       
               
DATA DIVISION.                               
WORKING-STORAGE SECTION.                     
77 IN-VAR1        PIC X(10) VALUE 'KAILAS '. 
PROCEDURE DIVISION.                           
FIRST-PARA.                                   
       DISPLAY "Hello World".                       
       ACCEPT IN-VAR1 FROM CONSOLE.           
       DISPLAY "HELLO " IN-VAR1.             
    STOP RUN.
Back to top
View user's profile Send private message

Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Thu Feb 11, 2010 5:40 pm    Post subject:
Reply with quote

I can tell you that even if you get this program to work, you probably will get an annoying call from someone in your organisation for wasting peoples' time tying up the master console.

This kind of programming you can do for your pc - not for a mainframe. I guess you're not programming on a scrap s/370 you have set up in your garage?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Thu Feb 11, 2010 5:48 pm    Post subject:
Reply with quote

There is a link at the top of the page to manuals. Click on it, find the COBOL Language Reference manual, and read section 6.2.1.1 on the ACCEPT statement. You will find that, if you want to use the word CONSOLE in your ACCEPT statement, you must identify it elsewhere in your COBOL program.

Additionally, as Kjeld said, many (probably almost all) sites prohibit ACCEPT FROM CONSOLE due to the vast number of messages already routed to the console and not wanting to waste operator time attempting to find out how to reply to an application message.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Thu Feb 11, 2010 7:15 pm    Post subject: Reply to: How to accept keyboard input in COBOL program.
Reply with quote

Quote:
I guess you're not programming on a scrap s/370 you have set up in your garage?


No a PC is more than enough, less floor space, no air conditioning, less... icon_biggrin.gif
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: Thu Feb 11, 2010 7:31 pm    Post subject: Reply to: How to accept keyboard input in COBOL program.
Reply with quote

Hmm. Compiled and ran just fine for me. icon_confused.gif
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Thu Feb 11, 2010 7:55 pm    Post subject: Re: Reply to: How to accept keyboard input in COBOL program.
Reply with quote

superk wrote:
Hmm. Compiled and ran just fine for me. icon_confused.gif

Do you have access to the operator console at your site, or did you liason with an operator to run this program?

Or it might possibly execute from a TSO command prompt using your terminal as console unit?
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: Thu Feb 11, 2010 9:11 pm    Post subject: Re: Reply to: How to accept keyboard input in COBOL program.
Reply with quote

Kjeld wrote:
Do you have access to the operator console at your site...?


I'm on the Enterprise Automation Team, so yes I do. I couldn't do a lot of the job without that access.
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: Thu Feb 11, 2010 10:11 pm    Post subject:
Reply with quote

Hello Kailas Girase,

If you are going to work on a mainframe, suggest you forget that there is a system CONSOLE. . .

Most organizations no longer permit application code to interact with the system console. . .
Back to top
View user's profile Send private message
kailas girase

New User


Joined: 20 Nov 2008
Posts: 6
Location: New Bombay

PostPosted: Fri Feb 12, 2010 11:50 am    Post subject: Thanks for all reply I got
Reply with quote

Now I can concluse that "Its never possible to give keyboard input for cobol program".
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: Fri Feb 12, 2010 12:02 pm    Post subject:
Reply with quote

Hello,

Quote:
"Its never possible to give keyboard input for cobol program".
Incorrect.

It is possible (i.e. the compiler will successfully compile the code).

Well managed organizations do not permit this.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Fri Feb 12, 2010 3:07 pm    Post subject:
Reply with quote

It is possible, but it should not be used in this form. If you want users to key in data you should be using a TP environment like CICS or IMS.

Also the ISPF environment in TSO provide terminal input and output possibilities.
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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm


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