Signed Overpunch or Zoned Decimal or what are these weird characters in numeric fields ???

We interface to many different systems and sometimes we get to talk to IBM Mainframes or message formats that uses Signed Overpunch

Where we see numberic values like “100000{” , “100999I”, or “100495N”

Signed Overpunch is used in order to save a byte the last character can indicate both sign (+ / -) and value.

These types are defined in COBOL Copybook this looks like:


which equate to :

100000{ = 100.0000

100999I = 100.9999

100495N = -100.4955

Here is a snippet of Java Code that we use to handle this:

  public static final char[] gt_0 = {
    '{', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'
  public static final char[] lt_0 = {
    '}', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R'

 protected static String convertToCobolSignedString (String aString) {
    int aInt = Integer.parseInt(aString);
    char[] conv = (aInt >= 0) ? gt_0 : lt_0;
    int lastChar = (int) aInt % 10;
    StringBuffer sb = new StringBuffer (Integer.toString(aInt));
    sb.setCharAt (sb.length()-1, conv[lastChar]);
    return sb.toString();