Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

More

Format

Example

on-error

ss-handle

db-handle

RDB/VMS Relational Database Operator CREATE_SEGMENT — VMS CDD+_4.1A

 Allows you to store segments in a segmented string.

 Storing into a segmented string field requires two steps:

  o  Storing the segments into the string
  o  Storing the string field into the relation


 Example

    RDO>  CREATE_SEGMENTED_STRING RESUME_HANDLE

Additional information available:

MoreFormatExample

More

 In order to store the segments into the segmented string, the string
 must have a name.  The CREATE_SEGMENTED_STRING statement initializes
 a segmented string and gives it a handle, so you can store segments
 into the field.  After you are finished storing segments, you store
 the entire field into the relation, using the handle to relate the
 newly built string to the field in which it belongs.  Finally, you
 use the END_SEGMENTED_STRING statement to close the block.  See the
 example.

 You cannot modify a segmented string.

Format

 CREATESEGMENTEDSTRING ──┬─────────────────┬─┐
                           └─> db-handle . ──┘ │
         ┌─────────────────────────────────────┘
         └─> ss-handle ──┬──────────────┬──────>
                         └─> on-error ──┘

Additional information available:

on-errorss-handledb-handle

on-error

 Specifies host language statements or Rdb/VMS data manipulation
 statements to be performed if an Rdb/VMS error occurs.  For more
 information, ask for HELP on ON_ERROR.

ss-handle

 A host language variable or name used to refer to the segmented
 string.

db-handle

 A host language variable or name used to refer to the database.  You
 can specify a database handle as part of the segmented string handle
 if you have invoked more than one database.

Example

 Store a segmented string:

 START_TRANSACTION READ_WRITE RESERVING
   RESUMES FOR EXCLUSIVE WRITE
 !
 ! Start a stream of segments.  Give the stream a name.
 !
 CREATE_SEGMENTED_STRING RESUME_HANDLE
 !
 ! Store the segments in the field.
 !
 STORE SEG IN RESUME_HANDLE USING
    SEG.RDB$VALUE =
    "This is the first line of an employee's resume."
 END_STORE
 !
 STORE SEG IN RESUME_HANDLE USING
    SEG.RDB$VALUE =
    "This is the second line of an employee's resume."
 END_STORE
 !
 STORE SEG IN RESUME_HANDLE USING
    SEG.RDB$VALUE =
    "This is the third line of an employee's resume."
 END_STORE
 !
 STORE SEG IN RESUME_HANDLE USING
    SEG.RDB$VALUE =
    "This is the fourth line of an employee's resume."
 END_STORE
 !
 ! Store the segmented string field in the relation.
 !
 STORE R IN RESUMES USING
     R.EMPLOYEE_ID = "00164";
     R.RESUME = RESUME_HANDLE
 END_STORE
 !
 END_SEGMENTED_STRING RESUME_HANDLE
 COMMIT

 This sequence of statements demonstrates the steps required to store
 a segmented string:

  o  CREATE_SEGMENTED_STRING starts a "stream" so that you can store
     the segments into the field.  The segmented string handle gives
     the stream a name.

  o  Each segmented string STORE statement stores a text string in a
     segment.  The context variable SEG relates the values being
     stored to the stream.

  o  The final STORE statement stores the segmented string field into
     the relation, along with the other field, ID_NUMBER.  Note that
     this STORE uses the segmented string handle as the value
     expression in the STORE assignment.

 In most cases, this set of statements would be part of a program that
 reads lines from a text file and stores each line in a segment of the
 segmented string field.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026