Re: Newbie Question



theHip<the_tragic_hip@xxxxxxxxx> 05/31/06 9:52 AM >>>
What is stored is 2, but it is stored in binary. This seems like a
weird thing to do, truncated a value but stored as binary. How is
VAR1 used?

What version of CoBOL are you using? Compiler and OS.

I thought that that was what was stored there, but I couldn't make
sense of it. This routine is a check to make sure an account number is
valid. It goes through a whole bunch of multipys and divides and such,
and then the outcome of all this must match var2.

Unfortunately, all I was handed was a piece of paper with the code, no
clue what version of CoBOL was being used or compiler. I do have an
exe of the routine that I can run on XP.

Let me see if I have this part correct.

01 JB-WORK
03 VAR1 PIC 9(10)
03 VAR1-R REDEFINES VAR1
05 VAR9 PIC9(9).
05 VARLST PIC 9.

I am assuming that if 138755482 is moved to var1 then var9 would be
138755482 ... is that correct?

Thanks so much for the quick reply.

Sounds like a mod-10 or mod-11 check, with the last digit of the number
being the check-digit, so with the above var9 would be 123785548 and varlst
(the check digit) would be 2.

Check out the following:
for mod-11: http://www.augustana.ca/~mohrj/algorithms/checkdigit.html#isbn
for mod-10: http://www.augustana.ca/~mohrj/algorithms/checkdigit.html#ibm

I think each has variants, so you'll have to look at the code, but this
might help explain it.

Frank

---
Frank Swarbrick
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO USA
.



Relevant Pages

  • 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
    ... VAR1 used? ... What version of CoBOL are you using? ... and then the outcome of all this must match var2. ... clue what version of CoBOL was being used or compiler. ...
    (comp.lang.cobol)
  • Re: Newbie Question
    ... This routine is a check to make sure an account number is ... clue what version of CoBOL was being used or compiler. ... 03 VAR1 PIC 9 ... digits as a 9 digit number, and Varlst redfines the low order digit as a ...
    (comp.lang.cobol)
  • Re: Newbie Question
    ... What version of CoBOL are you using? ... This routine is a check to make sure an account number is ... clue what version of CoBOL was being used or compiler. ... 03 VAR1 PIC 9 ...
    (comp.lang.cobol)
  • expecting scalar type
    ... why the compiler not let me initialize the var2 value with the var1 ... the compiler could do so. ...
    (comp.lang.asm.x86)