2013-09-30 1 views
0

Windows 플랫폼에서 실행되는 COBOL 코드를 통해 프로세스 ID 또는 상위 프로세스 ID를 얻는 방법은 무엇입니까? 마이크로 포커스 COBOL 가정Windows 플랫폼에서 COBOL의 getpid

+0

http://msdn.microsoft.com 호출 /en-us/library/windows/desktop/ms683215(v=vs.85).aspx와 부모 프로세스 ID에 대해서는 일반적으로이를 인수로 전달하는 것이 가장 좋으며 프로세스를 열거하고 PID를 찾고 부모 PID를 확인해야합니다 부모 프로세스가 닫히지 않고 PID가 다시 사용되기를 바랍니다. –

답변

0

이전에 OpenCOBOL 인 GNU Cobol에 대한 답변입니다.

주식 라이브러리의 일환으로 CALL "C $ GETPID"의 반품 정수 값 END-CALL

있습니다. 기본적으로는()

당신은 표준 C 라이브러리에 연결 만의 Kernel32.dll에 액세스 할 수없는 경우가의 WinAPI를이 GetCurrentProcessId있다() (GETPID) 또는 _getpid

+0

kerner32.dll을 내 프로젝트 (visual cobol-visual studio)에 포함 시켰습니다. 다음 명령은 Process ID, ProcessId pic s9 (9) comp-5를 제공하는 "GetCurrentProcessId"호출 프로세스 ID를 가져 왔습니다. – user1085296

1

, 구글이 마이크로 포커스 COBOL의 사용자로서 당신에게 http://community.microfocus.com/microfocus/cobol/net_express__server_express/w/knowledge_base/6539.obtaining-the-process-id-for-cobol-application.aspx

을 얻을 것이다, 당신은 지원 로그를-에 얻을 수 있습니다 및/지역 사회를 문의하십시오.

링크는 표준 C 함수 getpid에 대한 간단한 CALL을 제안합니다.

Obtaining the process ID for COBOL application 

This article explains how to capture the process ID for the currently running COBOL application. 
Problem: 

How can the process ID (PID) within a running COBOL program be captured? 
Resolution: 

To capture the process ID for a currently running COBOL application, you can code a COBOL CALL statement to use the system function getpid(). The standard C libraries contain the function getpid(), which can easily be called/used from within a COBOL program. 

Sample COBOL code fragments 
Sample program fragment 
Include the ctypes copy file from within the COBOL product directory as the first line in the COBOL program. 

copy '$COBDIR/demo/c-cobol/ctypes.cpy' 

WORKING-STORAGE SECTION 

DATA DIVISION 
Define the data item where the process id should be returned 

01 current-pid long 

PROCEDURE DIVISION 
Call 'getpid' returning current-pid 

The returned integer can be used as a part of temporary filenames, or to identify log file entries etc. 

Old KB# 14408 
+0

답장을 보내 주셔서 감사합니다 ... Windows 플랫폼에서이 COBOL prog를 실행하면 의심의 여지가 없습니다. – user1085296

+0

링크에는 Net Express/Server Express가 표시됩니다. 좀 더 구체적인 Windows 환경이 있다면, 내 대답은 Micro Focus에 등록하고 세부 사항에 대한 정확하고 신속한 지원을 얻는 것입니다. MicroFocus에 태그를 추가 했으므로 내가 가지고 있다고 가정합니다. C와의 인터페이스는 COBOL에서 매우 간단합니다. 대부분 Micro Focus 예제와 같이 작동합니다. –

관련 문제