Usage of copy statement in Cobol

Hi,

Can any one tell how to use copybook in COBOL, and please explain with file structure(means i am using 5 fields of file and i want to declare them in copybook and and i want use it in COBOL programming)

Questions by rpg0247   answers by rpg0247

Showing Answers 1 - 9 of 9 Answers

developer55

  • Dec 26th, 2011
 


Code
  1. copy <copybookname>



It is used to save the file-structure as a member of pds.. so that other programs can use it if requried.

  Was this answer useful?  Yes

rasheeed17

  • Jan 3rd, 2012
 

Workinfg-storage section.
pds: TEST.RASH.LIB.ABC.COPY(COPYBK1)
02 VAR-LIST.
05 VAR1 PIC X(10)
05 VAR2 PIC X(10)
05 VAR3 PIC X(10)
05 VAR4 PIC X(10)
05 VAR5 PIC X(10)

TEST.RASH.LIB.ABC.PROG(TESTPROG)

DATA DIVISION.
WORKING-STORAGE SECTION.
01 CPY-VARIABLES-FRM-PDS.
COPY COPYBK1.

PROCEDURE DIVISION.
00000-MAIN-PARA.
MOVE HI TO VAR1
DISPLAY VAR1
MOVE VAR1 TO VAR2 VAR3 VAR4
DISPLAY VAR2 VAR3 VAR4
STOP-RUN

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions