HPlogo Communicator 3000 MPE/iX Release 6.0 (Platform Software Release C.60.00): HP 3000 MPE/iX Computer Systems > Chapter 10 Technical Articles

CI Enhancements

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

by M Gopalakrishnan and Jeff Vance
Commercial Systems Division

Introduction

This article describes the CI enhancements introduced in MPE/iX Release 5.5 Express 5 and 6.0. The most notable enhancement is that POSIX filenames support additional special characters. The COPY command has been enhanced and several new CI evaluator functions have been added.

POSIX Filenames

Prior to this enhancement, characters in POSIX filenames were restricted to upper and lower case letters, numbers, dash, underbar and dot. Now, a POSIX filename can contain the following additional characters: ~\$%^*+|{} :

A POSIX filename may begin with any supported character except a dash. There are no changes to MPE filename rules.

Example

BUILD ./ab$cd:ef
LISTFILE ./ab$cb:ef,6
/SYS/PUB/ab$cd:ef

COPY ./ab$cd:ef ./~anew%
LISTFILE ./[a~]@
ab$cd:ef ~anew%

Enhancements to the COPY Command

The COPY command has been enhanced to accept MPE-syntax and POSIX-syntax directory names for the TO= parameter. Additionally, a space is an accepted delimiter between the FROM= and TO= arguments .

For example (assume the CWD is /SYS/PUB):

NEWDIR mydir
NEWDIR ./mydir
BUILD ./foo

COPY ci, boo creates BOO.PUB.SYS, as always
COPY ci mydir creates /SYS/PUB/MYDIR/CI
COPY ci ./mydir creates /SYS/PUB/mydir/CI
COPY ci, /SYS creates /SYS/CI
COPY ./foo mydir creates /SYS/PUB/MYDIR/foo
COPY ./foo ./mydir/ creates /SYS/PUB/mydir/foo

File equations are supported for both the FROM= and TO= parameters. However, the TO= name cannot be a back reference to a file equation who's actual filename is a directory. As before, symbolic links are accepted as the source and/or target filenames.

Enhancements to the SHOWVAR Command

The SHOWVAR command now allows users with SM capability to see user-defined CI variables for a job or session other than their own.

Syntax

SHOWVAR [var1 [,var2 [varN]]] [;JOB=[#]J|Snnnn] [;USER | ;HP | ;ANY]

JOB=

causes the user-defined variables associated with another job or session to be displayed. The HP option is not supported with JOB=, and no HP predefined variables are visible for another job/session.

USER

specifies that only user-defined variables are shown. this is the default when no variable name is supplied. USER is implied when JOB= is used.

HP

specifies that only HP predefined variables are shown.

ANY

specifies that both user and predefined variables are shown. This is the default when one or more variable names are supplied.

Operation

This command displays the variables specified and their values. It displays information in the format `VARIABLE NAME = value string'. By default, the user's own variables are shown. System Manager (SM) capability is required to see the variables for another job or session.

If the variable names are omitted `@' and USER are assumed. The HP predefined variables are listed in alphabetical order; whereas, the user-defined variables are displayed in temporal order, that is the order in which they were created. The specification of JOB= forces the USER option too.

This command may be issued from a session, job, program or in BREAK. Pressing Break aborts the execution of this command.

Example

To see all user-defined variables for job #J123, enter

SHOWVAR @;job=J123; USER

New Evaluator Functions

ANYPARM

ANYPARM() returns any combination of characters as a string. String function.

Syntax

ANYPARM(anything)

This new function accepts all characters, including, commas, quotes, right parentheses, etc. and treats them as a single string value. This is handy when used in conjunction with the ANYPARM parameter type. The one exception is that the "!" character, which introduces a CI variable.

The ANYPARM() function has two important restrictions:

  • It must be the last (right-most) or only function on a command line

  • It may not be nested inside other function arguments. For example, lft(ANYPARM(),1) is not supported, nor is word(ANYPARM()).

These constraints are necessary since ANYPARM() accepts all characters as its argument, including right parentheses.

Examples

Assume the script is named "doit":

ANYPARM p1 option list setvar _infostr ANYPARM (!p1) run prog; info="![repl(_infostr,`"',`""')]" ...
:doit abd"def'fhi)klm,p,q)r setvar _infostr anyparm(abc"def'fhi)klm,p,q)r) run prog; info="abc""def'fhi)klm,p,q)r"

NOTE: In the last example, if one of the characters is a "!" then the CI will attempt to reference a variable that follows the "!". For example, if the "f" is replaced by a "!" then the CI will try to reference a variable named HI. If this variable is not found a CI warning is reported.

