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

Is it necessary to include the copybook to access a table


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

New User


Joined: 03 Aug 2006
Posts: 33
Location: earth

PostPosted: Tue Feb 27, 2007 2:40 pm
Reply with quote

i have code a db2 cobol pgm in which i want to access one table named "POLICYTERM" and get some values

is it necessary to include its copybook
Back to top
View user's profile Send private message
guptae

Moderator


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

PostPosted: Tue Feb 27, 2007 2:45 pm
Reply with quote

Hi Paul,

It's not mandatory that you include copybook ( assuming its contain DCLGEN) in the program, but if you have, the Pre-complier validates the field name, etc and give you a warning at precompile stage .

Let me know if u need further explaination
Back to top
View user's profile Send private message
paul_007

New User


Joined: 03 Aug 2006
Posts: 33
Location: earth

PostPosted: Tue Feb 27, 2007 3:57 pm
Reply with quote

^^ YES U R RIGHT I CREATED THE COPYBOOK USING dclgen

this means if i include copybook, it will inform me about wrong SQL statements which i have embedded in the cobol code
Back to top
View user's profile Send private message
guptae

Moderator


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

PostPosted: Tue Feb 27, 2007 4:01 pm
Reply with quote

yes
Back to top
View user's profile Send private message
paul_007

New User


Joined: 03 Aug 2006
Posts: 33
Location: earth

PostPosted: Tue Feb 27, 2007 8:22 pm
Reply with quote

Hi,
i used following sql code in cobol pgm
EXEC SQL
SELECT DIVISION_ID
INTO :HOLD-DIV-ID
FROM GIPIF$01.POLICY
WHERE ZONE_ID = :HOLD-ZONE
AND POLICY = :HOLD-POLICY-NUMBER
AND SYMBOL = :HOLD-SYMBOL
AND MODULE = :HOLD-MODULE
AND MCO = :HOLD-MCO
END-EXEC
but the problem is that it is not fetching any value from table, i displayed the sqlcode and it is showing as 92P

could u pls throw some light
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 Feb 28, 2007 12:51 am
Reply with quote

Hello,

The 92P is most likely a -927 (P is the signed numeric for a negative 7).

If you search in this forum, you will see info on an SQL -927.
Quote:
THE LANGUAGE INTERFACE (LI) WAS CALLED WHEN THE CONNECTING ENVIRONMENT WAS NOT ESTABLISHED.
Back to top
View user's profile Send private message
paul_007

New User


Joined: 03 Aug 2006
Posts: 33
Location: earth

PostPosted: Wed Feb 28, 2007 10:59 am
Reply with quote

Quote:
Hello,

The 92P is most likely a -927 (P is the signed numeric for a negative 7).

If you search in this forum, you will see info on an SQL -927.
Quote:
THE LANGUAGE INTERFACE (LI) WAS CALLED WHEN THE CONNECTING ENVIRONMENT WAS NOT ESTABLISHED.

_________________
Hope this helps,


hi, thnx a lot, so the sqlcode which i am getting, is this bcos of fault from my side or system side
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Wed Feb 28, 2007 12:50 pm
Reply with quote

Paul,
The sqlcode that u r getting can be both system side as well as user side it depends on situation , in order to get the sql code to a readable format move the sqlcode to a edited picture clause and then display the same .

Code:
77 sql-disp pic -9(3).
.
.
.
Move SQLCODE to sql-disp.
display sql-disp.


For -927 try to get the exact DSN name of your DB2 subsystem like DB2p or DB2D etc.. contact your manager for this.


Thamilzan.
Back to top
View user's profile Send private message
noorkh

New User


Joined: 06 Mar 2006
Posts: 76
Location: Chennai

PostPosted: Wed Feb 28, 2007 4:41 pm
Reply with quote

Otherwise you can even move it to some packed decimal field and write in file to check it.
Back to top
View user's profile Send private message
paul_007

New User


Joined: 03 Aug 2006
Posts: 33
Location: earth

PostPosted: Wed Feb 28, 2007 6:41 pm
Reply with quote

Quote:
Paul,
The sqlcode that u r getting can be both system side as well as user side it depends on situation , in order to get the sql code to a readable format move the sqlcode to a edited picture clause and then display the same .

Code:
77 sql-disp pic -9(3).
.
.
.
Move SQLCODE to sql-disp.
display sql-disp.


For -927 try to get the exact DSN name of your DB2 subsystem like DB2p or DB2D etc.. contact your manager for this.




thnx 4 help , i did wat u said and it is displaying the sql code correctly, idat wat u call "edited field ", correct me if i am wrong

and my DSN name is DSNP
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts How to access web services/website? Mainframe Interview Questions 4
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top