Author: steve-myers
Posted: Wed Jul 27, 2016 8:59 pm (GMT 5.5)
Something like this is not terribly difficult to write in Assembler. I did something similar back in the 1970s or perhaps the early 1980s as a TSO command - TPRINT (dataset dataset ... dataset) ... to print several data sets. One issue I had that you do not have is integrating the now obsolete table reference character (specified with OPTCD=J) into the output.
As Mr. Sorichetti and Mr. Dodgers propose, rather than trying to force the language and the PL/I library to define DCB attributes on the fly, use BPXWDYN to allocate an output data set with the required DCB attributes. One thing you have not considered is how to print data sets with ANSI carriage control characters and "machine" carriage control together. This is not trivial! Fortunately, "machine" carriage control is quite rare any more
Another issue is detecting input DCB attributes using the language and the library. I do not know if this is relatively easy to do, or is even possible.
Rather than trying to produce an output data set with "optimal" DCB attributes based on the input, just use a data set with varying length records large enough for the maximum input length you plan to support. You can keep the output size reasonable by trimming any trailing blanks from input records.
Good luck!
Posted: Wed Jul 27, 2016 8:59 pm (GMT 5.5)
Something like this is not terribly difficult to write in Assembler. I did something similar back in the 1970s or perhaps the early 1980s as a TSO command - TPRINT (dataset dataset ... dataset) ... to print several data sets. One issue I had that you do not have is integrating the now obsolete table reference character (specified with OPTCD=J) into the output.
As Mr. Sorichetti and Mr. Dodgers propose, rather than trying to force the language and the PL/I library to define DCB attributes on the fly, use BPXWDYN to allocate an output data set with the required DCB attributes. One thing you have not considered is how to print data sets with ANSI carriage control characters and "machine" carriage control together. This is not trivial! Fortunately, "machine" carriage control is quite rare any more
Another issue is detecting input DCB attributes using the language and the library. I do not know if this is relatively easy to do, or is even possible.
Rather than trying to produce an output data set with "optimal" DCB attributes based on the input, just use a data set with varying length records large enough for the maximum input length you plan to support. You can keep the output size reasonable by trimming any trailing blanks from input records.
Good luck!