BASENAME

BASENAME()—returns the filename component of a POSIX or MPE filename. String function.

Syntax

BASENAME(str[,suffix])

This new function returns the base component (file part only) for the passed filename. str can be any filename in MPE or POSIX syntax. suffix is an optional string, that if supplied and the filename base ends in suffix then the suffix is removed from the BASENAME. suffix applies to MPE and POSIX names. The suffix portion of the BASENAME will not be deleted if this results in deleting the entire basename.

Examples

CALC basename('a.b.c')
A

CALC basename('/a/b/c')
c

CALC basename('./a/b')
b

CALC basename("./a.sl",".sl")
a

CALC basename('/')
/

CALC basename("*feq")
*FEQ

CALC basename('$null')
$NULL

CALC basename('abc.g','c')
AB

CALC basename('/usr/lib/liby.a','.a')
liby

CALC basename('/usr/lib/liby.a','liby.a')
liby.a

DECIMAL

DECIMAL()returns a string value of an integer. String function.

Syntax

DECIMAL(int)

This new function behaves analogously to the existing hex() and octal() functions. It accepts a single integer argument and functionally returns the decimal string equivalent.

Examples

CALC decimal(255)
255 < - - as a string

CALC len(decimal($ff))
3, $3, %3

setvar i 0
while setvar(i,i+1) < 10 and finfo("FILE"+DECIMAL(i), 'exists') do
...

The last example is significant since this is the only case where explicit variable substitution ('!varname') does not work as an alternative to decimal. If the finfo() line was written as:

finfo("FILE"+"!i", 'exists') do

then the first iteration would call FINFO on a file named 'FILE0' rather than a file named 'FILE1'. This is because explicit variable dereferencing is performed early by the CI, well before the setvar() function is called.

DIRNAME

DIRNAME()—returns the directory components of a POSIX or MPE filename. String function.

Syntax

DIRNAME(str)

This new function returns the directory components for the passed filename. str can be any filename in MPE or POSIX syntax. MPE filenames are converted to POSIX names before extracting the directory portion of the name.

Examples

CALC dirname('a.b.c')
/C/B

CALC dirname('/a/b/c')
/a/b

CALC dirname('./a/b')
./a

CALC dirname("./a.sl")
.

CALC dirname('/')
/

CALC dirname("*feq")
[empty string]

CALC dirname('$null')
[empty string]

CALC dirname('abc.g')
/SYS/G

CALC dirname(fqualify('./a'))
/ACCOUNT/GROUP # when the CWD is your logon group or
/CWD # when the CWD is a directory

FQUALIFY

FQUALIFY() returns a fully qualified filename. String function.

Syntax

FQUALIFY(str)

This new function returns the qualified filename for the passed filename in str. str can be any filename in MPE or POSIX syntax. str is first attempted to be translated into an MPE name. If that fails it is converted into a POSIX name. POSIX names are prepended with the CWD for relative pathnames.

Examples

CALC fqualify('a')
A.GROUP.ACCOUNT # when the CWD is your logon group or
/CWD/A # when the CWD is a directory

CALC fqualify('a.b')
A.B.ACCOUNT

CALC fqualify('a.b.c')
A.B.C

CALC fqualify('./a')
/ACCOUNT/GROUP/a

CALC fqualify('./A')
A.GROUP.ACCOUNT # when the CWD is your logon group or
/CWD/A # when the CWD is a directory

CALC fqualify('/a/b/c')
/a/b/c

CALC fqualify('*a')
*A

CALC fqualify('$null')
$NULL

CALC dirname(fqualify('./a'))
/ACCOUNT/GROUP # when the CWD is your logon group or
/CWD # when the CWD is a directory

FSYNTAX

FSYNTAX() returns the syntax of the passed filename argument. String function.

Syntax

FSYNTAX(filename_str)

This new function accepts an MPE or POSIX style filename and evaluates the filename's syntax, if wildcard characters are present, lockwords, back reference to a file equation, remote environment IDs and system defined files. If an error occurs the error number, following the word "ERROR" is returned. Possible return values are:

  • "MPE" "MPE;WILD" "MPE;LOCK" "MPE;FEQ" "MPE;$FILE" "MPE;REMOTE" and combinations where appropriate, for example, "MPE;LOCK,REMOTE"

  • "POSIX" "POSIX;WILD"

  • "ERROR=nnn" for syntax error nnn

Examples

