Trying to copy a copybook and replace the field prefixes when compiling using the following command:
COPY "drmfil.cfd" REPLACING ==DRM-== BY ==DR2-==.
FD DRM-FIL
LABEL RECORDS ARE STANDARD
DATA RECORD IS DRM-REC.
01 DRM-REC.
03 DRM-KEY.
05 DRM-CC-NO PIC X(16).
05 DRM-CC REDEFINES DRM-CC-NO.
07 DRM-CC-BIN-NO PIC X(6).
07 DRM-CC-AGENT-NO PIC XX.
07 DRM-CC-SUFFIX.
10 FILLER PIC XX.
10 DRM-CC-LAST6 PIC X(6).
03 DRM-ID-NO PIC 9(9).
Can copy replacing field prefixes be done in rm cobol? please advise.
#RMCOBOLYes this can be done, but you have to use a technique that is also used on mainframes and other ANSI compliant compilers.
Modify your copy file as follows:
FD (PREFIX)-FIL
LABEL RECORDS ARE STANDARD
DATA RECORD IS (PREFIX)-REC.
01 (PREFIX)-REC.
03 (PREFIX)-KEY.
05 (PREFIX)-CC-NO PIC X(16).
05 (PREFIX)-CC REDEFINES (PREFIX)-CC-NO.
07 (PREFIX)-CC-BIN-NO PIC X(6).
07 (PREFIX)-CC-AGENT-NO PIC XX.
07 (PREFIX)-CC-SUFFIX.
10 FILLER PIC XX.
10 (PREFIX)-CC-LAST6 PIC X(6).
03 (PREFIX)-ID-NO PIC 9(9).
Then, use the following COPY statement;
COPY "drmfil.cfd" REPLACING ==(PREFIX)== BY ==DR2==
Of course the down side for this is that all COPY of this particular file must now use this technique.