fetch problem with host variable



IBM's flagship relational database management system

fetch problem with host variable

Postby pearl » Wed May 08, 2013 12:16 am

Hi,
Please help me solve my problem.
This is my code and as shown, I want to fetch the balance corresponding to a particular id and update it.
select balance in :h1-bal
from tblname
where id = :h1-id

compute h1-bal = h1-bal + 10.50


The problem is that my h1-bal is declared in dclgen as follows
h1-bal   pics9(2)v9(2)  usage is comp-3.


Now, when I try to access the value fetched from the table, it is shown as .........

What should i do?
pearl
 
Posts: 21
Joined: Fri Mar 15, 2013 12:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: fetch problem with host variable

Postby enrico-sorichetti » Wed May 08, 2013 12:22 am

read the db2 manuals about the correspondence between the DB2/SQL data types and the corresponding COBOL types
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: fetch problem with host variable

Postby pearl » Wed May 08, 2013 12:49 am

Actually i tired doing that by declaring the host variable as s9(2)v9(2) usage comp-3. But still it displays '......'
pearl
 
Posts: 21
Joined: Fri Mar 15, 2013 12:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: fetch problem with host variable

Postby Akatsukami » Wed May 08, 2013 12:54 am

pearl wrote:Now, when I try to access the value fetched from the table, it is shown as .........

What should i do?

  1. Give us the definition of the column.
  2. Display the data in hexadecimal; post this enclosed in Code tags.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: fetch problem with host variable

Postby pearl » Wed May 08, 2013 1:02 am

Akatsukami wrote:
pearl wrote:Now, when I try to access the value fetched from the table, it is shown as .........

What should i do?

  1. Give us the definition of the column.
  2. Display the data in hexadecimal; post this enclosed in Code tags.

In table, column drefined as
balance decimal(4,2) not null

In dclgen
h1-balance  pic s9(2)v9(2) usage is comp-3


I want to get the actual value from the table and do calculations on it. But, since its comp-3 the value taken is '.........'
How do I get the value from the table into a host variable using a select query.?
pearl
 
Posts: 21
Joined: Fri Mar 15, 2013 12:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: fetch problem with host variable

Postby Akatsukami » Wed May 08, 2013 1:19 am

pearl wrote:
Akatsukami wrote:
pearl wrote:Now, when I try to access the value fetched from the table, it is shown as .........

What should i do?

  1. Give us the definition of the column.
  2. Display the data in hexadecimal; post this enclosed in Code tags.

In table, column drefined as
balance decimal(4,2) not null

In dclgen
h1-balance  pic s9(2)v9(2) usage is comp-3


I want to get the actual value from the table and do calculations on it. But, since its comp-3 the value taken is '.........'
How do I get the value from the table into a host variable using a select query.?

Pearl-chan, you're worse than my cat when it comes to following instructions. I asked you to display the data in hexadecimal and post that here in Code tags. I will now tell you that solving your problem requires it.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: fetch problem with host variable

Postby NicC » Wed May 08, 2013 5:47 pm

Nothing to do with CICS but all to do with DB2 and whatever language you are using. Moved to DB2 rather than being deleted.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: fetch problem with host variable

Postby dick scherrer » Thu May 09, 2013 12:02 am

Hello,

If you want to be able to "see" the value, you need to show it in HEX or DISPLAY it individually in the code
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post