The following is an example of how this can be done using the Windows Clipboard API functions.
id division. program-id. testclip. special-names. call-convention 74 is winapi. working-storage section. 78 GMEM-MOVEABLE value 2. 78 CF-TEXT value 1. 01 hWndNewOwner pic x(4) comp-5 value zeroes. 01 retCode pic x(4) comp-5 value zeroes. 01 any-key pic x. 01 myHandle pointer. 01 myPointer pointer. linkage section. 01 datatocopy pic x(30). procedure division. call winapi "GlobalAlloc" using by value GMEM-MOVEABLE by value length of datatocopy returning myHandle end-call call winapi "GlobalLock" using by value myHandle returning myPointer end-call set address of datatocopy to myPointer move z"This is a test" to datatocopy *> null terminate text call winapi "GetActiveWindow" returning hWndNewOwner end-call call winapi "OpenClipboard" using by value hWndNewOwner returning retCode end-call if retCode = 0 display "error" else call winapi "EmptyClipboard" call winapi "SetClipboardData" using by value CF-TEXT by reference datatocopy end-call call winapi "CloseClipboard" end-if call winapi "GlobalUnlock" using by value myHandle returning retCode end-call call winapi "GlobalFree" using by value myHandle stop run.