-3

Rather simple question, that is very complicated in Cobol.

I need to print the screen to a file, just take whatever is on the screen and save it. Fileformat of the save is irrelevant, as long as I get the information out of Cobol.

Any help with this would be very much appriciated.

  • In pure Cobol, I would guess that's impossible. But you can link your cobol program to library written in another language that does the job wanted. – Luc M Oct 12 '12 at 15:15
  • 2
    Which screen? Your question is tagged "mainframe," are you in ISPF, CICS, IMS, etc. ? – cschneid Oct 12 '12 at 21:25
  • L and CSC: The data I am looking for is in Mainframe/Extra!X-treme/IMS. – user1741497 Oct 16 '12 at 07:12
  • Do you want the COBOL program to write the same information being displayed on the screen to a file, or do you want the terminal emulator to scrape the screen to a file? – zarchasmpgmr Oct 23 '12 at 23:59

3 Answers3

1

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.

DuncanKinnear
  • 4,563
  • 2
  • 34
  • 65
  • +1... This is an interesting idea, but not many "mainframe" applications use the COBOL-85 SCREEN capabilities. On mainframe systems CICS is more likely used where none of this would apply. But this was a really good try. – NealB Nov 02 '12 at 00:50
0

EXTRA! X-treme is a terminal emulator from Attachmate for Windows machines. You may want to check the documentation for that product. Judging from this demonstration video, what you need to do may be as simple as selecting all the text in the emulator window, then choosing the Microsoft Office tool and pasting the text into a Word document.

David Gorsline
  • 4,933
  • 12
  • 31
  • 36
0

If you are using aviva mainframe emulator, insert this line just before action that takes you to next screen.

rc% = AppWin.SaveScreen("full file location with name of file and extension",2)

I am using this method to save screen to a .txt file. Option 2 appends output one after another. Hope it helps.

Machavity
  • 30,841
  • 27
  • 92
  • 100
Pramod Yadav
  • 467
  • 8
  • 14