[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
Reference Manual


Previous Contents Index

Relative Files

  1. 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

  1. 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.
  2. If there is a KEY phrase, the comparison described in General Rule 4 uses the contents of key-data.
  3. 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.
  4. If START statement execution is not successful, the Key of Reference is undefined.
  5. 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

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

  1. STOP RUN terminates image execution.
  2. 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

  1. STOP RUN causes all open files to be closed before control returns to the operating system prompt.
  2. 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

  1. pointr cannot define the assumed decimal scaling position character (P) in its PICTURE clause.
  2. Literals can be any figurative constant other than ALL literal.
  3. The description of dest-string cannot: (a) have a JUSTIFIED clause or (b) indicate an edited data item.
  4. The size of pointr must allow it to contain a value one greater than the size of dest-string.

General Rules

  1. delim specifies the characters to delimit the move.
  2. If the size of delim is zero characters, it never matches a src-string delimiter.
  3. If src-string is a variable-length item, SIZE refers to the number of characters currently defined for it.
  4. When src-string or delim is a figurative constant, its size is one character.
  5. 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.
  6. 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:
      1. Reaches the end of src-string
      2. Reaches the end of dest-string
      3. Detects the characters specified by delim
  1. No data movement occurs if the size of src-string is zero characters.
  2. 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:
      1. Has transferred all data in each src-string
      2. 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.
  3. When the POINTER phrase appears, the program must set pointr to an initial value greater than zero before executing the STRING statement.
  4. When there is no POINTER phrase, the STRING statement operates as if pointr were set to an initial value of 1.
  5. 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.
  6. 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.
  7. 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
  8. 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:


Previous Next Contents Index