Checkdigit

 

Download CheckDigit.exe | Download the CheckDigitreadme file

Checkdigit help

The CheckDigit program calculates and tests check digits for Student identifier (HUSID), Staff identifier (STAFFID) and UCAS Number (UCASNUM) fields.

Running the CheckDigit program

In Microsoft Windows, start a DOS session. In Windows 2000 you would do this by clicking Start, Programs, Accessories, Command Prompt.

Change the directory to where you saved the .exe file. In the example shown below, the command cd (change directory) is used to move to the c:\checkdigit folder.

cd command example

For usage instructions, run the .exe file without any arguments, as shown below:

show usage instructions

To obtain or test a checkdigit, a switch must be entered to indicate the type of field that is being tested:

  • For HUSID, use -H
  • For STAFFID, use -S
  • For UCASNUM, use -U

Obtaining a check digit

To obtain a single check digit, enter the switch and the number that requires the check digit. The program will return the supplied number followed by the full number including the check digit, and the check digit itself. For example, to obtain a check digit for the HUSID 981141123456, enter the command line:

  checkdigit -H 981141123456

as shown below:

obtain a single check digit

To obtain a number of check digits of the same type, enter the switch only and the program will allow you to enter numbers repeatedly. To exit the program, press enter without typing a number to return to the command prompt. For example, to calculate more than one UCASNUM, enter the command line:

  checkdigit -U

as shown below:

obtain multiple check digits

Validating a check digit

The checkdigit program will also validate a supplied checkdigit. This command is exactly the same as used in calculating a check digit: enter the appropriate switch and the full number to be tested.

If the check digit is correct, the program returns the supplied number, the calculated number and the word 'OK'. If the check digit is incorrect, the program will return the supplied number followed by the correct number and the word 'Failed', as shown below:

check a supplied check digit

To validate more than one number, enter the switch only and enter numbers as described in the 'Obtaining a check digit' section.

Errors

The CheckDigit program will check the length of the supplied number and report any errors. For example, a HUSID including the check digit is 13 digits long. The program will only allow a HUSID to be supplied of 12 digits (in order to calculate the check digit) or 13 digits (to validate the check digit).

The supplied number will also be checked to ensure that digits (0-9) and not characters (a-z, A-Z, punctuation) have been supplied. STAFFIDs are an exception to this rule as the first two digits may be replaced with an upper case X. Invalid characters will be reported by the program.

incorrect length or character examples

Using Input and Output Files

Another way of obtaining multiple check digits is to submit them in a text file. The input file must contain a single number per line with no trailing spaces. The numbers must all be of the same type and a blank line must be inserted beneath the last number in the file. An example file is shown below:

sample input file

To run the program with an input file, use the field switch followed by a left angle bracket (<) and the input file path. For example, to input a file of Staff Identifiers located in c:\checkdigit\input.txt, use the following command line:

  checkdigit -S < c:\checkdigit\input.txt

The program output will then be displayed on the screen:

output from supplied file

The program output may also be directed to a text file, by adding a right angle bracket (>) and the output file path to the command line. For example, to use the input file c:\checkdigit\input.txt containing STAFFIDs and send the output to the file c:\checkdigit\output.txt use the following command line:

  checkdigit -S < c:\checkdigit\input.txt > c:\checkdigit\output.txt

The program output will be saved into the specified file:

specify output file

sample output file