¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: COBOL help opening datasets to append records.


 

Surprisingly, once I realized that I could simply let the destination file opened (from the execution of sort input procedure) and close it at the end of the sort output procedure, the program did what I wanted with a very nice looking set of code (early 70s style coding :-D)
It is fun to see that, as you say, cobol is simply spawning the SORT program on its own to perform the work, as the SORT program output gets printed as part of the job output.

Initially, I did the exercice with raw JCL / SORT invocation... but I required several steps, separating the headr records from the payload records into different temporary datasets, sort the payload dataset and, finally, merge them into a final one... and all that, without getting rid of duplicates (which was my initial motivation to switch to use SORT under COBOL, since MVT COBOL does not support the SUM stuff)
After reading the COBOL book from 72 about SORT (which was veeery brief, pheww, just a single example!), I learn that the in out procedures were in fact, meant, to do things similar to what I wanted to do.

The idea of tagging the header records is very clever!
The way I solved that is simply counting iterations, since I know how many records my headers consist on... however, it is an interesting ideo to handle 'variable size' headers in a future!

Regarding the software/companies you mention...well... I do not know anything about anything :-P

Cheers.
Alejandro.

Join [email protected] to automatically receive all group messages.