View previous topic :: View next topic
|
Author |
Message |
sprikitik
New User
Joined: 29 Jan 2007 Posts: 61 Location: Makati City, Philippines
|
|
|
|
Hi,
Can i use DCLGEN in the LINKAGE SECTION?
Example:
LINKAGE SECTION.
EXEC SQL
INCLUDE DCLGEN
END-EXEC.
Is this possible?
Thanks! |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
sure it is possible.
but, the second part of a dclgen,
-which is only a copybook created by db2 - that provides the Declare Table DDL
- and the cobol data definitions for host variables
contains Cobol Data definitions.
If you define them in the linkage section,
you have to provide addressability.
So, depends on the code you have in the procedure division to SET Address
or Procedure Division Using clause.
If neither are there, you can not INCLUDE the copybook in linkage. |
|
Back to top |
|
|
sprikitik
New User
Joined: 29 Jan 2007 Posts: 61 Location: Makati City, Philippines
|
|
|
|
dbzTHEdinosauer wrote: |
sure it is possible.
but, the second part of a dclgen,
-which is only a copybook created by db2 - that provides the Declare Table DDL
- and the cobol data definitions for host variables
contains Cobol Data definitions.
If you define them in the linkage section,
you have to provide addressability.
So, depends on the code you have in the procedure division to SET Address
or Procedure Division Using clause.
If neither are there, you can not INCLUDE the copybook in linkage. |
Thanks for the reply.
Actually i'll be using the 01 level (host var) from the DCLGEN in the procedure division:
PROCEDURE DIVISION USING ZERO-ONE-LEVEL-FROM-DCLGEN.
when compiling the program, im encountering errors. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
when compiling the program, im encountering errors. |
A completely wasted observation. . . Is there some reason you did not post both the problem code and the compoilder error(s)?
Suggest you restructure your code to the more conventional placement. . .
As DBZ mentions, what you are trying to do can be done, but only if you understand how.
Why do you believe you want this arrangement? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you should keep in mind that if this module is CALLed directly or indirectly from more than one module you will have problems.
The actual working-storage addresses of the host-variables either - must be the same for each CALL
- the flag SQL-END must be reset to zero at the end of the module execution
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
dbzTHEdinosauer wrote: |
the flag SQL-END must be reset to zero at the end of the module execution |
CORRECTION
the flag SQL-INIT must be reset to zero at the end of the module execution before EXITing (or GOBACK).
Actually it is easiest to just make it the first instruction in the module. |
|
Back to top |
|
|
|