Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Demo retrieving pid from Server Express

Demo retrieving pid from Server Express

 Problem:

 How do I retrieve the program id (PID) on a Unix machine running Server Express?

 Resolution:

These two demos demonstrate how to retrieve the program id (PID) on a Unix machine running Server Express:

::::::::::::::
demo1.cbl
::::::::::::::
       program-id. Program1 as "demo".
       environment division.
       configuration section.

       data division.
       working-storage section.      
      $IF P64 set
       77  long                pic s9(18) comp-5 is typedef.
       77  uns-long         pic  9(18) comp-5 is typedef.
      $ELSE
       77  long                pic s9(9)  comp-5 is typedef.
       77  uns-long         pic  9(9)  comp-5 is typedef.
      $END
       01 current-pid     long.

       procedure division.
           call 'getpid' returning current-pid.
                display "PID is " current-pid.          
           goback.
       end program Program1.

::::::::::::::
demo2.cbl
::::::::::::::
       program-id. Program1 as "demo".
       environment division.
       configuration section.

       data division.
       working-storage section.
      
       procedure division.
                call 'getpid'.
           display return-code.
           goback.
       end program Program1

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2014-12-16 14:00
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.