`CLCUCCCHKD      CALCULATE UCC CHECK DIGIT              TAACLRD`
```
The Calculate UCC  Check Digit command  calculates the check  digit for
several  UCC standards  such  as UPC-12  used for  most  grocery items.
This can be used to assist in assigning the value for a new item.

In  some discussions of the standards,  the solution is termed 'Modulus
10'.  The algorithms used  differ from the system Modulus  10 function.
See  the CLCMOD10 TAA  tool for  calculating the  self check  digit for
the system function.

The  UC-Council  describes several  standards (see  the  UC-Council web
site) that have  a fixed length.   CLCUCCCHKD requires  that the  input
length be  one less than  the full length in  order to return  the self
check digit.

The supported standards are:

Full    Input
Description             Length  Length    TYPE value
-----------             ------  ------    ----------

UCC-12 (U.P.C.)           12      11      *UCC12
EAN/UCC-13                11      12      *EANUCC13
EAN/UCC-14                12      13      *EANUCC14
SSCC                      16      17      *SSCC
VICS (Bill of lading)     15      16      *VICS

The VICS type is also know has the 'Shipment ID number'.

A typical series of commands would be:

DCL            &CHKDGT *CHAR LEN(1)
DCL            &INPUT *CHAR LEN(11)
DCL            &FULLUCC *CHAR LEN(12)
.
CLCUCCCHKD     TYPE(*UCC12) INPUT(&INPUT) CHGDGT(&CHKDGT)
CHGVAR         &FULLUCC (&INPUT *CAT &CHKDGT)

The &FULUCC value now contains the complete UCC number.

The  algorithms used  require adding  the values for  the odd  and even
number digits of  the input value.   The *UCC12,  *EANUCC14, and  *SSCC
standards  multiply the  sum  of  the odd  number  digits  by 3.    The
*EANUCC13,  and *VICS  standards multiply  the sum  of the  even number
digits  by 3.   Both algorithms then  add the sums  together.  The last
digit of the  sums is then  subtracted from 10  to determine the  check
digit.

CLCUCCCHKD escape messages you can monitor for
----------------------------------------------

TAA9891    The input value cannot be all blank
TAA9892    Non-digit value is entered
TAA9893    Wrong input length

Escape messages from based on functions will be re-sent.

Command parameters                                    *CMD
------------------

TYPE          The type of check digit to be generated.

*UCC12  may   be  entered  for   the  UCC-12  (U.P.C.)
standard which requires an 11 digit input value.

*EANUCC13  may be entered for  the EAN/UCC-13 standard
which requires a 12 digit input value.

*EANUCC14 may be entered  for the EAN/UCC-14  standard
which requires a 13 digit input value.

*SSCC  may be  entered  for  the SSCC  standard  which
requires a 17 digit input value.

*VICS  may be  entered for the  VICS (Bill  of lading)
or 'Shipment ID number'  standard which requires a  16
digit input value.

INPUT         The  input value  to calculate  the  check digit  for.
Only  digits  0-9  may  be  entered.    See  the  TYPE
parameter  for the length  required for each standard.

CHKDGT        The one digit  value that is  returned that should  be
used  as  the  check  digit.   The  variable  must  be
declared as *CHAR LEN(1).

Restrictions
------------

Because  the command  returns variables, it  may only  be used  in a CL
program.

Prerequisites
-------------

The following TAA Tools must be on your system:

EDTVAR          Edit variable
SNDESCMSG       Send escape message

Implementation
--------------

None, the tool is ready to use.

Objects used by the tool
------------------------

Object        Type    Attribute      Src member    Src file
------        ----    ---------      ----------    ----------

CLCUCCCHKD    *CMD                   TAACLRD       QATTCMD
TAACLRDC      *PGM       CLP         TAACLRDC      QATTCL
```

Added to TAA Productivity tools July 15, 2003