Table_StartShrink()

Examples


The Table_StartShrink() function creates a temporary data table that can be used to store data from an original table that’s being shrunk.

Syntax

Table_StartShrink(product_ID, table table_name, pathname)

Parameters

product_ID – An integer specifying the product ID of the dictionary containing the table being shrunk.

table table_name – The name of the table being shrunk.

pathname – A string indicating the full generic pathname where the temporary file is to be created. Use an empty string ("") if you’re storing the temporary table in the same folder as the original table.

Return value

An integer describing the result of the temporary table initialization. The result is 0 if the temporary table was created successfully. Any other value indicates an error. The following list shows the errors and their corresponding integer values:

[spacer]

0 – No error

20 – Transaction in progress

1 – Low on memory

21 – Not a variable length table

2 – Database manager not initialized

22 – No table definition could be found

3 – Database manager not supported

23 – Attempted to lock two records

4 – Too many tables opened

24 – No lock on update

5 – Record length too long

25 – Table doesn’t match definition

6 – Too many keys for database type

26 – The disk is full

7 – Too many segments

27 – Unknown error

8 – Table not registered

28 – A non-modifiable key changed

9 – Table not found

29 – Not a variable length field

10 – Locked record

30 – A record was changed with a passive lock

11 – Table name error

31 – Deadlocked

12 – Table not open

32 – Path not found

13 – Table not opened exclusive

33 – Buffer error

14 – Invalid command sent to database manager

34 – Error in creating a P.SQL table

15 – Key number doesn’t exist

35 – Invalid key definition

16 – End of file

36 – Maximum number of SQL connections reached

17 – Duplicate record

37 – Error accessing SQL data

18 – Table is missing

38 – Error converting SQL data

19 – A set is already active

39 – Error generating SQL data


Comments

Shrinking is the process of removing unused space from a data table. The process is called a “shrink” because the table will invariably be smaller after the unused space is removed. The Table_CopyShrinkRecords() function copies the contents of the original table to the temporary table created by Table_StartShrink(). This transfer allows the temporary table to store only records from the original table; excess space in the original table isn’t transferred to the temporary table. After the copy is complete, the Table_EndShrink() function finishes the table shrink.

If no location is specified in the pathname parameter, the shrink table will be created in the same location as the original table. If there’s limited disk space at the location of the original table, use the pathname parameter to select a different location for the temporary table that has adequate space to hold the temporary table.

This function will create a temporary table named SRHNKXXX.DAT, with XXX representing a value from 001 to 999, ensuring a unique temporary table name.


Documentation Feedback