Re: Newbie Question
- From: "Oliver Wong" <owong@xxxxxxxxxxxxxx>
- Date: Wed, 31 May 2006 17:05:54 GMT
"Michael Mattias" <michael.mattias@xxxxxxx> wrote in message news:qPjfg.2694$VE1.1338@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I had this small cobol routine dropped on my desk and need to convert
it into a vb app, but I am not all that familiar with most of cobol. I
can read most of it and decipher what is going on, but having trouble
with this move.
var1 pic 9 comp.
var2 pic 9(10)
If var2 had the value of 138755482 and
MOVE VAR2 TO VAR1 is executed, what is actually stored in var1.
I apologize if this is a no brainer.
MOVE= assignment
MOVE A TO B (cobol) ===> [ LET] B = A (BASIC)
DIM VAR1 AS LONG, VAR2 AS LONG
VAR1 = VAR2
WARNING: a long integer will not hold Var2, where PIC 9(10) specifies a
numeric data item with ten digits before the decimal. You may need to go to
a SINGLE or DOUBLE here.
It takes 34 bits to store an unsigned 10 digit number, and 35 bits to store a signed 10 digit number, so you're right that LONG INTEGER (32 bit signed) won't be enough to store all values of the PIC 9(10). However, if you move to floating point numbers (e.g. SINGLE or DOUBLE), you're opening yourself up to problems with rounding, which may also yield big headaches.
In such a case, you'll want to use a "Big Integer" package, such as the one which can be downloaded from http://www.codeproject.com/com/BigInteger.asp
- Oliver
.
- Follow-Ups:
- Re: Newbie Question
- From: Michael Mattias
- Re: Newbie Question
- References:
- Newbie Question
- From: the_tragic_hip
- Re: Newbie Question
- From: Michael Mattias
- Newbie Question
- Prev by Date: Re: EOF location?
- Next by Date: Re: Rewrite Twice?
- Previous by thread: Re: Newbie Question
- Next by thread: Re: Newbie Question
- Index(es):
Relevant Pages
|