Class PictureUtils

java.lang.Object
org.legstar.cobol.utils.PictureUtils

public class PictureUtils extends Object
Parser for cobol PICTURE clause. TODO CR/DB and N/G probably not handled correctly
  • Method Details

    • compNumeric

      public static PictureUtils.CompNumeric compNumeric(String pic)
      Computational numerics have picture clauses like 9(4) or S9(5)V99.
      Parameters:
      pic - the cobol picture clause
      Returns:
      the computational numeric properties
    • alphaNumeric

      public static PictureUtils.AlphaNumeric alphaNumeric(String pic)
      Aphanumerics have picture clauses like X(4) or +9(5).99.

      All characters contribute to the length of the alphanumeric apart from the V character which stands for a virtual decimal delimiter.

      Parameters:
      pic - the cobol picture clause
      Returns:
      the alphanumeric properties
    • isCompNumeric

      public static boolean isCompNumeric(String pic)
      Is this picture that of a computational numeric.
      Parameters:
      pic - the picture clause
      Returns:
      true if this picture corresponds to a computational numeric
    • isAlphaNumeric

      public static boolean isAlphaNumeric(String pic)
      Is this picture that of an alphanumeric.
      Parameters:
      pic - the picture clause
      Returns:
      true if this picture corresponds to an alphanumeric
    • digitCount

      public static int digitCount(String numberPart)
      Calculate the number of digits given a numeric description like 9999 or 9(4)
      Parameters:
      numberPart - a numeric picture part
      Returns:
      number of digits
    • charCount

      public static int charCount(String alphaPart)
      Calculate the number of characters given an alphanumeric like XXXX or X(4)
      Parameters:
      alphaPart - the picture part
      Returns:
      the number of characters