Service Restriction Code
What it is
The service code from the magnetic stripe / chip, carried standalone (also embedded in DE 35).
DE 40 on the wire
Bitmap position
DE 40 is bit 40 of the primary bitmap: byte 5, mask 0x01. A primary bitmap with only DE 40 present reads 0000000001000000 in hex.
Length
DE 40 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 an
Format an means alphanumeric: letters and digits.
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.