Currency Code, Cardholder Billing
What it is
ISO 4217 code of the cardholder billing currency (pairs with DE 6).
DE 51 on the wire
Bitmap position
DE 51 is bit 51 of the primary bitmap: byte 7, mask 0x20. A primary bitmap with only DE 51 present reads 0000000000002000 in hex.
Length
DE 51 is fixed length: always 3 characters, with no length prefix. A parser reads exactly that many and moves on, so shorter values are left-aligned and padded with trailing spaces.
Size in the message
At most 3 bytes when the message travels as text (ASCII or EBCDIC).
Format a or n
Format a or n means alphabetic or numeric: a currency code written as letters (USD) or digits (840).
Specification reference
Defined in ISO 8583:1987 (base). Card networks publish their own dialect tables (Visa BASE I / V.I.P., Mastercard CIS) that refine formats, lengths, and — for private-use elements — the entire layout. Always confirm against the interface specification you implement.