Hi
In a file a variable pol-num is declared as 9(16). In DB2 table column is polno declared as decimal(16,0).
When I try to check pol-num in table with select statement I'm getting pol-num as undefined or unusual host variable.
select polno into :ws-pol-num from policy where polno = :pol-num
I declared ws-pol-num pic 9(16).
Where is data incompatibility? any help
COBOL Host variable
-
- Posts: 27
- Joined: Sun Aug 16, 2009 11:07 pm
- Skillset: cobol, db2, application performance tuning
- Referer: SEARCH
- Location: St. Cloud, Minnesota
Re: COBOL Host variable
In DB2 the column is defined as decimal, in COBOL the host variable should be usage COMP-3.
NOTICE that you defined "ws-pol-num" but your select statement references ":pol-num" =====> not the same as you cobol variable !!
PS Never use variables defined in the FD / SD section of the code as HOST VARIABLES in a DB2 statement. The reason is that the address of the FD / SD fields changes after every file operation and DB2 only establishes the address of HOST VARIABLES once normally.
select polno into :ws-pol-num from policy where polno = :pol-num
I declared ws-pol-num pic 9(16).
NOTICE that you defined "ws-pol-num" but your select statement references ":pol-num" =====> not the same as you cobol variable !!
PS Never use variables defined in the FD / SD section of the code as HOST VARIABLES in a DB2 statement. The reason is that the address of the FD / SD fields changes after every file operation and DB2 only establishes the address of HOST VARIABLES once normally.
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Finding duplicate in variable lenght string in cobol
by kanipriya2785 » Fri Jun 17, 2022 10:02 pm » in IBM Cobol - 8
- 3495
-
by sergeyken
View the latest post
Wed Jun 22, 2022 3:10 am
-
-
- 5
- 1909
-
by macuko
View the latest post
Tue Jun 27, 2023 8:24 pm
-
- 5
- 4003
-
by sergeyken
View the latest post
Wed Jun 16, 2021 6:23 pm
-
- 1
- 1253
-
by sergeyken
View the latest post
Tue Nov 08, 2022 7:22 pm
-
- 1
- 4422
-
by TERMEN
View the latest post
Thu Mar 04, 2021 2:29 am