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

Problem about precompile step


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

New User


Joined: 16 Jan 2006
Posts: 9

PostPosted: Wed Mar 15, 2006 3:20 pm
Reply with quote

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

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Mar 15, 2006 3:31 pm
Reply with quote

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

New User


Joined: 16 Jan 2006
Posts: 9

PostPosted: Wed Mar 15, 2006 3:44 pm
Reply with quote

How can i see spool? Sorry to ask the stupid question, i am a newer in DB2.
Back to top
View user's profile Send private message
Brian's_song

New User


Joined: 27 Dec 2005
Posts: 21

PostPosted: Sat Mar 18, 2006 5:57 pm
Reply with quote

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

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Mar 20, 2006 3:01 pm
Reply with quote

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

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Mon Mar 20, 2006 3:38 pm
Reply with quote

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

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Mon Mar 20, 2006 3:47 pm
Reply with quote

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

New User


Joined: 19 Mar 2006
Posts: 9
Location: Bangalore, INDIA

PostPosted: Wed Mar 22, 2006 2:37 am
Reply with quote

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
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 Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
No new posts Forcing a step to run (even if abended) JCL & VSAM 8
Search our Forums:

Back to Top