HP OpenVMS Systems Documentation |
OpenVMS RTL Library (LIB$) Manual
LIB$INSQTI
The Insert Entry at Tail of Queue routine inserts a queue entry at the tail of the specified self-relative longword interlocked queue. LIB$INSQTI makes the INSQTI instruction available as a callable routine. FormatLIB$INSQTI entry ,header [,retry-count] RETURNS
Arguments
DescriptionThe queue into which LIB$INSQTI inserts an entry can be in process-private, processor-private, or processor-shareable memory to implement per-process, per-processor, or across-processor queues. Condition Values Returned
LIB$INSQTIQ (Alpha Only)
The Insert Entry at Tail of Queue routine inserts a queue entry at the tail of the specified self-relative quadword interlocked queue. LIB$INSQTIQ makes the INSQTIQ instruction available as a callable routine. FormatLIB$INSQTIQ entry ,header [,retry-count] RETURNS
Arguments
DescriptionThe queue into which LIB$INSQTIQ inserts an entry can be in process-private, processor-private, or processor-shareable memory to implement per-process, per-processor, or across-processor queues. Condition Values Returned
LIB$INSV
The Insert a Variable Bit Field routine replaces the variable bit field specified by the base, position, and size arguments with bits 0 through (size---1) of the source field. If the size of the bit field is zero, nothing is inserted. LIB$INSV makes the VAX INSV instruction available as a callable routine. FormatLIB$INSV longword-integer-source ,position ,size ,base-address RETURNS
Arguments
Condition Value Signaled
|
| #1 |
|---|
INTEGER*4 COND_VALUE
CALL LIB$INSV (4, 0, 3, COND_VALUE)
|
This example shows how to set bits 0 through 2 of longword COND_VALUE to the value 4 in Fortran.
| #2 |
|---|
DECLARE INTEGER COND_VALUE
CALL LIB$INSV (4%, 0%, 3%, COND_VALUE)
|
This example uses BASIC to set bits 0 through 2 of longword COND_VALUE to the value 4.
The Integer Overflow Detection routine enables or disables integer overflow detection for the calling routine activation. The previous integer overflow enable setting is returned.
Note
No support for arguments passed by 64-bit address reference or for use of 64-bit descriptors, if applicable, is planned for this routine.
This routine is available on OpenVMS Alpha systems in translated form and is applicable to translated VAX images only.
LIB$INT_OVER new-setting
OpenVMS usage: longword_unsigned type: longword (unsigned) access: write only mechanism: by value
Old integer overflow enable setting (the previous contents of SF$W_PSW[PSW$V_IV] in the caller's frame).
new-setting
OpenVMS usage: longword_unsigned type: longword (unsigned) access: read only mechanism: by reference
New integer overflow enable setting. The new-setting argument is the address of an unsigned longword that contains the new integer overflow enable setting. Bit 0 set to 1 means enable, bit 0 set to 0 means disable.
The caller's stack frame will be modified by this routine.LIB$INT_OVER affects only the current routine activation and does not affect any of its callers or any routines that it may call. However, the setting remains in effect for any routines which are subsequently entered through a JSB entry point.
None.
INTOVF: ROUTINE OPTIONS (MAIN);
DECLARE LIB$INT_OVER ENTRY (FIXED BINARY (7)) /* Address of byte for
/* enable/disable
/* setting */
RETURNS (FIXED BINARY (31)); /* Old setting */
DECLARE DISABLE FIXED BINARY (7) INITIAL (0) STATIC READONLY;
DECLARE (A,B) FIXED BINARY (7);
ON FIXEDOVERFLOW PUT SKIP LIST ('Overflow');
A = 127;
B = A + 2;
PUT LIST ('In MAIN');
BEGIN;
DECLARE RESULT FIXED BINARY (31);
/* Disable recognition of integer overflow in this block */
RESULT = LIB$INT_OVER (DISABLE);
B = A + 2;
PUT SKIP LIST ('In BEGIN block');
CALL Q;
Q: routine;
B = A + 2;
PUT LIST ('In Q');
END Q;
END /* Begin */;
END INTOVF;
|
This PL/I routine shows how to use LIB$INT_OVER to enable or disable the detection of integer overflow. Note that in PL/I, integer overflow is always enabled unless explicitly overridden by a call to this routine. However, disabling integer overflow is only effective for the block which calls this routine; descendent blocks are unaffected. The output generated by this PL/I program is as follows:
In MAIN In BEGIN block Overflow In Q
The Length of String Returned as Longword Value routine returns the length of a string.
LIB$LEN source-string
OpenVMS usage: word_unsigned type: word (unsigned) access: write only mechanism: by value
Length of the source string, extracted and zero-extended to 32 bits.
source-string
OpenVMS usage: char_string type: character string access: read only mechanism: by descriptor
Source string whose length is returned by LIB$LEN. The source-string argument contains the address of a descriptor pointing to this source string.
The BASIC and Fortran intrinsic function LEN generates equivalent in-line code at run time. Therefore, it is more efficient for BASIC and Fortran users to use the intrinsic function LEN than to call LIB$LEN.If you need both the length of the string and the address of its first byte, you should use LIB$ANALYZE_SDESC or LIB$ANALYZE_SDESC_64.
None.
The Locate a Character routine locates a character in a string by comparing successive bytes in the string with the character specified. The search continues until the character is found or the string has no more characters. LIB$LOCC makes the VAX LOCC instruction available as a callable routine.
Note
On Alpha systems, OpenVMS Alpha instructions perform the equivalent operation.
LIB$LOCC character-string ,source-string
OpenVMS usage: longword_unsigned type: longword (unsigned) access: write only mechanism: by value
The relative position from the start of source-string to the first equal character or zero if no match is found.
character-string
OpenVMS usage: char_string type: character string access: read only mechanism: by descriptor
String whose initial character is used by LIB$LOCC in the search. The character-string argument contains the address of a descriptor pointing to this string. Only the first character of character-string is used, and its length is not checked.source-string
OpenVMS usage: char_string type: character string access: read only mechanism: by descriptor
String to be searched by LIB$LOCC. The source-string argument is the address of a descriptor pointing to this character string.
LIB$LOCC returns the position of the first equal character relative to the start of the source string as an index. An index is the relative position of the first occurrence of a substring in the source string. If no character matches or if the string has a length of zero, then a zero is returned, indicating that the character was not found.
None.
| #1 |
|---|
IDENTIFICATION DIVISION.
PROGRAM-ID. LIBLOC.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 SEARCH-STRING PIC X(26)
VALUE "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
01 SEARCH-CHAR PIC X.
01 IND-POS PIC 9(9) USAGE IS COMP.
01 DISP-IND PIC 9(9).
ROUTINE DIVISION.
001-MAIN.
MOVE SPACE TO SEARCH-CHAR.
DISPLAY " ".
DISPLAY "ENTER SEARCH CHARACTER: " WITH NO ADVANCING.
ACCEPT SEARCH-CHAR.
CALL "LIB$LOCC"
USING BY DESCRIPTOR SEARCH-CHAR, SEARCH-STRING
GIVING IND-POS.
IF IND-POS = ZERO
DISPLAY
"CHAR ENTERED (" SEARCH-CHAR ") NOT A VALID SEARCH CHAR"
STOP RUN.
MOVE IND-POS TO DISP-IND.
DISPLAY
"SEARCH CHAR (" SEARCH-CHAR ") WAS FOUND IN POSITION "
DISP-IND.
GO TO 001-MAIN.
|
This COBOL program accepts a character as input and returns as output the character's position in a search string. The output generated by this COBOL program is as follows:
$ RUN LIBLOC ENTER SEARCH CHARACTER: X SEARCH CHAR (X) WAS FOUND IN POSITION 000000024 ENTER SEARCH CHARACTER: Y SEARCH CHAR (Y) WAS FOUND IN POSITION 000000025 ENTER SEARCH CHARACTER: B SEARCH CHAR (B) WAS FOUND IN POSITION 000000002 ENTER SEARCH CHARACTER: b CHAR ENTERED (b) NOT A VALID SEARCH CHAR $Notice that uppercase and lowercase letters are not considered equal.
| #2 |
|---|
10 !+
! This is an BASIC program demonstrating the
! use of LIB$LOCC.
!-
EXTERNAL INTEGER FUNCTION LIB$LOCC
I% = 0
CHARSTR$ = 'DAY'
SRCSTR$ = 'ONE DAY AT A TIME'
I% = LIB$LOCC(CHARSTR$, SRCSTR$)
PRINT I%
90 END
|
This BASIC example also shows the use of LIB$LOCC. The output generated by this BASIC program is "5".
| Previous | Next | Contents | Index |