|
HP COBOL Reference Manual
Relative Files
- The comparison described in General Rule 4 uses the data item
referred to by the RELATIVE KEY phrase in the file's ACCESS MODE clause.
Indexed Files
- The START statement establishes a Key of Reference as follows:
- If there is no KEY phrase, the file's prime record key becomes the
Key of Reference.
- If there is a KEY phrase, and key-data is a record key for
the file, that record key becomes the Key of Reference.
- If there is a KEY phrase, and key-data is not a record key
for the file, the record key whose leftmost character corresponds to
the leftmost character of key-data becomes the Key of
Reference.
The Key of Reference establishes the record ordering for the START
statement. (See General Rule 4.) If the execution of the START
statement is successful, later sequential READ statements use the same
Key of Reference.
- If there is a KEY phrase, the comparison described in General Rule
4 uses the contents of key-data.
- If there is no KEY phrase, the comparison described in General Rule
4 uses the data item referred to in the file's RECORD KEY clause.
- If START statement execution is not successful, the Key of
Reference is undefined.
- If there is an applicable USE AFTER EXCEPTION procedure, it
executes whenever an input or output condition occurs that would result
in a nonzero value in the first character of a FILE STATUS data item.
However, it does not execute if the condition is invalid key and there
is an INVALID KEY phrase.
See the rules for the INVALID KEY phrase,
Section 6.6.10.
Technical Notes
- START statement execution can result in these FILE STATUS data
item values:
File Status |
Meaning |
00
|
Start is successful
|
23
|
Record not in file or optional file not present (invalid key)
|
47
|
File not open, or incompatible open mode
|
90
|
Record locked by another user; record available; soft lock
|
92
|
Record locked by another user; record not available; hard lock
|
30
|
All other permanent errors
|
Additional References
- LOCK MODE clause in the Section 4.2.1, FILE_CONTROL paragraph in Chapter 4
- LOCK-HOLDING phrase in APPLY Clause in Section 4.2.10, I-O-CONTROL paragraph in
Chapter 4
- Section 6.1.4, Scope of Statements
- Section 6.5.1.1, Comparison of Numeric Operands
- Section 6.5.1.2, Comparison of Nonnumeric Operands
- Section 6.6.8, I-O Status
- Section 6.6.10, INVALID KEY Phrase
- Section 6.8.24, OPEN statement
- Section 6.8.26, READ statement
- Section 6.8.40, UNLOCK statement
- Section 6.8.42, USE statement
6.8.35 STOP
Function
The STOP statement permanently terminates or temporarily suspends image
execution.
disp
is any literal, or any figurative constant except ALL literal.
Syntax Rule
If a STOP RUN statement is in a consecutive sequence of imperative
statements in a sentence, it must be the last statement in that
sequence.
General Rules
- STOP RUN terminates image execution.
- STOP disp temporarily suspends the image. It displays the
value of disp on the user's standard display device. If the
user continues the image, execution resumes with the next executable
statement.
Technical Notes
- STOP RUN causes all open files to be closed before control returns
to the operating system prompt.
- STOP disp returns control to the operating system command
language interpreter level without terminating the image as follows:
- On Tru64 UNIX systems, STOP disp resumes execution
when a carriage return is entered. <>
- On Open VMS systems, control returns to DCL. The user can continue
image execution with a CONTINUE command, which returns control to the
program at the next executable statement. <>
Additional Reference (OpenVMS)
Refer to the OpenVMS User's Manual and the OpenVMS DCL Dictionary for more information
on the Digital Command Language (DCL). <>
6.8.36 STRING
Function
The STRING statement concatenates the partial or complete contents of
one or more data items into a single data item.
src-string
is a nonnumeric literal or identifier of a DISPLAY data item. It is the
sending area.
delim
is a nonnumeric literal or the identifier of a DISPLAY data item. It is
the delimiter of src-string.
dest-string
is the identifier of a DISPLAY data item. It cannot be reference
modified. dest-string is the receiving area that contains the
result of the concatenated src-strings.
pointr
is an elementary numeric data item described as an integer. It points
to the position in dest-string to contain the next character
moved.
stment
is an imperative statement executed for an on overflow condition.
stment2
is an imperative statement executed for a not on overflow condition.
Syntax Rules
- pointr cannot define the assumed decimal scaling position
character (P) in its PICTURE clause.
- Literals can be any figurative constant other than ALL literal.
- The description of dest-string cannot: (a) have a
JUSTIFIED clause or (b) indicate an edited data item.
- The size of pointr must allow it to contain a value one
greater than the size of dest-string.
General Rules
- delim specifies the characters to delimit the move.
- If the size of delim is zero characters, it never matches
a src-string delimiter.
- If src-string is a variable-length item, SIZE refers to
the number of characters currently defined for it.
- When src-string or delim is a figurative
constant, its size is one character.
- The STRING statement moves characters from src-string to
dest-string according to the rules for alphanumeric to
alphanumeric moves. However, no space-filling occurs.
- When the DELIMITED phrase contains delim:
- The contents of each src-string are moved to
dest-string in the sequence in which they appear in the
statement.
- Data movement begins with the leftmost character and continues to
the right, character by character.
- Data movement ends when the STRING operation:
- Reaches the end of src-string
- Reaches the end of dest-string
- Detects the characters specified by delim
- No data movement occurs if the size of src-string is zero
characters.
- When the DELIMITED phrase contains the SIZE phrase:
- The contents of each src-string are moved to
dest-string in the same sequence in which they appear in the
statement.
- Data movement begins with the leftmost character and continues to
the right, character by character.
- Data movement ends when the STRING operation either:
- Has transferred all data in each src-string
- Reaches the end of dest-string
- If src-string is a variable-length data item, the STRING
statement moves the number of characters currently defined for the data
item.
- When the POINTER phrase appears, the program must set
pointr to an initial value greater than zero before executing
the STRING statement.
- When there is no POINTER phrase, the STRING statement operates as
if pointr were set to an initial value of 1.
- When the STRING statement transfers characters to
dest-string, the moves operate as if:
- The characters were moved one at a time from src-string.
- Each character were moved to the position in dest-string
indicated by pointr (if pointr does not exceed the
length of dest-string).
- The value of pointr were increased by one before moving
the next character.
- When the STRING statement ends, only those parts of
dest-string referenced during statement execution change. The
rest of dest-string contains the same data as before the
STRING statement executed.
- Before it moves each character to dest-string, the STRING
statement tests the value of pointr.
If pointr is
less than 1 or greater than the number of character positions in
dest-string, the STRING statement:
- Moves no further data to dest-string
- Executes the ON OVERFLOW phrase stment
- Transfers control to the end of the STRING statement if there is no
ON OVERFLOW phrase
If pointr is not less than 1 or not greater than the
number of character positions in dest-string after the data is
transferred, the STRING statement:
- Executes the NOT ON OVERFLOW phrase stment2 and then
transfers control to the end of the STRING statement
- Transfers control to the end of the STRING statement if the NOT ON
OVERFLOW phrase is not specified
- Subscript evaluation for dest-string and pointr
occurs at the beginning of the statement.
Additional References
Examples
The examples assume the following data description entries:
|