View previous topic :: View next topic
|
Author |
Message |
mainframesiva
New User
Joined: 01 Jan 2020 Posts: 3 Location: India
|
|
|
|
After reading the file and taking a field as input, i tried to fetch the value from the table. fetch cursor is returning 100 even when there are rows. verified the query through spufi and data is fetched correctly.
B_FSER -> Table field
B_TYP -> Table field
Table TABB(serial,type) with the data as below
A001-A
A001-B
A001-F
Code: |
EXEC SQL DECLARE CUR1 CURSOR FOR
SELECT B_FSER,B_FTYP FROM TABB WHERE B_FSER = :WK-SER
END-EXEC
EXEC SQL
FETCH CUR1 INTO :W-B-FSER,:W-B-FTYP
END-EXEC |
attached the entire code...
can somebody help me out to identify the root cause.. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2136 Location: USA
|
|
|
|
You must:
1) carefully verify the content of your table using any online tool, such as FileAid DB2, or any other one available at your site. Do not rely on your guess - “It must be correct”
2) carefully trace your code, including exact values of all involved variables, by adding extra output (print) statements into your code
These are mandatory skills one needs to use when developing and debugging any code in any language. This is your own job you are paid for. Usually nobody else is going to do this draggy work instead of you.
Trying just to guess “what might be wrong in my excellent code” - is senseless activity in most real situations. |
|
Back to top |
|
|
mainframesiva
New User
Joined: 01 Jan 2020 Posts: 3 Location: India
|
|
|
|
Issue has been resolved.
Moved the open cursor after the key value is moved to ensure the key is correctly passed.
Thanks all for your time... |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2136 Location: USA
|
|
|
|
The very useful steps to resolve any problem:
1) try to think with your own mind
2) do something else |
|
Back to top |
|
|
|