Return the job number for the current process

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
id = %JBNO([parent_id][, group_id])


xcall JBNO(id, [parent_id][, group_id]) 

Return value


The job or process identification number for the current job or process. (n)



(optional) The variable to be loaded with the current parent process identification number. (n)


(optional) The variable to be loaded with the network adapter address on Windows if a network adapter is present. (Windows only) (a)


(optional) The variable to be loaded with the current process group identification number. (UNIX, OpenVMS only) (n)


%JBNO is evaluated at runtime. You can use %JBNO to create a unique name for a temporary file.

On Windows, id is the low‑order 20 bits of the process ID number. When Windows Terminal Services are enabled, parent_id is the WTS session ID, which is unique between WTS sessions; otherwise, parent_id is 0. Group_id is obtained from the GetAdaptersInfo function.


The group_id obtained from a Windows Terminal Services client reflects the server’s network address and thus is identical to all other WTS clients.

On UNIX, the current process group ID number remains constant throughout a log‑in session unless a process that creates a new process group ID is executed. On some systems, ksh generates a new process group ID.

On OpenVMS, parent_id is loaded with the process ID of the process that created the current process. Group_id is loaded with the group number of the current process’s UIC.

%JBNO can also be called as a subroutine, with the syntax

xcall JBNO([id], [parent_id][, group_id])

The JBNO subroutine requires at least one argument, but you can specify any or all of the three arguments. Id should be an i4 or d8 variable on all platforms to prevent overflow. Id is unique for each program on a machine but is not guaranteed to be unique on different machines on the network. For a unique number for a work file on a network, we suggest using a combination of id and group_id.


This example creates a temporary file using id as the file extension and time as the filename.

subroutine tmpfile
    a_name              ,a
    time                ,d6
    id                  ,i4
    xcall time(time)
    xcall jbno(id)
    a_name = %string(time) + '.' + %string(id)