The COPY option specifies that the source data stream is written on the specified STREAM OUTPUT file without alteration. If no file reference is given, the default is the output file SYSPRINT. Each new record in the input stream starts a new record on the COPY file. For example:
get file(sysin) data(A,B,C) copy(DPL);
not only transmits the values assigned to A, B, and C in the input stream to the variables with these names, but also writes them exactly as they appear in the input stream, on the file DPL. Data values that are skipped on input, and not transmitted to internal variables, copy intact into the output stream.
If a condition is raised during the execution of a GET statement with a COPY option and an ON-unit is entered in which another GET statement is executed for the same file, and if control is returned from the ON-unit to the first GET statement, that statement executes as if no COPY option was specified. If, in the ON-unit, a PUT statement is executed for the file associated with the COPY option, the position of the data transmitted might not immediately follow the most recently-transmitted COPY data item.
If the COPY option file is not open in the current program, the file is implicitly opened in the program for stream output transmission.