Many times I have given COBOL credit for being able to do more than most PL/I programmers think COBOL can. Until now I did not find any replacement in COBOL for the functionality provided by TITLE in PL/I. I even teased one of my colleagues, Per Jørgensen, about the impossible task of doing the same thing in COBOL. But Per is a stubborn man so he found a tip on the internet which I hereby give to you in my words.
The functionality of the following program is to read a file in FB format with LRECL=80. The DD name of the file is specified in PARM= on the EXEC card in JCL. You may execute the program by using a //MYDDNAME EXEC PGM=MYDDNAME,PARM='DDNAME01' which will output the complete contents of the dataset allocated to DDNAME01 on SYSOUT, provided you have allocated something to DD name DDNAME01 with the specified DCB information:
The idea is to manipulate the data found on the address where the FD variable ddName is located. This result is acheived in the specified way. Please be aware that the tip might not work at your installation if you are using another version of the COBOL compiler than the one used for this tip. If the tip does not work, the DD name is located at another offset in the FD variable. All you need is to determine this offset and use that instead.
Of course it is not very user friendly that COBOL does not have a function similar to TITLE in PL/I and have to use methods like the above which might be compiler version dependent. You must carefully consider your needs before you use this tip.
Did you notice the use of an internal program in COBOL? It is remarkable how few statements you need to define in order to make it work.