fsyntax('a.b.c')
MPE
fsyntax('/a/b/c')
POSIX
fsyntax('./ab@/c')
POSIX;WILD
fsyntax('$null')
MPE;$FILE
fsyntax('a.b.c.d')
ERROR=426

if word(setvar(_error, FSYNTAX(myfile))) = "ERROR" then
echo Syntax error: ![word(_error,,-1)]
endif

if word(FSYNTAX(a_file)) = "MPE" then
# MPE filename
elseif word(FSYNTAX(a_file)) = "POSIX" then
# POSIX filename
else
# error

if pos("WILD", FSYNTAX(another_file)) > 0 then
# wildcarded MPE or POSIX filename

XWORD

XWORD()—returns a string less 'word'. String function.

Syntax

XWORD(str[,delims][,nth][,end_var][,start])

This new function locates the nth word from str beginning at start, delimited by one of the characters in delims, and places the index of the delimiter that terminated the word in a CI variable named by the end_var argument. It returns str minus the located word and minus the word delimiter. It is syntactically equivalent to word(), but opposite in semantics.

The arguments for xword() are identical to the word() parameters. Please refer to word() for details. HELP word and HELP xword are available.

xword() is useful for removing a token from a command line string since the token and its delimiter are not returned.

The same examples used for the word() function in an earlier article are repeated below for xword():

xword('file a=bb,old;rec=40,,f,ascii')           returns:
'a=bb,old;rec=40,,f,ascii'

xword('file a=bb,old;rec=40,,f,ascii',,2) returns:
'file bb,old;rec=40,,f,ascii'

xword('file a=bb,old;rec=40,,f,ascii',";,",,j,8) returns:
'file a=old;rec=40,,f,ascii' and J=10

xword('file a=bb,old;rec=40,,f,ascii',,-4,j) returns:
'file a=bb,old;rec=,f,ascii' and J=18

It may be illustrative to execute the above examples substituting word in place of xword(), or refer the word() examples referenced above.

Summary of CI Enhancements in C.55.03

  • The LISTF and LISTFILE commands allow users to discover who is accessing files on their system, including remote accessors. LISTFILE output can now be filtered by selecting files based on access type or file code.

  • Two new CI variables were added: HPLASTSPID and HPSPOOLID. Both contain the spoolfile ID in the form: Onnnnnnn.

  • The FLABELINFO intrinsic and FINFO() function are able to return the number of sectors and extents a file occupies, file creation time, and the number of accessors to a file.

  • The PAUSE command can now wait for one or more jobs to complete, to change state from waiting to executing, or to begin execution.

  • The INPUT command allows the number of characters to read from $STDIN to be specified.

  • The PRINT command is now able to display all data in a file, even if this data appears to be line numbers. The new NONUM option enables this feature.

LISTF/LISTFILE Enhancements

Syntax

     LISTF [fileset][,listlevel][;listfile]

LISTFILE [fileset[,fileset[,...]]]
[[;FORMAT=]format_opt]
[[;SELEQ=]select_eq indir]
[[;NAME=] pattern]
[;PASS]
[;{PERM}{TEMP}{PERMTEMP}]
[;USENAME][;TREE][;NOTREE]

The LISTF and LISTFILE commands allow users to discover who is accessing files on their system, including remote accessors. The existing syntaxes remain the same; however, new format numbers, format mnemonics, and selection equations can be specified as a result of this enhancement.

New Formats

Two new formats have been added: format 8 or "access," and format 9 or "locks." Both the LISTFILE and LISTF commands support these formats, although only LISTFILE is able to use the format mnemonic. Format 8 shows greater access-related details compared to the existing format 3, as well as displaying individual file accessors. Format 9 is a superset of format 8. All of the format 8 data is shown with specific details about each process accessing the file, including information about which locks a process owns or is waiting for. A detailed description of the items displayed for the two new formats and examples are shown below.

The selection equation parameter of the LISTFILE command is also enhanced. The new SELEQ= choices allow selection of only files that are currently opened, in use, locked, or opened exclusively. If a file is not opened as specified in the selection equation, it is skipped. Also, files can be selected based on their file code number or mnemonic. The file code mnemonic PRIV includes all privileged files, that is, those files with a negative file code. More details on the access SELEQ choices appear later in this article.

Format 8

Both formats 8 and 9 show the fully qualified filename or absolute pathname followed by the accessor summary line (described below). After the accessor summary line, there is one line of output per file accessor, consisting of:

  • job/session number

  • user name

  • number of processes accessing, locking, writing and reading the file

  • IP address for remote sessions, or the $STDLIST spoolfile ID for job accessors, or the LDEV number for local session accessors

