Copy and Include copybook



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Copy and Include copybook

Postby sinmani » Fri Jun 15, 2012 7:20 pm

Hi Friends,

I have a Copybook.

Now I have to write a several files with the same layout as that of the copybook. So I Copy it in my FD section.

For this I define Copybook with field names prefixed by say suppose :AC: and use
Copy <Copybook Name >
Replacing ==:AC:== by ==AC-== for each file.

Now I also want to use this copybook in my embedded SQL statements so for that I must Include this copybook in my Working storage section.

but the variables in Working storage section would be like :AC: Field name

is there anyway we can use replace while Incuding???
-----------------------------------------
As long as you think you are a student, you are doing well.
The day you consider yourself as the master of the game..........well
sinmani
 
Posts: 93
Joined: Thu Mar 22, 2012 10:02 am
Has thanked: 14 times
Been thanked: 0 time

Re: Copy and Include copybook

 

Re: Copy and Include copybook

Postby Akatsukami » Fri Jun 15, 2012 7:33 pm

"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day

These users thanked the author Akatsukami for the post:
sinmani (Sat Jun 16, 2012 1:28 pm)
User avatar
Akatsukami
Global moderator
 
Posts: 1054
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Copy and Include copybook

Postby Ed Goodman » Fri Jun 15, 2012 7:59 pm

You lost me.

You have an FD style copybook, and you want to include it inside the procedure division EXEC SQL statements?
Ed Goodman
 
Posts: 342
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: Copy and Include copybook

Postby Robert Sample » Fri Jun 15, 2012 8:14 pm

My understanding is that INCLUDE cannot use REPLACING. Your options are to place the code in the program, or create a different copy book with the :AC: replaced with valid COBOL syntax, then INCLUDE that copy book instead of the one with :AC:.

These users thanked the author Robert Sample for the post:
sinmani (Sat Jun 16, 2012 1:24 pm)
Robert Sample
Global moderator
 
Posts: 3376
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 224 times

Re: Copy and Include copybook

Postby sinmani » Sat Jun 16, 2012 1:25 pm

Ed Goodman wrote:You lost me.

You have an FD style copybook, and you want to include it inside the procedure division EXEC SQL statements?


Yes, you got it right Ed.
-----------------------------------------
As long as you think you are a student, you are doing well.
The day you consider yourself as the master of the game..........well
sinmani
 
Posts: 93
Joined: Thu Mar 22, 2012 10:02 am
Has thanked: 14 times
Been thanked: 0 time

Re: Copy and Include copybook

Postby Anuj Dhawan » Mon Jun 18, 2012 7:01 pm

I agree with Robert. REPLACING phrase can be used with COPY statement. All this is "under COBOL". INCLUDE is a DB2 dialect.

Here are 8.1.4.3 Replacement and comparison rules for COPY statement with REPLACING and they don't talk about INCLUDE at all.
Anuj
Anuj Dhawan
 
Posts: 274
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post