To simplify things the word FROM can be used to save always having to
first MOVE the data (PRINT-NUMBER) into the printing item (P-DATA above). So,
line 011200 and 011300 can simply be written as:
011100 WRITE P-DATA FROM PRINT-NUMBER
In addition to WRITE, the is also REWRITE and DELETE which
are used to update records within files that have been opened in I-O mode (see
the following section). When using
DELETE you must first read the record that is to be deleted. Also, when deleting
a record you refer to the FILE NAME rather than the record name:
000300 FD IN-FILE.
000400 01 CUST-RECORD..
000500 03 C-NAME PIC X(20)..
000600 03 C-NUMBER PIC 9(6)..
:.
001000* in procedure division.
001100 READ IN-FILE.
001200 NOT AT END.
001300 IF C-NUMBER = 123456 THEN
001400 DELETE IN-FILE
001500 ELSE MOVE C-NUMBER TO W-DATA-STORE
001600 END-IF
001700 END-READ