Following is a format 8 example:

:listfile hppxudc.pub.sys,8
********************
FILE: HPPXUDC.PUB.SYS
15 Accessors(O:15,P:15,L:0,W:0,R:15),Share
#S265 MIKEP.HPE P:2,L:0,W:0,R:2 LDEV: 49
#S263 JEFFV,MGR.JVNM P:3,L:0,W:0,R:3 LDEV: 47
#S261 KROGERS.MPENT P:2,L:0,W:0,R:2 LDEV: 50
#S231 SUSANC.MPENT P:2,L:0,W:0,R:2 LDEV: 46
#S219 FAIRCHLD.MPENT P:2,L:0,W:0,R:2 LDEV: 39
#S214 CATHY,MGR.BOSS P:2,L:0,W:0,R:2 REM : 15.14.16.198
#J434 FTPMON,FTP.SYS P:2,L:0,W:0,R:2 SPID: #O21905

Analyzing the above format 8 example:

  1. The filename shown is always fully qualified as it appears in format 6.

  2. The line beginning with "15 Accessors..." is the accessor summary line, which shows the total number of accessors of the file across all jobs and sessions. This total includes all processes that have formally opened the file and all processes that have pseudo-opened the file. This is the same number seen in the FLAGS field when executing LISTF,3. The total number of accessors may not necessarily be derived by adding up the individual accessors displayed. This is because certain file accesses are done without using the file system and these accesses are transient and difficult to detect. An example of this kind of access is when STORE pseudo-opens a file to read its contents to backup.

    The "O:" field is the actual number of processes that formally opened the file (for example, called FOPEN, HPFOPEN, OPEN, or others). The O: number can be lower than the total number when the file has been pseudo-opened, as done by STORE. Another factor is that the system protects certain files at boot time by pseudo-opening them, as is done on NL.PUB.SYS. Also, a LISTF,8 done at the same time on the same file as a LISTF,2 (for instance) will show the LISTF,2 users as an accessor that has not formally opened the file. Typically, however, the O: count and total number of accessors match.

    The total number of processes (P:) accessing the file should generally match the O: count.

    The number of processes that have the file locked (L:) is seen next. The number of lockers includes all file system locks (semaphores) held by all detectable processes that are accessing the file. A single process can obtain multiple locks, and each time the count is incremented. When a process releases a lock, the count is decremented. The locks that are considered are the FLOCK semaphore (used by the FLOCK intrinsic), the OPEN semaphore (used by the file system), and the GUFD semaphore (used to control I/O).

    The number of writers (W:) and readers (R:) are displayed next. The writer and reader counts can be greater than the number of accessors since a single process can open the same file multiple times. Also, when a process opens a file for append, update, or save (read/write) access both the writer and reader counts are incremented.

    After all of the counts are shown, the file-sharing mode is displayed. This is either "Share" for files opened shared, or "Exclusive" for files opened exclusively. Typically when a file is opened exclusively there is only a single accessor; however, the POSIX fork() and dup() functions are exceptions.

    The last item displayed in the access summary is the backup state. If the file is being stored, then "Storing" is shown. If the file is being restored, then "Restoring" is seen. If the file is being concurrently backed up, then "ConcurrBackup" is displayed. Otherwise, nothing additional is shown.

  3. The lines after the accessor summary line reflect each job and session accessing the file. There is one line displayed for each job and session accessing the file, even if there are multiple processes within the job accessing the same file.

    The first field shown is the job/session number. If the accessor is a system process then "system" is seen instead of a job ID. Following the job ID is the user name associated with the job. This consists of the USER.ACCOUNT preceded with an optional job name. The logon group name is not seen.

    The same counts displayed in the accessor summary line are shown for each individual job accessor. The definitions are identical. Unlike the summary line, the reader and writer fields are truncated if the process and locker counts are extremely high. In this event the right-most field is the first to be truncated and an "$" indicates that truncation occurred.

    The last field displayed depends on whether the accessor is a job, a remote session or a local session. For jobs, the spoolfile ID is shown. For local sessions, the LDEV number is displayed. If the accessor is remote, the IP address is shown.

Format 9

In addition to the format 8 data, format 9 shows more details such as:

  • PIN number

  • program name

  • access method (for example, read, execute, or others)

  • share mode (for example, multi, gmulti)

  • current record number being accessed

  • file number

  • locks the accessing process owns and is waiting on

Following is a format 9 example:

