ACCEPT a Name
Part of the First Programs section of Coddy's COBOL Programming journey. Lesson 11 of 19.
ACCEPT reads one line the user types and stores it in a field:
ACCEPT USER-NAME.The line fills the field from the left. A short line is padded with spaces, and a long one is cut to the field's size: Lovelace typed into a PIC X(5) stores Lovel.
Each ACCEPT reads the next line. In the challenges, the test's input lines are what the user types, one line per ACCEPT.
Challenge
EasyRead a name into USER-NAME, then display Hello, followed by the name.
Example input, one line per ACCEPT: Ada.
Try it yourself
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLONM.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USER-NAME PIC X(10).
PROCEDURE DIVISION.
*> Read the name, then greet
STOP RUN.