The run-time system error COBRT252 "Memory corruption detected (Fatal)", might occur when performing a SORT FIELDS=COPY on a file with a record format of VB, under mainframe emulation of DFSORT.
-542609
If you create a multi-threaded application that uses CBL_EXIT_PROC to perform an exit procedure when the program terminates, and an error occurs during the exit procedure, the application does not terminate with a non-zero exit code to the operating system.