Use the TRANS CCN function to generate a valid and unique
credit card number (CCN). By default, TRANS CCN algorithmically generates
a consistently altered CCN based on the source CCN. TRANS CCN can
also generate a random value when the source data does not have a
CCN value or when there is no need for transforming the source CCN
in a consistent manner.
A CCN, as defined by ISO 7812, consists
of a 6-digit issuer identifier followed by a variable length account
number and a single check digit as the final number. The check digit
verifies the accuracy of the CCN and is generated by passing the issuer
identifier and account numbers through the Luhn algorithm. The maximum
length of a CCN is 19 digits.
The default processing
method generates a CCN by including the first 4 digits of the issuer
identifier from the source CCN and altering the remaining 2 digits
of the issuer identifier number and the account number based on the
source CCN. A valid check digit is also assigned.
The
random processing method generates a CCN that can include the first
4 digits of the source issuer identifier number or an issuer identifier
number assigned to American Express, Discover, MasterCard, or VISA. A
valid check digit is also assigned. If the first four digits of a
source issuer identifier number are included, the first account number
based on those digits will begin with 1, and for each additional CCN
that uses those digits, the account number will be incremented by
1.
The syntax of TRANS CCN is:
TRANS CCN [( ‘[=flag] [sourcecol] [preserve=invalid]' )]
- flag
- Specify an option flag to generate a random CCN.
- n
- Generate a random CCN that is not based on a source
value and includes an issuer identifier number assigned to American Express, Discover,
MasterCard, or VISA.
- r
- Generate a random CCN that includes the first 4
digits of the source issuer identifier number.
- sourcecol
- The source column name. If a source column name
is not specified, the destination column name is used.
If
a source column name is not specified and the destination column name
does not match a column name in the source table, an error will occur
during processing.
- preserve=invalid
- If the source column contains an invalid CCN, do not replace it
with a generated value. The source column value will be used in the
destination column.
Data Types Allowed
The following source and destination data types are
permitted:
- CHAR
- The column length must be from 13 to 256 characters.
- VARCHAR
- The column length must be from 13 to 254 characters.
- DECIMAL
- The precision of the column must be from 13 to
254 and the scale 0.
If a source or destination column
does not adhere to these restrictions, an error message occurs.
Destination Processing Rules
The following rules apply to the destination CCN value,
according to the destination data type or value:
- CHAR
- If the source value is spaces or a zero-length
VARCHAR, the destination value will be set to spaces.
- VARCHAR
- If the source value is spaces or a zero-length
VARCHAR, the destination length will be 0.
- DECIMAL
- If the source value is 0, the destination value
will be 0.
- NULL
- If the source value is NULL, the destination value
will be NULL.
Skipped Rows
The
following conditions may cause a source row to be skipped and not
written to the destination:
- The source value is NULL, and the destination column
does not allow a NULL value.
- The source value is less than 13 characters, contains
a non-numeric character, is too large, or has an incorrect check digit.
- The source value length is not valid for the credit
card issuer.
- The source value cannot be converted to a format
TRANS CCN supports.
Error Messages
The
following error messages may be issued:
- CCN01
- Parm on Col ccccc ("ppp") is invalid
- Explanation
- The indicated column contains a TRANS function with a processing
option flag that is not valid.
- User Action
- Ensure that the TRANS function on the column specified uses a
valid processing option flag (n, r, 6).
- CCN02
- Col ccccc not on source
- Explanation
- The column that was entered as a sourcecol parameter or the destination
column name (if the sourcecol parameter was omitted) was not found
on the source table.
- User Action
- Check the source table and resolve any discrepancies or missing
columns.
- CCN03
- Source Col ccccc-aaa invalid
- Explanation
- The format of the source column is not supported because the attribute
indicated is not valid.
- User Action
- Check the source column and ensure the values for type, length,
precision, and scale are appropriate.
- CCN04
- Dest Col ccccc-aaa invalid
- Explanation
- The format of the destination column is not supported because
the indicated attribute is not valid.
- User Action
- Check the destination column to ensure the values for type, length,
precision, and scale are appropriate.
- CCN05
- Get col ccccc data-rc=nnn
- Explanation
- An unexpected internal error has occurred while getting the value
from the source column.
- User Action
- Check the values of the source and destination columns and ensure
the values for type, length, precision, and scale are appropriate.
If the problem persists, contact IBM® Software
Support.
- CCN08
- Put col ccccc data-rc=nnn
- Explanation
- An unexpected internal error has occurred while setting the value
on the destination column.
- User Action
- Check the values of the source and destination columns and ensure
the values for type, length, precision, and scale are appropriate.
If the problem persists, contact IBM Software
Support.
If any other errors occur, contact
Technical Support.
Example 1
The
following example uses a source column name (CREDITCARD) that differs
from the destination column and generates a random CCN not based on
the source value:
TRANS CCN (‘=n CREDITCARD')
Example 2
The
following example uses a source column name (CREDITCARD) that differs
from the destination column and generates a CCN using the default
processing method:
TRANS CCN (‘CREDITCARD')