:listfile hppxudc.pub.sys,9
********************
FILE: HPPXUDC.PUB.SYS
5 Accessors(O:5,P:5,L:5,W:0,R:5),Share
#S263 JEFFV,MGR.JVNM P:3,L:3,W:0,R:3 LDEV: 47
#P147 (LFCI.PUB.SYS)
ACCESS: R-excl REC#: 0 FNUM: 13
LOCKSOwner Waiter
FLOCK
OPEN
#P154 (CI.PUB.SYS)
ACCESS: R-excl REC#: 0 FNUM: 13
LOCKS: none
#P86 (JSMAIN.PUB.SYS)
ACCESS: R-excl REC#: 336 FNUM: 16
LOCKSOwner Waiter
FLOCK

#J434 FTPMON,FTP.SYS P:2,L:2,W:0,R:2 SPID: #O21905
#P79 (CI.PUB.SYS)
ACCESS: R-excl REC#: 0 FNUM: 14
LOCKS: none
#P47 (JSMAIN.PUB.SYS)
ACCESS: R-excl REC#: 336 FNUM: 15
LOCKSOwner Waiter
OPEN FLOCK

Analyzing the above format 9 example:

  1. All of the format 8 data is seen.

  2. The PIN (Process ID Number) begins the next line, followed by the process filename.

  3. The next line shows the type of access which includes: "R" for read, "W" for write, "X" for execute, "A" for append, "L" for lock, "S" for save, "U" for update, "RD" for directory read access. The file-sharing mode is next. Values include: "sysexc" for system exclusive (rarely seen), "excl" for exclusive, "ear" for semi-exclusive (exclusive-allow-read), "shr" for shared, "multi" for shared job, or "gmulti" for system shared. Next the current record number is seen, and last is the file number.

  4. If the process does not have any locks then "NONE" is displayed. If the PIN owns or is waiting on one or more of the relevant semaphores, then the semaphore name is shown under either the "Owner" or "Waiter" column. There are three semaphores (locks) considered.

    • The FLOCK semaphore is obtained when a processes calls the FLOCK intrinsic. This lock is exclusive; meaning that only one process at a time can own the FLOCK semaphore for a file. Occasionally the FLOCK semaphore is used by the file system to synchronize directory access.

    • The OPEN semaphore is locked by the file system when a file is being formally opened. In this usage the OPEN semaphore is locked exclusively. It is also used by the operating system to protect certain file system data structures when they are being read. This usage allows the OPEN semaphore to be locked in a shared fashion. The OPEN semaphore can be locked shared by multiple processes, but once it is locked exclusively all other PINs trying to lock it will wait.

    • The GUFD semaphore is locked by the file system when it does I/O on the target file. It is locked exclusively.

Phantom Accessors

It was mentioned earlier about processes that pseudo-open (call sm_open) a file. STORE and PROGEN are examples of processes that bypass the file system by not calling FOPEN or HPFOPEN to open a file. This type of access is usually only evident by noticing that the total accessors count is greater than the open count (O:), and format 9 output typically will not show these phantom accessors.

