IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Copybook containing SQL statement


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Tue Aug 25, 2009 11:55 am
Reply with quote

I have some SQL statements in a COBOL copybook, which are expanding during my precompile. I believed till now that copybooks do not expand during precompilation. These are the precompiler options (I somewhere read that for this to happen we should have COPY as a precompile option but my precompiler did not have this). Below are the precompiler options -


APOST
APOSTSQL
ATTACH(TSO)
CCSID(37)
NOPADNTSTR
CONNECT(2)
DEC(15)
FLAG(I)
HOST(IBMCOB)
LINECOUNT(60)
MARGINS(8,72)
NEWFUN(YES)
ONEPASS
OPTIONS
PERIOD
NOSOURCE
STDSQL(NO)

Please help.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 25, 2009 7:17 pm
Reply with quote

Hello,

Quote:
Below are the precompiler options
Only the ones specified. . .

Suggest you look at the output from a compile or talk with the people who support the compiler and find out what the default values are. . .

Unspecified options use site-specific defaults.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Aug 25, 2009 8:04 pm
Reply with quote

niks_jude wrote:
I have some SQL statements in a COBOL copybook, which are expanding during my precompile. I believed till now that copybooks do not expand during precompilation.
Please help.

If they are expanding during your precompile, then there should be no problem... icon_question.gif

Just in case there was a misunderstanding:
If you want your copybook to be available to the precompile you have to use EXEC SQL INCLUDE copybook END-EXEC instead of COPY.

Try that and tell us if it's ok.
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu Aug 27, 2009 12:53 pm
Reply with quote

OK as for dick's question the options I have pasted are from my precompiler listing. Is there still a possibility that the COPY option is not getting displayed.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 28, 2009 6:43 am
Reply with quote

Hello,

In the precompiler output are not all of the options shown - either as "on" or "off" (like the compiler does)? I'm not able to run a pre-compile and check my system just now.
Back to top
View user's profile Send private message
sampathkmn
Warnings : 1

New User


Joined: 12 Dec 2005
Posts: 31
Location: bangalore

PostPosted: Fri Aug 28, 2009 2:04 pm
Reply with quote

Hi,

Copy must have expanded because of cobol compiler which gets activated during precompilation.
All cobol statements will be expanded because of cobol compiler, and all SQLs because of precompiler.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Aug 28, 2009 8:16 pm
Reply with quote

niks_jude,
Are you sure that you are executing DB2 precompiler and not the DB2 co-processer? DB2 co-processor is activated by 'SQL' compiler option and there is no need of precompiler step when SQL compiler option is used. Corrolary of this is - if you use the co-processor then there will be no difference in processing of COPY and INCLUDE statements. Both will be expanded at same time.

If there are SQL statements in your copybook and you have coded COPY CBOKNAME, then you need to expand such copybooks before the COMPILER step so as to get successful compilation.
For achieving this, some shops (for ex. my shop) use an ASSEMBLER program which expands the COPY statements first and then calls the DB2 precompiler so as to avoid the aforesaid problem.

Check your compiler JCL and let us know how your shop is approaching this situation.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 28, 2009 8:17 pm
Reply with quote

Hello,

"COPY" is not an option in my precompiler (PP 5655-S71 IBM Enterprise COBOL for z/OS 4.1.0). . .
Code:
   Partial list:
BUFSIZE(4096)               
 NOCICS                         
   CODEPAGE(1140)               
 NOCOMPILE(S)                   
 NOCURRENCY                     
   DATA(31)                     
 NODATEPROC                     
   DBCS                         

I suspect it is not in this one either. . .
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts Trying to change copybook in online c... CICS 4
No new posts Help to Filter File Manager Copybook ... DFSORT/ICETOOL 14
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Need to add field to copybook, proble... COBOL Programming 14
Search our Forums:

Back to Top