How to convert a Dell Service Tag to a Dell Service Express Code

I’ve run into a problem where one inventory set uses the Dell Service Tag (a 7 digit alphanumeric value) and a different one uses the Dell Express Service Code, a strictly numeric value. Now I need to marry the two inventories.

I’m screwed you think? Well, as it turns out, both numbers actually represent the same value. Only one is Base 10 (the Exp Service Code) and the other is Base 36 (the Service Tag). Which means, if I’m froggy enough, I can write a conversion tool that takes one and outputs the other.

Here is my first crude perl version of the code. This Perl code will take a file full of Service Tags and spit out the Express Service Codes.

USAGE: ./dell_converter.pl mylist

mylist is just a file with a list of Service Tags. Be aware they have to currently be in upper case.

#—————————————————————— # Main body of the converter will make sure the first line matches # what we expect a service tag to look like and do the conversion #——————————————————————

if(/^[0-9A-Z]{1,7}$/){ # Make sure the line looks like what we expect for a Service Tag @ServiceTag = split //; # split the line into component characters

my $ExpressServiceTag = 0; # set the Express Service Tag value to zero for each iteration for (my $i=6; $i>=0;$i–){ # count backwards through the arrays BEWARE the minus minus, or – – on the $i– looks like a single – not sure why $ExpressServiceTag = $ExpressServiceTag + $value{$ServiceTag[$i]} * $base[$i]; }

print “$_ $ExpressServiceTag \n”; # $_ still references the Service Tag that was read in.