View previous topic :: View next topic
|
Author |
Message |
Siriporn P.
New User
Joined: 16 Jan 2006 Posts: 9
|
|
|
|
Hello,
I have a question regarding Cobol and DB2. I tried to compile a program and i got an error message 'undefined or unusable host variables : T001VP'. I found that the variable was defined in a copybook. I renamed variable from T001VP to XXXXXX both in program and copybook, then had it recompile. I still got the same error and so strange that the error is the same 'undefined or unusable host variables : T001VP'.
I don't know why it still use the old variable name instead of using the new variable name.
Best regards,
Siriporn P. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
In spool its also give you the line number.
Plz check that particular line & let us know whether it contain that variable |
|
Back to top |
|
|
Siriporn P.
New User
Joined: 16 Jan 2006 Posts: 9
|
|
|
|
How can i see spool? Sorry to ask the stupid question, i am a newer in DB2. |
|
Back to top |
|
|
Brian's_song
New User
Joined: 27 Dec 2005 Posts: 21
|
|
|
|
hi my friend,
I used to see that the variable which had been renamed could not be quoted any more in the program, So I guess you have used the variable iT001VP' in your program. If yes, I advise you to redefine the T001VP' instead of Rename it.
Correct me if wrong. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
I don't know why it showed the same name after you changed. The reason for the message is that:
the variable is used by the DB2 precompiler (step 1), but it will appear only in the compiler (step 2), because this is where the COPY statements are processed.
You can use EXEC SQL INCLUDE copyname END-EXEC instead of COPY copyname.
Or you can define a var in WS and make a MOVE into it before using it in your DB2 statements. |
|
Back to top |
|
|
KS
New User
Joined: 28 Feb 2006 Posts: 91 Location: Chennai
|
|
|
|
Hi,
U just need to include the DCLGEN for that varaible in the program using EXEC SQL
INCLUDE (NAME)
End EXEC.
I dont think u need to redefine or rename.
Kindly correct if wrong.
Thanks,
KS |
|
Back to top |
|
|
martin9
Active User
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
|
|
|
|
hy,
you must know,
that the db2 precompiler will check all variables used
in any sql statement. if the variable declaration is in a cobol
copybook, you have to translate the copybooks first.
you can do this, when giving the appropriate cobol
options, only to make a source translation no object code.
note: with the new compiler family of cobol (i.e. enterprise cobol...)
you are able to avoid this by using the integrated db2 coprocessor
which will be running also while compiling the program,
therefore you only one step for compilation, no translator step.
the post with sql include is right, just use a dclgen version of your
copybook...
martin9 |
|
Back to top |
|
|
sunil_chappy
New User
Joined: 19 Mar 2006 Posts: 9 Location: Bangalore, INDIA
|
|
|
|
U can see the particular line in spool which is giving error.
Use in Ist step PARM=Offset,Source(COB2)
In spool are u will get the address of every line and u can find easily that partcular line.
Correct me if i worng.
Sunil |
|
Back to top |
|
|
|