Demo retrieving pid from Server Express

0 Likes
over 6 years ago

 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
Comment List
Anonymous
Related Discussions
Recommended