Title: How to copy data from the clipboard

If an isCOBOL program needs to use the current data from the clipboard, and that isCOBOL program has an active screen, it is simple to do using the action-paste action of an entry-field.
The basic code to place the data from the Clipboard into an entry-field and then get it from the entry-field to a variable is as follows:

       initialize ws-clipboard
       modify  ef-clipboard value  spaces
       modify  ef-clipboard action action-paste 
       inquire ef-clipboard value  ws-clipboard

The variable ws-clipboard would be defined as:

       01 ws-clipboard pic x any length.

And the ef-clipboard entry-field would be defined with the property visible 0 to be invisible.
The screen might look like this.

For example, if you copy text (ctrl-c) from a file you are editing in notepad and then you press the push-button on the screen, the clipboard data will be written to ws-clipboard using the code above.
Then you can display to a message box (or use for any needed business logic in a real program).

You can download the complete sample program attached below that demonstrates this functionality.

Compile it with this command line:

   iscc  -sp="%iscobol%sampleisdef" copyfromclipboard.cbl

Run it with this command line:

Authored by: Veryant Support on Fri, Jul 10th, 2020 at 7:00 PM
This question has been viewed 1551 times so far.
Online URL: http://support.veryant.com/support/phpkb/question.php?ID=313

Powered by PHPKB Knowledge Base Software