COBOL - Copy Statement Last Updated : 10 Jun, 2022 Comments Improve Suggest changes Like Article Like Report COPY statement is used to bring into a program a series of prewritten COBOL entries that have been stored in a library. A copy statement inserts the copybook inside a COBOL program, copybook refers to a member which holds all the variables declared inside it. The COPY statement is a library statement that places the prewritten text in a COBOL compilation unit. Prewritten source code entries can be included in a compilation unit at compile time. Thus, an installation can use standard file descriptions, record descriptions, or procedures without recoding them. These entries and procedures can then be saved in user-created libraries; they can then be included in programs and class definitions by means of the COPY statement. Syntax: COPY copybook-name [REPLACING "string_1" BY "string_2"] Where, The copybook-name refers to a file containing the source string.The string_1 refers to the string to be replaced.The string_2 refers to the replacing string.Advantages of using COPY: Following are the advantages of using the COPY statement in COBOL: A single copybook could be used inside many programs, no need to write variable declarations again.A copybook could be used with the dataset to view the data in label form as defined inside the copybook.Reduce time, effort, and cost during changes because when the changes are made in a single copybook it will reflect in other places as well where the copybook is used with the help of the COPY statement. Library entities are extensively annotated so that they are meaningful to all users; this annotation results in better-documented programs and systems.With the COPY statement, you may include prewritten ENVIRONMENT, DATA, or PROCEDURE division entries Let us take the example of Copy in COBOL. Example: Cobol IDENTIFICATION DIVISION. PROGRAM-ID. DEMO3. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. COPY COPYBOOK. PROCEDURE DIVISION. MAIN-PROCEDURE. ACCEPT ST_ID ACCEPT FIRST_NAME ACCEPT LAST_NAME DISPLAY STUDENT. STOP RUN. The above code is using the below copybook with the help of keyword COPY inside the Working storage section when the COBOL is compiled the below code is inserted in the place of COPY COPYBOOK. Cobol 01 STUDENT. 20 ST_ID PIC 9(5). 20 FIRST_NAME PIC X(20). 20 LAST_NAME PIC X(20). Output: Comment More infoAdvertise with us Next Article COBOL - Copy Statement B bankay55555 Follow Improve Article Tags : COBOL Geeks Premier League Geeks-Premier-League-2022 COBOL-Basics Similar Reads COBOL - Continue Statement In simple terms think of the continue statement as a Gatekeeper who will open the gate for the people to come inside the premise to do their task. Similarly continue statement also transfers the control on the next COBOL statement for execution. Syntax: CONTINUE Let's take the example of Continue in 2 min read COBOL - Include Statement The INCLUDE statement refers to the file or the directory mentioned after it and inserts the command present inside that member in the pre-compilation state. Basically, it is used to insert a code block onto a source program. Syntax: INCLUDE member-name Where, The member-name refers to the name of t 2 min read Conditional Statements in COBOL While writing a program a programmer needs to check for various conditions, if the condition is true then a particular block of statement/s are executed, or else another block of statement/s is execute. To check these conditions we use Conditional Statements. These statements return either true or f 7 min read Compound Statements Statements are tools used in logical reasoning and problem-solving. Compound statement, for instance, not only unites simple statements into one big complex but also still maintains its meaning. This article will examine the compound statements: what they are, their types, and the truth tables for e 8 min read Coding Sheet in COBOL Every language needs an environment or platform to write codes. For example, in Java, we use notepad to write codes then compile them to run. Similarly, COBOL requires a coding sheet to write codes. COBOL is a business-oriented high-level language. It was developed for business, finance, and adminis 7 min read Program Structure of COBOL COBOL is a programming language that was developed to solve business problems. COBOL stands for Common Business Oriented Language. Being a High-Level Structured Language, COBOL is very similar to English-like language, which is used to develop major business applications. Due to its easier maintenan 2 min read Working Storage Section in COBOL Cobol is a high-level language, which has its own compiler. The COBOL compiler translates the COBOL program into an object program, which is finally executed. To execute the COBOL program without any error, these divisions must be written in the order in which they are specified below: 1. Identific 3 min read Next Sentence in COBOL In COBOL programming language we have three types of logical statements: 1. Sequence Statements: Used when we need to execute some piece of code repeatedly till some sequence. Like reading each data/record from some file till the end. 2. Selection Statements: Used when we want to flow the program ba 3 min read COBOL Words COBOL Words are characters like string that can be reserved words or user-defined words. The length can be up to 30 characters. COBOL words must be as from a set of letters, digits, the hyphen, and the underscore. User-DefinedUser-defined words are used for commonly as naming files, operational data 1 min read Subroutines in COBOL Subroutines in COBOL are small programs that are compiled independently but cannot be run directly. Cobol subroutine is a small program that can be compiled independently but cannot be run directly. There are two types of COBOL  subroutines- internal subroutines and the external subroutines Call Ver 3 min read Like