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

How to accept keyboard input in COBOL program.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Feb 11, 2010 5:48 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Feb 11, 2010 7:15 pm
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

Global Moderator


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

PostPosted: Thu Feb 11, 2010 7:31 pm
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
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

Global Moderator


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

PostPosted: Thu Feb 11, 2010 9:11 pm
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

Moderator Emeritus


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

PostPosted: Thu Feb 11, 2010 10:11 pm
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
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

Moderator Emeritus


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

PostPosted: Fri Feb 12, 2010 12:02 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top