Search code examples
winapicobolmicrofocus

getpid in COBOL on windows platform


How to get process id or parent process id through a COBOL code running on windows platform?


Solution

  • I'm answering for GNU Cobol, formerly OpenCOBOL.

    There is a CALL "C$GETPID" RETURNING integer-value END-CALL

    as part of the stock library. Basically it calls getpid() or _getpid()

    If you are not linking to standard C libraries, but have access to Kernel32.dll, the WinAPI has GetCurrentProcessId()