The S command allows a table to be searched for a row matching on the key.
The I command will cause the row in ROW-WA to be inserted into the table.
An insert into a sequential, hash, or user-controlled sequence table requires SUBSCRIPT to be set by the programmer or by a preceding search. A row inserted into a random table is added to the end of the table, so SUBSCRIPT is ignored. After an insert, check to determine if the insert was successful by checking OVERFLOW-CODE. If the code is set to Y, the insert was not successful because the table was full. A successful insert will cause NO-OF-ROWS to be incremented.
The D command will delete the row pointed to by SUBSCRIPT. SUBSCRIPT must be set by the programmer or by a preceding search.
A delete from a random table is performed by moving the last row in the table to the row pointed to by SUBSCRIPT. A successful delete will reduce NO-OF-ROWS by one.
The U command comprises a search and an insert. After an update, you must perform two tests:
- Determine whether or not the row was found;
- If the row was not found, determine whether the attempt to insert failed due to an overflow in the size of the table.
If the row was neither found nor forced an overflow, assume that the row has been inserted at the location specified by the value of SUBSCRIPT.
The R command is a combination of search and delete. The remove was successful if the FOUND-CODE is set to Y. If that code is set to N, the row was not found and could not be deleted.
The P command will cause the row in ROW-WA to be copied to the entry pointed to by SUBSCRIPT. SUBSCRIPT must be set by the programmer or by a preceding search. A successful Put will set the FOUND-CODE to Y. An unsuccessful Put could be caused by trying to replace an empty location in a hash table.
The T command will cause the row pointed to by SUBSCRIPT to be copied to ROW-WA. SUBSCRIPT must be set by the programmer or by a preceding search. If the subscript is zero, low-values will be returned and the FOUND-CODE set to N. Otherwise, the FOUND-CODE will be set to Y.
The F command is a combination of search and take. The FOUND-CODE will be set to Y if the Fetch was successful and to N if the row could not be found.
The A command will physically sort a table into ascending or descending sequence. Specify organization = S for ascending sequence and organization = D for descending sequence. A hash organized table must be compressed by means of a COMPRESS command before it can be sorted.
The C command will compress a hash table. After a compression, all empty slots are located at the end of the table. For subsequent use of this table (without sorting), the organization should be set to R and the search method to S.