I was working with a vendor who runs a data extract program from a COBOL program. We needed to utilize a non-printable whitespace character as a field delimiter. They didn’t know how to do that since COBOL treats all whitespace equally, as spaces. I was hoping COBOL would treat \t literals as actual tabs, but it doesn’t.
So I ended up with my sample program:
000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. hello. 000300 PROCEDURE DIVISION. 000400 DISPLAY X'09'. 000500 DISPLAY "Hello World!". 000600 STOP RUN.
That X’09’ gave me my binary character for a tab! I can’t say I’d want to program in COBOL, but for a very short visit it was fun to read up on it, and write some sample programs. The above six-liner just happened to be the one I needed.
blog comments powered by Disqus