HPlogo Using NS 3000/iX Network Services: HP 3000 MPE/iX Computer Systems > Chapter 3 Remote File Access

FPARSC Intrinsic

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Parses a file designator and determines whether it is syntactically correct.

Syntax

FPARSE (string,result[,items][,vectors])

Parameters

string (input)

Byte array, by reference. The file designator that is to be parsed. The string can be terminated by any non-alphanumeric character except a slash, period, colon, underscore, or dash (/, ., :, _, -).

result (output)

Array of two 16-bit integers, by reference. A value indicating the result of the parse, returned in the first 16-bit word. (The second 16 bits are reserved.) If the value is positive, the file string is syntactically correct and the value indicates the type of file reference being made:

  • 0 = regular formal designator

  • 1 = back reference (first character is *)

  • 2 = system file (first character is $)

A negative value represents the error code returned. The error messages are listed in the NS 3000/iX Error Messages Reference Manual.

items (input)

Array of 16-bit integers, by reference. An array of item codes representing portions of the file string. The item codes (except for 0) may be included in any order; the same order is followed in the output vectors array. Item code 0 indicates the end of the items array.

The item codes have the following definitions:

   0 = indicateds end of this array
1 = file name
2 = lockwood
3 = group name
4 = account name
5 = environment ID

Note that an initial $ is considered part of the file name portion, while * is not.

vectors (output)

Array of 16-bit integers, by reference. Gives offset and length information that indicates the parse of the file string. Each element of the array is a 16-bit integer; each pair of elements corresponds to a portion of the string, in the same order as the items in the items array. The first 16-bit integer of each pair is the byte offset of the item (from the start of the string to the start of the item), and the second 16-bit integer is the item's length in bytes. A zero value (in both 16-bit integers) means that the item is not present in the file string.

For the last element of the vectors array, which corresponds to item code 0 in the items array, the second 16-bit integer is the total length of the file string. The first 16-bit integer of this element is zero unless the result parameter indicates that the file is a system file; in that case the value is the file's default designator type as defined for the FOPEN foptions parameter

   0 = non-system filename
1 = $STDLIST
2 = $NEWPASS
3 = $OLDPASS
4 = $STDIN
5 = $STDINX
6 = $NULL

In case of a syntax error in the file designator string, the first word of the first 16 bits of the vectors array returns the byte offset of the invalid item in the string. The second 16 bits will be zero.

Description

The FPARSE intrinsic parses a file designator and indicates whether or not the string is syntactically correct. You can employ this intrinsic to check a formal designator representing a remote file before attempting to open the file via FOPEN. The optional items and vectors arrays enable you to acquire parsing information for the file designator, namely, the length of each item and its position in the string. The possible items are file name, lockword, group name, account name, and environment ID. The environment ID is treated as a single item; it is not parsed into environment name, domain, and organization.

Following are examples of the items (input) and vectors (output) arrays. Remember that the order of entries in the vectors array corresponds to the (arbitrary) order of items in the items array. Also, the last pair of entries of the vectors array has a different meaning from that of the other pairs: the second 16 bits gives the total length of the file string, and the first 16 bits gives a system file code when applicable.

In the first example the file string is: FILENAME/LOCKWORD.GROUP.ACCOUNT:CASH.ACCTNG.FINANCE.

Example 1

items Array (item code)Vectors Array (offset, length)
10, 8
532, 19
318, 5
424, 7
29, 8
00.51

In the second example, the file string is *FILENAME:CASH.

Example 2

items Array (item code)Vectors Array (offset, length)
11, 8
20, 0
30, 0
40, 0
510, 4
00.15

In the third example, the file string is $OLDPASS.

Example 3

items Array (item code)Vectors Array (offset, length)
10, 8
20, 0
30, 0
40, 0
50, 0
03, 8

Feedback to webmaster