Re: Newbie Question




"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

.



Relevant Pages

  • Re: [PHP] string as file
    ... This is an example of $var1 and $var2. ... I think that neither you nor Greg understands what I'm looking for. ... Use regular expressions or straight string replacements - that's the best way to implement mail-merge type behaviour. ...
    (php.general)
  • Re: Newbie Question
    ... but I am not all that familiar with most of cobol. ... var2 pic 9 ... MOVE VAR2 TO VAR1 is executed, what is actually stored in var1. ... loop through it digit by digit, ...
    (comp.lang.cobol)
  • Re: Newbie Question
    ... var2 pic 9 ... MOVE VAR2 TO VAR1 is executed, what is actually stored in var1. ... loop through it digit by digit, ... Converting the string into a long might get you into problems though. ...
    (comp.lang.cobol)
  • Re: Form variable in query
    ... Dim var1 As Date ... Dim var2 As Date ... Public Function MyVar1() As Date ...
    (microsoft.public.access.queries)
  • Re: How to send variables to be used in a class?
    ... I need var1 and var2 which are declared on page load to be avalaible in Class ItemTemplate when it's called. ... Dim var1 As String = "A" ...
    (microsoft.public.dotnet.framework.aspnet)