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

DCLGEN in the LINKAGE SECTION


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

New User


Joined: 29 Jan 2007
Posts: 61
Location: Makati City, Philippines

PostPosted: Wed Sep 01, 2010 7:45 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Sep 01, 2010 8:33 am
Reply with quote

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
View user's profile Send private message
sprikitik

New User


Joined: 29 Jan 2007
Posts: 61
Location: Makati City, Philippines

PostPosted: Wed Sep 01, 2010 8:48 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Sep 01, 2010 9:35 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Sep 01, 2010 7:55 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Sep 01, 2010 8:37 pm
Reply with quote

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
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 COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts FD Section to Create FB or Vb File Dy... COBOL Programming 1
No new posts OPTLINK linkage convention PL/I & Assembler 3
No new posts Sections: need one appearance of cer... DFSORT/ICETOOL 4
Search our Forums:

Back to Top