I am new at COBOL and learning from a book. I have a problem with the verb ACCEPT.
Here is the code I have written
WORKING-STORAGE SECTION.
01 UserName PIC X(20).
*-----------------------
PROCEDURE DIVISION.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Begin.
DISPLAY "Please enter your name - " WITH NO ADVANCING
ACCEPT UserName
DISPLAY "************************************"
DISPLAY "Name is: " UserName
STOP RUN.
Compilation is done smoothly but when I run it the prompt waits for me to enter the UserName but Please enter your name- does not appear.
Itâs been a long time; so, I first imagined that there might be a problem with the coding. I wanted to suggest putting a âperiodâ (â.â) at the end of each statement. But, that wouldnât have made sense; because, you said that the program compiled, and that you got to the âACCEPTâ statement, without he program crashing.
So, now, Iâm imagining that youâre using an âOUTDD(ddname)â option, on the instruction that you give to the computer, when compiling.
Here is the content of a description of the explanation, from IBM, on the effects of using the âOUTDD(ddname)â option, when compiling the code:
âUse this option to override the default ddname (SYSOUT) for SYSOUT output that goes to the system logic output unit. If the ddname is the same as the Language EnvironmentÂŽ MSGFILE ddname, the output is routed to the ddname designated for MSGFILE. If the ddname is not the same as the Language Environment MSGFILE ddname, the output from the DISPLAY statement is directed to the OUTDD ddname destination. If the ddname is not present at first reference, dynamic allocation will take place with the default name and attributes that are specified by Language Environment.â
âCOMPILER OPTIONS FOR CONVERTED PROGRAMSâ page