1

I was looking through some source code for a RM/COBOL program and I keep running into ACCEPT statements similar to this:

   ACCEPT field-name LINE 23, POSITION 75 PROMPT ECHO

There are similar ACCEPT statements like this one that functions as input fields but have no PROMPT ECHO alongside them.

So my question is: What is the functionality of the PROMPT ECHO?

Thanks, Chubonga93

2 Answers2

2

I can help, i use ECHO everyday, is simple as this: Whenever the ACCEPT statement is run, it shows the current value of the identifier.

Say, you have this picture:

01 WS_NAME PIC X(20) VALUE "Chubonga".

And this ACCEPT:

DISPLAY "Enter name:".
ACCEPT WS_NAME ECHO.

The program will prompt:

Enter name:
Chubonga

If you change the value of WS_NAME at execution time and the ACCEPT is rerun, it will show the new value of said identifier.


Edit: Depending on the compiler, it may or may not echo back the value if it was set by VALUE instead of MOVE or previous ACCCEPT.

Molusco
  • 59
  • 6
  • Then if I type `BILL` I get `BILLONGA`? Can you expand on that? – Bill Woodger Jun 27 '14 at 18:31
  • No, whatever you type becomes the new value. If you type `BILL` it will display `BILLONGA` until you press Enter/Return. When you press Enter/Return the new value -however- will be `BILL` and also, `BILL` will be displayed at the `ACCEPT` position. `ECHO` is a very strange statement indeed. – Molusco Jun 27 '14 at 18:45
  • Ah cool. So it's like a placeholder in HTML then. Thanks for the helpful tip, Molusco. I would upvote but not enough reps – Chubonga93 Jun 27 '14 at 19:45
1

From Micro Focus's documentation (of their support for RM/COBOL's) PROMPT clause:

The PROMPT clause causes the empty character positions in the screen item to be marked on the screen during an ACCEPT operation while the system is ready to accept operator-keyed data into that item.

The general format is

PROMPT [CHARACTER IS { identifier-1, literal-1 } ]

which doesn't account for your ECHO keyword. But this compatibility guide entry alludes to the ECHO keyword:

5.2.14 Display of Input Data in Concealed ACCEPT Fields

If you have specified OFF and ECHO clauses for the same ACCEPT statement in your program, the RM/COBOL system will conceal any data entered during input for that statement but on completion of input will display the data. This COBOL system, however, will not display the data for this ACCEPT statement once input has been completed. Solution:

If you wish to display the data input for an ACCEPT statement with the OFF and ECHO clauses specified, you must add a DISPLAY statement after the ACCEPT statement.

I see several references online that document NO ECHO (which has the effect that the user's input is not displayed to the screen) but nothing firm for ECHO. I suspect that it has no effect in your case, that is, that the user's input is echoed as usual.

David Gorsline
  • 4,933
  • 12
  • 31
  • 36
  • Ah I see. Just to make sure I read it right. The PROMPT basically converts the empty characters into spaces? – Chubonga93 Jun 27 '14 at 14:34
  • In your case, since there is no `CHARACTER` keyword, I think that it fills in the response area with copies of a default character, which might be configured in your system as a whole, or with a compile-time option. And the default default is probably a space character. – David Gorsline Jun 27 '14 at 16:45