Page 1 of 1

Need a solution to the problem

PostPosted: Fri Dec 28, 2007 7:52 pm
by bhatia_nitin
Hi All,
I have read the whole blog but not getting solution for the problem.
I have a variable QTY PIC s9(11)V9(4) COMP-3 , which will be populated from the database using select query.
Then I am moving the value of QTY to a working storage varible QTY-LOC which is s9(11)v9(4) VALUE ZERO.
There is a redefine for this working storgae variable like.
W-QTY-LOC REDEFINES QTY-LOC
W-QTY-WHL PIC S9(11).
W-QTY-DEC PIC 9(4).

Now code is manipulating on QTY-LOC and there is a string formation in code for DYANAMIC insert

STRING
W-LOC-QTY-WHL OF W-WORK DELIMITED BY SIZE
'.' DELIMITED BY SIZE
W-LOC-QTY-DEC OF W-WORK DELIMITED BY SIZE
',' DELIMITED BY SIZE

INTO SELECT-COL-CLAUSE OF ITEM
WITH POINTER SELECT-COL-LEN OF ITEM
END-STRING

PROBLEM
I am getting junk value in W-QTY-DEC i.e the value of above string formation is 00000000082.000(.
How to resolve this. what is wrong with the code. I can not use NUMVAL as this is generic cobol which is running perfectly under Windows env.
Any help will be greatly appreciated.

Re: Need a solution to the problem

PostPosted: Mon Dec 31, 2007 2:04 pm
by arunprasad.k
bhatia_nitin,

It is not a junk value!!

For example when you define a varible with S9(2)V9(2) (total 4 bytes) the last digit represents whether the value in the variable is + ive or - ive. In your case the value is positive and the last digit is 0. It is represented by '{' (and not by '(').

Here are some of the sample values and its representation.

Original Value / Stored Value
-345/   34N
-98/   9Q
-12/   1K
-10/   1}
-9/   R
-8/   Q
-7/   P
-6/   O
-5/   N
-4/   M
-3/   L
-2/   K
-1/   J
0/   {
+1/   A
+2/   B
+3/   C
+4/   D
+5/   E
+6/   F
+7/   G
+8/   H
+9/   I
+10/   1{
+12/   1B
+98/   9H
+345/   34E


Let us know what you try to accomplish. If you want the values in readable format you can use editable fields like ZZ,ZZZ.00 or 9(5).(92), etc.

Arun.

Problem Solved

PostPosted: Sat Jan 05, 2008 11:11 pm
by bhatia_nitin
Thanks a lot Arun for clearing dobt and giving the table showing sign info. Very useful for future reference.
9(5).9(2) worked for me.

Thanks
Nitin Bhatia