I am using Fujitsu COBOL v 3.0. In the following source code, I have a field named 'INPUT-EMAIL' in the FD. If the email id entered is less than 30 characters, then I have to enter trailing spaces in order to make the program continue. The program execution just sits there waiting for the trailing spaces. How can I avoid entering trailing spaces?
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE1.
AUTHOR. ADITYA.
*
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATAFILE
ASSIGN TO DISK
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD DATAFILE.
01 INPUT-RECORD.
05 PERSON-RECORD.
10 FIRSTNAME PIC X(6).
10 PIC X.
10 LASTNAME PIC X(9).
10 PIC X.
10 PHONE PIC X(10).
10 PIC X.
10 FAX PIC X(10).
10 PIC X.
10 EMAIL PIC X(30).
10 PIC X.
WORKING-STORAGE SECTION.
01 WORD-INDEX PIC 9(3).
01 INPUT-PERSON.
05 INPUT-FIRST-NAME PIC X(6).
05 PIC X VALUE SPACES.
05 INPUT-LAST-NAME PIC X(9).
05 PIC X VALUE SPACES.
05 INPUT-PHONE PIC X(10).
05 PIC X VALUE SPACES.
05 INPUT-FAX PIC X(10).
05 PIC X VALUE SPACES.
05 INPUT-EMAIL PIC X(30).
05 PIC X VALUE SPACES.
01 REQUEST-MESSAGE PIC X(42)
VALUE "DIGITAL ORGANIZER".
01 OPTION PIC 9.
*
PROCEDURE DIVISION.
DATA-INPUT SECTION.
OPEN OUTPUT DATAFILE.
DISPLAY REQUEST-MESSAGE.
DISPLAY "Enter your information:".
LOOP-INPUT.
DISPLAY "LAST-NAME: " WITH NO ADVANCING.
ACCEPT INPUT-LAST-NAME.
DISPLAY "FIRST-NAME: " WITH NO ADVANCING.
ACCEPT INPUT-FIRST-NAME.
DISPLAY "PHONE: " WITH NO ADVANCING.
ACCEPT INPUT-PHONE.
DISPLAY "FAX: " WITH NO ADVANCING.
ACCEPT INPUT-FAX.
DISPLAY "EMAIL: " WITH NO ADVANCING.
ACCEPT INPUT-EMAIL.
MOVE INPUT-PERSON TO INPUT-RECORD.
WRITE INPUT-RECORD.
* CLOSE DATAFILE.
DISPLAY "SELECT AN OPTION".
DISPLAY "1 - NEW".
DISPLAY "2 - EXIT".
ACCEPT OPTION.
IF OPTION = 1 THEN
GO TO LOOP-INPUT
ELSE
CLOSE DATAFILE.
EXIT PROGRAM.
END PROGRAM SAMPLE1.
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE1.
AUTHOR. ADITYA.
*
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATAFILE
ASSIGN TO DISK
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD DATAFILE.
01 INPUT-RECORD.
05 PERSON-RECORD.
10 FIRSTNAME PIC X(6).
10 PIC X.
10 LASTNAME PIC X(9).
10 PIC X.
10 PHONE PIC X(10).
10 PIC X.
10 FAX PIC X(10).
10 PIC X.
10 EMAIL PIC X(30).
10 PIC X.
WORKING-STORAGE SECTION.
01 WORD-INDEX PIC 9(3).
01 INPUT-PERSON.
05 INPUT-FIRST-NAME PIC X(6).
05 PIC X VALUE SPACES.
05 INPUT-LAST-NAME PIC X(9).
05 PIC X VALUE SPACES.
05 INPUT-PHONE PIC X(10).
05 PIC X VALUE SPACES.
05 INPUT-FAX PIC X(10).
05 PIC X VALUE SPACES.
05 INPUT-EMAIL PIC X(30).
05 PIC X VALUE SPACES.
01 REQUEST-MESSAGE PIC X(42)
VALUE "DIGITAL ORGANIZER".
01 OPTION PIC 9.
*
PROCEDURE DIVISION.
DATA-INPUT SECTION.
OPEN OUTPUT DATAFILE.
DISPLAY REQUEST-MESSAGE.
DISPLAY "Enter your information:".
LOOP-INPUT.
DISPLAY "LAST-NAME: " WITH NO ADVANCING.
ACCEPT INPUT-LAST-NAME.
DISPLAY "FIRST-NAME: " WITH NO ADVANCING.
ACCEPT INPUT-FIRST-NAME.
DISPLAY "PHONE: " WITH NO ADVANCING.
ACCEPT INPUT-PHONE.
DISPLAY "FAX: " WITH NO ADVANCING.
ACCEPT INPUT-FAX.
DISPLAY "EMAIL: " WITH NO ADVANCING.
ACCEPT INPUT-EMAIL.
MOVE INPUT-PERSON TO INPUT-RECORD.
WRITE INPUT-RECORD.
* CLOSE DATAFILE.
DISPLAY "SELECT AN OPTION".
DISPLAY "1 - NEW".
DISPLAY "2 - EXIT".
ACCEPT OPTION.
IF OPTION = 1 THEN
GO TO LOOP-INPUT
ELSE
CLOSE DATAFILE.
EXIT PROGRAM.
END PROGRAM SAMPLE1.