Considerations Regarding Use of REPLACING in Format 2 COPY Statement
The REPLACING phrase can be used to replace any of the generated
COBOL source, including the level numbers. (See REPLACING Phrase for additional information.) You
should, however, note the following exception:
- When RECORD KEY IS EXTERNALLY-DESCRIBED-KEY is specified, the REPLACING phrase cannot change a format-name or the name of a field that is a key.
Figure 1 describes the Format 2 COPY statement without the REPLACING option:
Figure 1. Format 2 COPY Statement
Without the REPLACING Option
5722WDS V5R4M0 060210 LN IBM ILE COBOL TESTLIB/STRTEXTD I-SERIES1 06/02/15 11:27:50 Page 2
STMT PL SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME CHG DATE
11 000100 FD CUST-MASTER.
12 000200 01 CUSTOMER-RECORD.
000300*
000400* COPY DDS W I T H O U T REPLACING OPTION
000500*
13 000600 COPY DDS-CUSMST OF TESTLIB-CUSMSTP.
+000001* I-O FORMAT:CUSMST FROM FILE CUSMSTP OF LIBRARY TESTLIB CUSMST
+000002* ORDER HEADER RECORD CUSMST
14 +000003 05 CUSMST. CUSMST
15 +000004 06 CUST PIC X(5). CUSMST
+000005* CUSTOMER NUMBER CUSMST
16 +000006 06 NAME PIC X(25). CUSMST
+000007* CUSTOMER NAME CUSMST
17 +000008 06 ADDR PIC X(20). CUSMST
+000009* CUSTOMER ADDRESS CUSMST
18 +000010 06 CITY PIC X(20). CUSMST
+000011* CUSTOMER CITY CUSMST
19 +000012 06 STATE PIC X(2). CUSMST
+000013* STATE CUSMST
20 +000014 06 ZIP PIC S9(5) COMP-3. CUSMST
+000015* ZIP CODE CUSMST
The following figure describes the Format 2 COPY Statement with the REPLACING option:
Figure 2. Format 2 COPY Statement
With the REPLACING Option
5722WDS V5R4M0 060210 LN IBM ILE COBOL TESTLIB/STRTEXTD I-SERIES1 06/02/15 11:27:50 Page 2
STMT PL SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME CHG DATE
30 001000 FD CUST-MASTER.
31 001100 01 CUSTOMER-RECORD.
001200*
001300* COPY DDS W I T H REPLACING OPTION
001400*
32 001500 COPY DDS-CUSMST OF TESTLIB-CUSMSTP
33 001600 REPLACING NAME BY ADDR-LINE-1
34 001700 ADDR BY ADDR-LINE-2
35 001800 CITY BY ADDR-LINE-3.
+000001* I-O FORMAT:CUSMST FROM FILE CUSMSTP OF LIBRARY TESTLIB CUSMST
+000002* ORDER HEADER RECORD CUSMST
36 +000003 05 CUSMST. CUSMST
37 +000004 06 CUST PIC X(5). CUSMST
+000005* CUSTOMER NUMBER CUSMST
38 +000006 06 ADDR-LINE-1 PIC X(25). CUSMST
+000007* CUSTOMER NAME CUSMST
39 +000008 06 ADDR-LINE-2 PIC X(20). CUSMST
+000009* CUSTOMER ADDRESS CUSMST
40 +000010 06 ADDR-LINE-3 PIC X(20). CUSMST
+000011* CUSTOMER CITY CUSMST
41 +000012 06 STATE PIC X(2). CUSMST
+000013* STATE CUSMST
42 +000014 06 ZIP PIC S9(5) COMP-3. CUSMST
+000015* ZIP CODE CUSMST