ENVIRONMENT DIVISION.
	INPUT-OUTPUT SECTION.
	FILE-CONTROL.
		SELECT PERSON-FILE ASSIGN TO "A:PERSON.TXT"
		ORGANIZATION IS LINE SEQUENTIAL
	DATA DIVISION.
	FILE SECTION.
		FD PERSON-FILE
			DATA RECORDED IS PERSON-RECORD
         

		01 PERSON-RECORD.
		02 PERSON-NAME            PIC X(30).
		02 PERSON-SEX             PIC X(6).
		02 PERSON-AGE             PIC 9(3).
       
	WORKING-STORAGE SECTION.
		01 MORE-DATA PIC X(3) VALUE 'YES'
	PROCEDURE DIVISION.
	PROCESS-BUILD-FILE.
		OPEN OUTPUT PERSON-FILE.
		PERFORM-PROCESS-GET-DATA
			UNTIL MORE-DATA= 'NO'
		CLOSE PERSON-FILE
		STOP RUN.
               
	PROCESS-GET-DATA.
		DISPLAY 'ENTER A NAME-LAST NAME FIRST WITH A SPACE BETWEEN THEM'
		ACCEPT PERSON-NAME.
		DISPLAY 'ENTER PERSON SEX'
		ACCEPT PERSON-SEX.
		DISPLAY 'ENTER THER PERSONS AGE'
		ACCEPT PERSON-AGE.
		WRITE PERSON-OUT.
		DISPLAY 'WANT ANOTHER RECORD? (YES/NO)'.
		ACCEPT MORE-DATA.