View previous topic :: View next topic
|
Author |
Message |
Nisha sam
New User
Joined: 18 Jan 2008 Posts: 11 Location: India
|
|
|
|
Hi,
I am using a DCLGEN copybook(U30) in my Cobol-DB2 program. The copybook.The copybook has SQL variables followed by COBOL variables like the following structure
EXEC SQL DECLARE DB10G01.U30 TABLE
( STATE CHAR(2) NOT NULL,
FIELD_ID CHAR(4) NOT NULL
) END-EXEC.
01 :TAG:.
STATE
10 :TAG:-STATE PIC X(2).
FIELD_ID
10 :TAG:-FIELD-ID PIC X(4).
and i have included it in program as
EXEC SQL
INCLUDE U30
END-EXEC.
Now my question is how to give an replacement for the :TAG: in the copybook. It is giving an compilation error.
Please give me your suggestion. |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi,
Quote: |
01 :TAG:.
STATE
10 :TAG:-STATE PIC X(2).
FIELD_ID
10 :TAG:-FIELD-ID PIC X(4). |
wat you coded is correct?? but, wat about above variables??
Sen your source listing too. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
1. somebody got too slick. there is not 'replace' parm for include pre-compiler command.
2. changeing the name of host variables contained in the dclgen copybook is subject to better thought. why do it? makes trying to search thru modules that affect db2 columns would become impossible.
if you are using cobol3, change the include to copy, use the replace function of copy and insure that the compiler is set up to do the internal db2 prepass.
If you are not using cobol3, then you are stuck with a bad implementation and you need to have the dclgen changed. |
|
Back to top |
|
|
Nisha sam
New User
Joined: 18 Jan 2008 Posts: 11 Location: India
|
|
|
|
Hi Vasanth,
The copybook expansion is as given in bold in my previous post. The variables with :TAG: are the cobol equivalent variables of the table.
The following is the source listing for the copybook expansion.
*#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
* EXEC SQL INCLUDE U30
* 1 U30 01.01 2008/05/06 2008/05/06 14:09 327 32
*#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
*********************************************************
* DCLGEN TABLE(U30)
*********************************************************
*****EXEC SQL DECLARE U30 TABLE
*****( UCM_CO CHAR(6) NOT NULL,
***** STATE_ABBR CHAR(2) NOT NULL,
*****) END-EXEC.
*********************************************************
* COBOL DECLARATION FOR TABLE U30
*********************************************************
01 :TAG:.
IGYDS0009-E ":" should not begin in area "A". It was processed as if found in "B".
IGYDS1089-S "01" was invalid. Scanning was resumed at the next area A item,level-number, or the start of the next clause. |
|
Back to top |
|
|
Nisha sam
New User
Joined: 18 Jan 2008 Posts: 11 Location: India
|
|
|
|
Hi Dick,
Thanks for the input.
I am using COBOL2. Since it is a client provided copybook I wanted to check out if there's any option to replace :TAG: before needing to change the copybook itself.
And it seems like there isn't. |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi,
All the EXEC SQL statement should start at area B, and colon( in the cobol equivalent variable is invalid for ex:
Quote: |
10 :TAG:-STATE PIC X(2). |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
How does your client accomplish this? are all of his dclgen's done this way? |
|
Back to top |
|
|
|