Re: COMP-3 and Alpha numeric
- From: "William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx>
- Date: Mon, 18 Sep 2006 07:21:32 GMT
Please show your EXACT source code and listing. As I stated before, IBM simply
does NOT support moving a non-integer numeric (any USAGE) to an alphanumeric
receiving field. I really, REALLY, think you are doing something different in
the actual source code than what you are reporting.
wmklein <at> ix.netcom.com
"fatalxception" <aanand.ramesh@xxxxxxxxx> wrote in message
my mistake on the declaration.
as Richard assumed.. WS-VAR1 is COMP-3.
Update on this:
I wrote a program which just moved VAR1 to VAR2 and displayed VAR2.
wonder of wonders, it worked!!!
I'm not sure how or what happened, but that program worked.
The program had no other logic other than this. WS-VAR1 had an initial
value of 1234567 while WS-VAR2 was initialized using INITIALIZE verb.
The program displayed WS-VAR2 perfectly as 1234567(with spaces of
Also, the code is as i've put in (with the major addition of the COMP-3
clause) and as u've already pointed out, maybe my understanding may not
be upto the mark.
(I have not put in the exact variable names as i do not think it should
be an issue.)
so folks, how do i explain the above?
I even tested the program that I'm analyzing and i found the report
(the program generates) had no issues displaying the variable in
I have one question on COMP-3 variables.
I use Z/OS with VS COBOL II.
The problem i'm facing:
I have two variables declared as
05 WS-VAR1 PIC S(9)V99.
05 WS-VAR2 PIC X(11).
I will assume that you actually meant that WS-VAR1 is COMP-3.
The program i'm analyzing has the following move statement:
MOVE WS-VAR1 TO WS-VAR2
This is an invalid move as already pointed out, it gives a compiler
error with my compilers and does not generate a program that would run.
It is possible your compiler may allow it, but unlikely, so I doubt
that the code you wrote as an illustration is an actual representation
of what the program does.
The issue that i'm analyzing is that WS-VAR2 is moved to a file and it
appears similar to LOW-VALUES (when file is opened in browse mode).
If Var1 had a value of zero then it would be 5 bytes of hex '00' and
one byte of hex '0F' or similar. This is identical to low values for
the first 5 bytes. In fact any value less than 10000000.00 would have
low-values in the first byte.
To test if the move is legal, i wrote a simple display program with the
above move statement and displayed WS-VAR2. (WS-VAR1 had 123456789 as
The program compiles fine (returns a 0 RC). However, when i run this
program, the VAR2 displays junk.
Are you sure that the program does an actual MOVE as you claim ?
Perhaps it has:
03 Var1-Group COMP-3.
05 Var1 PIC S9(9)V99.
03 Var2 PIC X(11).
and then the compiler will happily allow MOVE Var1-Group TO Var2
resulting in junk in Var2.
Am i doing this right? What am I missing?
Well you missed putting the COMP-3 on the code snippet above, perhaps
you missed telling us other things as well.
From my understanding, COBOL II should be allowing automatic typeconversions and the move statement should not be an issue.
COBOL is most likely doing exactly what COBOL does. It is probably your
understanding, not COBOL, that is flawed.
Post the _actual_ code and we can tell you in more detail what is