%JBNO
Return the job number for the current process
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
id = %JBNO([parent_id][, group_id])
or
xcall JBNO(id, [parent_id][, group_id])
Return value
id
The job or process identification number for the current job or process. (n)
Arguments
parent_id
(optional) The variable to be loaded with the current parent process identification number. (n)
group_id
(optional) The variable to be loaded with the network adapter address on Windows if a network adapter is present. (Windows only) (a)
group_id
(optional) The variable to be loaded with the current process group identification number. (Unix, OpenVMS only) (n)
Discussion
%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. Any specified ID number should be at least 10 digits wide to prevent overflow.
%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.
Examples
This example creates a temporary file using id as the file extension and time as the filename.
subroutine tmpfile a_name ,a record time ,d6 id ,i4 proc xcall time(time) xcall jbno(id) a_name = %string(time) + '.' + %string(id) return endsubroutine