Can PIC S9(12) be stored in a line sequential file?

The MicroFocus documentation in, in section, says that line sequential files "correspond to simple text files as produced by the standard editor provided with your operating system".

I've created a line-sequential file whose records are PIC S9(12) OCCURS 1600.  When I look at the output in Notepad, I see that the number -999999999999 appears to be stored as 99999999999y.

Do I need to change my organization from "line sequential" to "sequential", or can a program reading that line-sequential file actually convert the 99999999999y back to -999999999999 ???


  • COBOL signed numeric fields specified with an S for the sign are stored by default in a format where the last digit of the number is stored as a value that indicates the sign of the field as well as the last digit.

    Please see the docs here for an explanation.

    If you wish the sign to actually be stored as a "-" or " " sign then you should also specify the SIGN SEPARATE clause on the data item.

    This is how COBOL stores these numbers internally and as long as you are only using the line sequential file in COBOL it will read these back in fine as the original value. If you wish to read the file with a text editor or print it then you should be using numeric edited fields instead, i.e. PIC 9(12).


  • Verified Answer

    Excellent! Thank you, Chris.