Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COPY Statement Help

Status
Not open for further replies.

WolfenMoon

Technical User
Sep 19, 2001
1
US
Hello all,

I'm considered a newbie when COBOL is involved. I am pretty familiar with COBOL; however, I'm not so comfortable with the COPY statement. I have copied a program from a book that I would like to test using the COPY statement, i.e., I would like to take out a part of that program, create a .cpy of what I've taken out, and then [with use of the ADVMS system] put it back together and compile. I really don't have a clue as where to begin.

[COBOL program] -
[Program input] -
Could anyone possibly point me in the right direction or show me how I should go about doing this? I'd very much appreciate it. Thank you.

-Wolfen Moon
 
Wolfen,

COPY is mostly used for bits of coding (often Working-Storage, but elsewhere is entirely possible) that are supposed to be equal in a number of programs. A good example is the record layout in a file definition, like your PATRON-RECORD. Suppose this file is created by another program; sharing the PATRON-RECORD layout through use of the COPY statement ensures both are the same.

Suppose you copy the whole PATRON-RECORD definition to patronrec.cpy, then your original FD should be changed to something like this:

FD PATRON-FILE
LABEL RECORDS ARE STANDARD.
COPY patronrec.

I'm a mainframe guy, so i'm not familiar with PC-like environments when it comes to COBOL. You'll have to find out where the compiler expects the .cpy files, and if that extension should be included or not. I've been tinkering with Micro Focus COBOL on a PC in the past, and there it didn't have to be included.

Regards,
Ronald.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top