[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] accept a keystroke?

From: Michael
Subject: Re: [open-cobol-list] accept a keystroke?
Date: Tue, 05 Jan 2010 11:30:23 -0600
User-agent: Thunderbird (Windows/20090812)

You may want to explain what your definition of "keystroke" is. The Accept verb will read from stdin by default. The From clause will change that. The gotcha with the accept verb, is size. For example on my old favorite platform (HP3000), when accepting into a ten character variable I can type two characters and press return ( carriage control ), and the HP Cobol will return the two characters, with the remaining eight unchanged. I always initialize the variable before the accept. Other Cobol flavors don't do this, they make you enter all ten characters and C/R, their maybe other options on the accept verb that will make it work like the old HP Cobol did, I donno ;-)

I'm not sure how to do this in OpenCobol, without some intrinsic function, but.... Have you looked into opening the stdin file and using read/write statements? In the past I've found this to work better, because I'd write the applications to accept anything, and then write my own editing of whatever was entered, returning the appropriate error messages and so on. Gives me more control of how the user interacts with the application.

Michael Anderson.

Guillaume Yziquel wrote:

I'm quite new to Cobol, and I have a simple cobol question about the ACCEPT command.

I've been reading documentation at

and I'd like to use the ACCEPT command to capture a keystroke, and not a string + \n statement. Only the keystroke, no return.

How do I do that with ACCEPT? More generally, what do you cobol guys do when you need documentation? Where do you find it?

All the best,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]