How to accept a string from a user and display the string in COBOL

1 Answer

0 votes
IDENTIFICATION DIVISION.
PROGRAM-ID. INPUT_STRING.
DATA DIVISION.
    WORKING-STORAGE SECTION.
        77 STR PIC A(10).  
PROCEDURE DIVISION.
    ACCEPT STR.                          
    DISPLAY "Your input is: " STR.    
STOP RUN.


*> STDIN COBOL


*> run:
*>
*> Your input is: COBOL  
*>

 



answered Oct 24, 2024 by avibootz
edited Oct 25, 2024 by avibootz
...