Monday, WinDEV.
I’m currently working on software to help our customers save time, by extracting data from their databases, to generate a big file and then send it to a partner, who’ll print all the letters and checks.
Honestly that’s a big advance for our customers, something like one day work saved.
But as my company will handle some of the administrative part, I have to write the checks parameters, like the name, the address and stuff.
One of these parameters is the (sort of) checksum of the magnetic ligne at the bottom of the check ; it aims at checking the check authenticity.
The algorithm I was given by our bank director office is the following :
rlmc = 97 - (N x 100 - 97)
where N is the concatenation of the 31 digits of the magnetic line (check number and two bank codes).
So I code it, run it, and TADA !
It appears that WinDEV doesn’t handle big numbers (string to number convertion sucks hard too).
So, “just to try”, I typed in the same thing in irb :
irb(main):001:0> s = "6459010034010041908006791980430"
=> "6459010034010041908006791980430"
irb(main):002:0> rlmc = 97 - ((s.to_i * 100).modulo(97))
=> 54
irb(main):003:0>
Oh… it works :p