Actually, it is not complicated at all in Cobol.
I believe that the Cobol 85 standard (which all modern Cobols should adhere to) has the ACCEPT ..... FROM SCREEN
statement.
Assuming you have a LINE SEQUENTIAL
output file called, say, SCREEN-DUMP-FILE
, with a file record of SCREEN-DUMP-REC
you could dump the screen to this file using the following piece of code:
OPEN OUTPUT SCREEN-DUMP-FILE.
PERFORM VARYING SCREEN-LINE FROM 1 BY 1
UNTIL SCREEN-LINE > 24
ACCEPT SCREEN-DUMP-REC FROM SCREEN
LINE SCREEN-LINE COL 1 SIZE 80
WRITE SCREEN-DUMP-REC
END-PERFORM.
CLOSE SCREEN-DUMP-FILE.
Now that wasn't hard, was it?
Note that this code assumes a 'mainframe' terminal sizing which may be different in your case. Besides, most modern Cobols have a way of interrogating the actual screen size, so you could change the number of screen lines and the size of line to accept accordingly.