There are also cases where a process does not open the file in any way at all, yet this process can lock one or more of the semaphores, and thus needs to be accounted for. LISTFILE and MPEX (when calling AIFSYSWIDEGET item 2065 to obtain a file's accessors) are examples of these kinds of phantom accessors. In this case the total accessor count is lower than what may be revealed by counting individual accessors shown in format 9.

If any of these phantom accessors lock one of the three important semaphores, then LISTFILE can detect the process and report reduced information about the access. If the phantom accessor process does not lock either the FLOCK, OPEN, or GUFD semaphores, then its access is undetected. Following is a format 9 example of a file that another user is also executing a LISTF,3 against. Notice that the total accessor count is one, yet we see two accessors. PIN 58 is the process that is doing the LISTF,3 and thus is seen as a phantom accessor.

FILE: GOPI.PUB.SYS
1 Accessor(O:1,P:2,L:2,W:0,R:1),Share
#S3 JVREM,MANAGER.SYS P:1,L:1,W:0,R:1 REM : 15.28.88.18
#P62 (LOCKP.PUB.SYS)
ACCESS: R-excl REC#: 0 FNUM: 11
LOCKSOwner Waiter
FLOCK

#S2 JVREM,MANAGER.SYS P:1,L:1,W:0,R:0 REM : 15.28.88.18
#P58 (CI.PUB.SYS)
ACCESS: n/a REC#: n/a FNUM: n/a
LOCKSOwner Waiter
OPEN
Restrictions

Formats 8 and 9 are available to all users, however only more privileged users get to see individual accessor information. The user having SM or OP capabilities can see all accessors of a file—assuming the user has TD access to the file itself. If the user does not have SM or OP capabilities, but does possess AM capability, and the file's GID matches the user's GID, then all accessors are displayed. If the user lacks SM, OP and AM capabilities, but is the owner of the file being listed, then the individual accessors are displayed. Otherwise only the accessor summary line is visible.

Even if the user is able to see individual accessors, certain format 9 fields have additional restrictions for security concerns: the program name and IP address are protected.

To see the program name the user must meet the same rules that apply to the SHOWPROC command. Specifically, one or more of the following applies:

  • process is within the user's logon job/session.

  • process' user and account names match the user's user and account names and the system's JOBSECURITY is set to LOW.

  • user has OP or SM capability.

To see the IP address the user must meet the SHOWCONN utility rules, namely: the user must have SM, OP, PM, NA, or NM capabilities.

Selection Equations for LISTFILE

Selection equations for the LISTFILE command have been expanded. It is now possible to select files by whether and how a file is accessed, and by file code. The ACCESS= criteria supports 4 types of access, as shown below:

SELEQ=[ ACCESS = INUSE | OPEN | LOCK[ed] | EXCL[usive] ]

Title not available (Selection Equations for LISTFILE )

INUSE

is true if any processes are accessing the file. This includes normal FOPEN-like accessors and sm_open accessors. Phantom accessors (like LISTF,2) that don't open the file at all are not noticed and thus INUSE evaluates to false. INUSE examines the total number of accessors field described above.

OPEN

is true if there are any processes that have formally opened the file by calling FOPEN, HPFOPEN, RESET, OPEN, or others. OPEN uses the same field that the "O:" count is derived from.

LOCK

is true if any process has locked (even if they are waiting) the FLOCK, OPEN or GUFD semaphores, or has called the HPFLOCK pseudo intrinsic (for POSIX record level locking).

EXCL

is true if the file was opened for exclusive access. EXCL is true when LISTF,3 shows EXCL or LISTFILE,8 shows "Exclusive."

The CODE= criteria supports file code numbers and mnemonics as shown below:

SELEQ=[ CODE = number | mnemonic | PRIV ]

The number can be positive or negative. PRIV will match all files with negative file codes.

NOTE: A new FINFO item 61 ("accessors") returns the number of accessors for a file. This represents the total number of accessors, including all processes that open the file in any manner. This is the first value seen in the accessor summary line, which is described under the Format 8 description. It is also the same value shown in the FLAGS field of a LISTF,3.

If a listed file is being accessed LISTF and LISTFILE now get the EOF for the file from runtime data structures, rather than from a possibly out-of-date file label as done in the past.

New Variables

Two new variables were added to MPE/iX CI:

  • HPLASTSPID

  • HPSPOOLID

HPLASTSPID is a read-only string variable. It contains the $STDLIST spoolfile ID for the job defined by the HPLASTJOB variable, typically the job most recently streamed in the session or job. Since HPLASTJOB allows write access, it can be set to any job number, and then HPLASTSPID will contain that job's $STDLIST spoolfile ID.

HPSPOOLID is a read-only string variable. It contains the $STDLIST spool ID of the currently streamed job. This variable is useful only in jobs—in a session it is an empty string.

FLABELINFO and FINFO Enhancements

The FLABELINFO intrinsic returns information from the file label of a disk file and the FINFO function is a CI interface to FLABELINFO. These APIs have been enhanced to return four new items :

  • number of sectors occupied by a file

  • number of extents occupied by a file

  • file creation time

  • number of accessors to a file

FLABELINFO

Table 10-1 FLABEL Item Numbers

Item Number

Type

Item Description

58

I16

Number of sectors occupied by the file.

59

I16

Number of extents occupied by the file.

60

I32

File creation time (CLOCK format).

61

I32

Number of accessor of the file.

 

FINFO accepts the following numbers and aliases:

Table 10-2 FINFO Numbers

FINFO Number

Mnemonic

Return Type

58

SECTORS

NUM SECTORS

Integer

59

EXTENTS

NUM EXTENTS

Integer

60

CREATETIME
FMTCREATETIME
CREATION TIME

String

-60

INTCREATETIME
CREATION TIME INTEGER

Integer

61

ACCESSORS

NUM ACCESSORS

Integer

 

Footnote: this is the same value as the total number of accessors in the LISTF format 8 summary line.

Examples

finfo('CI.PUB.SYS',"sectors")     = 192
finfo('CI.PUB.SYS',"extents") = 2
finfo('CI.PUB.SYS',"createtime") = 11:08 AM
finfo('CI.PUB.SYS', -60) = 110808
finfo('CI.PUB.SYS', "accessors") = 124

PAUSE Enhancement

Syntax

    PAUSE [num_seconds]
[[;JOB=]jobid]
[[;INTERVAL=]interval_secs]
[;EXIST | WAIT | NOTEXIST]

The PAUSE command allows the current task to be suspended or "sleep" for a specified number of seconds. PAUSE now supports sleeping until one or more jobs reach a certain state. For example, a script can pause while selected jobs or sessions are executing (EXIST). Or, a job can sleep while another job is suspended or waiting (WAIT), and as soon as the job starts executing or terminates the pause completes. A session can pause while no jobs exist (NOTEXIST) and wake up as soon as the first job is launched.

In its simplest form, the PAUSE command sleeps for num_seconds, or less if Break is pressed. In this simple case no jobid is specified and all other command arguments are ignored. If the jobid parameter is specified, then interval_secs and the remaining command parameters have meaning. When jobid is supplied, PAUSE typically sleeps until the jobs or sessions matching jobid have terminated.

Options

EXIST

(default) means to pause while all jobs and sessions matching jobid exist. These jobs can be scheduled, waiting, executing, and other states; but, as long as the system's global job table (JMAT) contains an entry for any of the selected jobs and sessions, the PAUSE command will continue to sleep.

WAIT

means to pause while the selected job or jobs are waiting. As soon as all the matching jobs are no longer waiting (meaning all the job states are no longer "introduced," "waiting," or "scheduled") the pause ends. The life cycle of a job is typically:

[sched or waiting->] intro-> initializing->
exec-> [susp-> exec->] terminate

Waiting jobs are considered all job states left of and excluding "initializing." Non-waiting jobs are all jobs right of and including "initializing."

NOTEXIST

means to pause while the matching job or jobs do not exist. As soon as any jobs matching jobid exist (in any state) the pause completes. PAUSE might miss finding short-lived jobs. This is particularly true for a match on a single job/session number. A more practical use might be:

PAUSE job=@J;notexist

which means to sleep while no jobs exist. As soon as the first job is streamed the above pause stops.

Collectively EXIST, WAIT, and NOTEXIST are referred to as the "while_state," since PAUSE sleeps "while" the specified state condition is true.

Parameters

num_ seconds

if num_seconds is specified without jobid, PAUSE sleeps for that many seconds, or until the process issuing the PAUSE is interrupted by the break signal.

If jobid is also supplied then num_seconds has a different meaning. In this case it indicates the maximum duration for the PAUSE command, such that PAUSE should continue while the selected jobs are in their "while_state" or when num_seconds has expired, WHICHEVER IS SHORTEST. Thus, num_seconds represents the maximum length of the pause. If PAUSE completes but the one or more jobs are still in their "while state" a CIWARN is reported. Note: to pause while a job is in its "while_state" or until num_seconds has expired, whichever is LONGEST, execute the following two commands:

PAUSE x
PAUSE job=y ;z

If after X seconds job Y is still in state Z, then the second PAUSE continues while state Z applies. On the other hand, if after X seconds job Y is not in state Z then the pause is complete.

jobid

can be one of: [#]Jnnn, [#]Snnn, [jobname,]user.acct, @, @J, @S. Note if jobname is included then the jobid must be quoted since the comma is a command token delimiter.

If the JOB= parameter is specified then PAUSE sleeps while jobid is in its "while_state." jobid can be an executing, waiting, scheduled job, or a session. jobid can also name many jobs or sessions. Wildcarding is supported, and a non-wildcarded [jname,]user.acct can match several jobs or sessions. The job name can be "," or "@," to match all jobs or sessions without a job name. When more than one job or session matches jobid, PAUSE sleeps while all matching jobs are in their "while_state." If the job executing PAUSE matches jobid it will not be selected.

interval_ secs

if specified, PAUSE sleeps for this many seconds between attempts to see if jobid is still in its "while_state." Otherwise, PAUSE sleeps a variable amount of seconds depending on the job state and the number of previous times a particular job has been polled. This computed method favors executing jobs that terminate quickly.

Examples

The following pauses while job #J20 is in any of the JOB states such as INTRO, SCHED, and EXEC until the job terminates:

:PAUSE JOB=#J20;EXIST

The following pauses while job #J24 is in INTRO, WAIT, or SCHED state. PAUSE ends when #J24 is no longer in any of these states.

:PAUSE JOB=#J24;WAIT

The following example pauses while job #J24 exists in the system job table, (JMAT). That is, it is visible in SHOWJOB output.

:PAUSE job=#j24

The next example sleeps as long as MANAGER.SYS has any jobs or sessions running or waiting.

:PAUSE job=manager.sys exists

The next example pauses until the job streamed starts executing

:STREAM myjob
:PAUSE job=!hplastjob; wait

Or sleeps until the job you just streamed completes.

:PAUSE , !HPLASTJOB

The following example sleeps until all jobs have logged off or 5 minutes, whichever occurs first.

:PAUSE 300, @J
:IF hpcierr = -9032 then
# pause terminiated but one or more jobs are still running

The next example pauses while all jobs (by naming convention only) in the PROD account are running.

:PAUSE job="J@,@.PROD"	          #note the quotes are required

The next example sleeps while the backup JOB ("JBACKUP,OP.SYS") has not been streamed. PAUSE reports CIWARN 9032 if the job is not streamed within 30 minutes.

:PAUSE 1800, job="jbackup,op.sys"; notexist

The final example polls the JMAT every 3 minutes looking for any job or session matching a user name that includes the letters "MGR", and waits for all such job/sessions to terminate before the pause ends.

:PAUSE , @mgr@.@ , 180

INPUT Enhancement

The INPUT command was enhanced to accept the number of characters to read from $STDIN. INPUT optionally writes prompt to $STDLIST then reads numchars from $STDIN into varname, optionally waiting seconds for the user to enter the data.

Syntax

INPUT [NAME=]varname
[[;PROMPT=]prompt]
[[;WAIT=]seconds ]
[[;READCNT=]numchars]

The READCNT parameter is new. If numchars characters are specified then up to numchars bytes will be read from $STDIN. Of course the user can press the Return key at any time to complete the read. numchars is most useful for reads of only a few characters and exempts the user from being required to press the Return key. The default numchars is the maximum size of the CI's command buffer, currently 511 bytes. If numchars is specified and less characters are supplied as input, the user must still press the Return key to send the data.

Example

INPUT myvar,'Do you want to continue (Y/N)?', 10, 1

prompts to $STDLIST, and does a 10 second timed read on $STDIN of one character. When the user types the first character the read will complete and the read byte will be stored in the variable named MYVAR.

PRINT Enhancement

The PRINT command prints truncated records when an UNNUMbered file contains the trailing eight characters as digits. The PRINT command is not displaying the trailing eight characters as it assumes those digits as line numbers.

NOTE: This is the existing rule as of MPE/iX 5.5 for determining whether a file is a numbered file:

If the trailing 8 characters of at least 10 records of a file or all records (in the case of <10 records) are digits, then that file is considered as a numbered file, provided the record line numbers (trailing 8 character digits) are in ASCENDING order.

With this new option NONUM, the contents of the file would be displayed as it is, without assuming the trailing 8 characters as line numbers.

With this enhancement, the PRINT command syntax is

PRINT  [ [FILE=] filename]
[[;OUT=]outfile]
[[;START=] m]
[[;END=] n]
[[;PAGE=] p]
[;UNN | NUM ]
[;NONUM]
  • With this new option, to print the line numbers as in the case of UNNUMbered files (that is, line numbers starting from 1 for the first record and so on), use this command:

    :PRINT infile;NUM;NONUM
  • To consider the file as UNNUMbered file even when the file is a NUMbered file and then print the contents as it is in the file, use this command:

    :PRINT infile;UNN;NONUM
    :PRINT infile;NONUM

Examples

In this example, UFILEYES is an unnumbered file with trailing 8 characters as digits.

:PRINT UFILEYES
aaaaaaaaaaaa
bbbbbbbbbbbb
cccccccccccc
dddddddddddd
eeeeeeeeeeee
ffffffffffff
gggggggggggg
hhhhhhhhhhhh
iiiiiiiiiiii
jjjjjjjjjjjj
kkkkkkkkkkkk
llllllllllll
NOTE: The above file was considered by PRINT to be a numbered file and thus the trailing 8 bytes are truncated.
:PRINT UFILEYES;NONUM
aaaaaaaaaaaa00010001
bbbbbbbbbbbb00010002
cccccccccccc00010003
dddddddddddd00010004
eeeeeeeeeeee00020001
ffffffffffff00020002
gggggggggggg00020003
hhhhhhhhhhhh00020004
iiiiiiiiiiii00030001
jjjjjjjjjjjj00030002
kkkkkkkkkkkk00030003
llllllllllll00030004

In the above example, NONUM option displays all the data in the file.

Feedback to webmaster