HP 3000 Manuals

File Designator Enhancement: [ COMMUNICATOR 3000 XL, XL Release 1.1 (Core Software Release A.10.00) ] MPE/iX Communicators


COMMUNICATOR 3000 XL, XL Release 1.1 (Core Software Release A.10.00)

File Designator Enhancement: 

Embedded CI Variables and Expressions by Pete Stoppani, Information 
Software Division 

With the introduction of MPE XL's Command Interpreter the concept of CI
variables and expressions was added to the user environment.  CI
variables and expressions provide a powerful extension to MPE XL's user
interface.  In order to expose the versatility and increased
expressiveness of CI variables and expressions in the file system, the
file designator options of the HPFOPEN and FOPEN intrinsics have been
enhanced to allow embedded CI variables and expressions.

EMBEDDING CI VARIABLES AND EXPRESSION 

The syntax for variables and expressions embedded in file designators is
the same as for variables and expressions used at the Command Interpreter
level.  To embed a variable and/or expression in a file designator one
simply precedes the variable/expression with an exclamation mark ("!" ).
The exclamation mark indicates to the intrinsic that a variable or
expression is present and that these should be evaluated (also called
'substituted') before the file designator is parsed and evaluated.  By
evaluating variables before validating the file designator the file
system retains compatibility with previous versions of MPE.


WARNING Since the exclamation mark is now used to identify the existence of embedded Command Interpreter variables and expressions, the exclamation mark is no longer a valid FOPEN formaldesignator terminator character.
AFFECTED FILE DESIGNATOR OPTIONS There are several options that can be used to specify a file designator. Each of these options may contain embedded CI variables and expressions. HPFOPEN provides the following three file designator options: formaldesignator (item# 2), Pascal XL string (item# 51), and file equation string (item# 52). FOPEN provides one file designator option called the formaldesignator option. The following sub-sections show examples of how to specify embedded variables for each of these options. Also, several of these file designator options have 'length' limitations that affect the use of embedded variables, so these limitations are also discussed below. For the following examples assume that these commands have been executed successfully: :SETVAR afile1 "payroll" :SETVAR afile2 "!afile1.!!hpgroup.!!hpaccount" :SETVAR id 1000 :SETVAR logfile "!!['log'+'!!id'+'.logfiles']" HPFOPEN's 'formaldesignator' Option The following Pascal/XL example opens the file 'payroll.pub' using the CI variable 'afile1'. formal_desig := '%!afile1.pub%'; HPFOPEN (file_number, status, 2 {formaldesignator}, formal_desig, ...); Up to 91 characters may be passed to HPFOPEN's formaldesignator option (including the delimiter characters). This is the only limitation for this option. HPFOPEN's 'Pascal XL String' Option The following Pascal/XL example opens the file 'log1000.logfile' using the CI variable 'logfile' which contains the expression '!['log'+'!id'+'.logfiles]'. This example could be used to generate log file names in a job that increments the variable 'id' each time the job runs a program which contains the following code segment. file_desig_string := '!logfile'; HPFOPEN (file_number, status, 51{Pascal XL String}, file_desig_string, ...); Up to 93 characters may be passed to HPFOPEN's Pascal XL String option (including the string size word). This is the only limitation for this option. HPFOPEN's 'File Equation String' Option The following Pascal/XL example opens the file 'payroll' in the current logon group and account using the CI variable 'afile2'. feq_string := '%!afile2;dev=disc;rec=40,,f,ascii;disc=20000%'; HPFOPEN (file_number, status, 52 {file eq string}, feq_string, ...); Up to 200 characters may be passed to HPFOPEN's File Equation String option (including the delimiter characters). However, the formaldesignator part of the file equation (to the right of the "=" when included) has a limit of 8 characters per file name component (name, lockword, group, account). Therefore, when embedding variables and expressions in this option, the variables and expressions may not exceed 8 characters (including the exclamation mark). This limitation is not a problem since a variable with a short name can be assigned an expression which contains many characters. FOPEN's 'formaldesignator' Option The following Pascal/XL example opens the file 'payroll' in the current logon group and account using the CI variable 'afile2'. formal_desig := '!afile2%'; file_number := FOPEN (formal_desig, ...); The formaldesignator option has a limit of 8 characters per file name component (name, lockword, group, account). Therefore, when embedding variables in this option, the variables may not exceed 8 characters (including the exclamation mark). Also, only variables that consist only of alphanumeric characters may be embedded in FOPEN's formaldesignator option. Therefore, since expressions usually contain non-alphanumeric characters, expressions may not be embedded in the formaldesignator option. These limitations are not a problem since a variable with a short name can be assigned an expression which contains many characters (alphanumeric and non-alphanumeric). DOCUMENTATION Refer to the following documentation for additional information: MPE XL Intrinsics Reference Manual (P/N 32650-60013) MPE XL Accessing Files, Trap Handling, and Data Types Conversion Binder Kit MPE XL Commands Reference Manual (P/N 32650-60002)


MPE/iX Communicators