Introduction MTB Statements File System Compiler Applications Reference Guide Index

Language Structure Data Division I/O Format Division Procedure Division Mnemonics

PSTAT function

Syntax: PSTAT(partition [,EXCP=statement-label])
Discussion: The PSTAT function returns the current status of a specified partition. A 211-byte string is returned. See below for a list of the values returned by this function.

The partition parameter is the name of the partition to check. It may be a string constant or a string variable.

Return values:
Position     Length    Description
=============================================================
1            8         Program name
9            2         Logical unit number
11           8         Current file name
19           3         Current file name extension
22           3         Directory
25           2         Last system function (See QERCOMET)
29           3         Controlling terminal (TERM$)
32           3         Initiating terminal (ITERM$)
35           2         RUNSTATE value
37           4         Next user address
41           3         Directory name of object program
                       currently running
44 *         16        first 16 bytes of user's password
60 **        1         Comet for Windows session number (hex)
61           1         (blank)
62           150       50 DABS
History: * Starting with Comet version 504.208, the PSTAT function returns the first 16 bytes of the user's password as defined by the SECURE statement. This value is stored starting at position 44.

Note: The SECURE statement transfers a user-defined 32-byte string to the partition's task header, and is a convenient way to store a unique value, such as the user's log-on password. The PASSWORD function returns the 32-byte string-argument. The PSTAT function returns the first 16 bytes of this string-argument.

We suggest that you use the SECURE statement to store two values, a user ID and a password, as follows:

Bytes 1-16 user name (available via PSTAT)
Bytes 17-32 password (not available via PSTAT)

To retrieve your own user ID, perform the following operation:

USER$ = SUB(PSTAT(PARTITION$),44,16)

where USER$ is a string variable with a length of 16.


** Starting with Comet version 504.210, the PSTAT function returns the Comet for Windows session number. This value is stored at position 60, and is stored in hex. A value of 0 indicates "no session."


Starting with Build 292, PSTAT adds leading 0's to a partition name if you specify a "short" partition name.

Example:

You specify: PSTAT("3")
Comet performs: PSTAT("003")

Example:
LENGTH 211 & LOCAL VALUE$
.
.
.
VALUE$ = PSTAT("P00",EXCP=9999)
This example shows how the PSTAT function can be used to obtain partition status information for partition "P00".