GeekInterview.com
Series: Subject: Topic:
Question: 11 of 231

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)
Asked by: rpg0247 | Member Since Jun-2011 | Asked on: Dec 25th, 2011

View all questions by rpg0247   View all answers by rpg0247

Showing Answers 1 - 3 of 3 Answers
developer55

Answered On : 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.

  
Login to rate this answer.
rasheeed17

Answered On : Jan 3rd, 2012

View all answers by rasheeed17

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

  
Login to rate this answer.

Don't forget to specify the library where that copy book resides ie.., in SYSLIB

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.