Page 1 of 1

fetch problem with host variable

PostPosted: Wed May 08, 2013 12:16 am
by pearl
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?

Re: fetch problem with host variable

PostPosted: Wed May 08, 2013 12:22 am
by enrico-sorichetti
read the db2 manuals about the correspondence between the DB2/SQL data types and the corresponding COBOL types

Re: fetch problem with host variable

PostPosted: Wed May 08, 2013 12:49 am
by pearl
Actually i tired doing that by declaring the host variable as s9(2)v9(2) usage comp-3. But still it displays '......'

Re: fetch problem with host variable

PostPosted: Wed May 08, 2013 12:54 am
by Akatsukami
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.

Re: fetch problem with host variable

PostPosted: Wed May 08, 2013 1:02 am
by pearl
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.?

Re: fetch problem with host variable

PostPosted: Wed May 08, 2013 1:19 am
by Akatsukami
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.

Re: fetch problem with host variable

PostPosted: Wed May 08, 2013 5:47 pm
by NicC
Nothing to do with CICS but all to do with DB2 and whatever language you are using. Moved to DB2 rather than being deleted.

Re: fetch problem with host variable

PostPosted: Thu May 09, 2013 12:02 am
by dick scherrer
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