Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

ctGetCurrentSequenceValue

Declaration

NINT ctGetCurrentSequenceValue(LONG seqhnd, pLONG8 pcurval, pNINT punkval);

Description

Reads the current value for the specified sequence. The current value of a sequence can be one of the following:

  • The initial value specified when the sequence was created.
  • The last value set with the ctSetCurrentSequenceValue(), ctGetNextSequenceValue(), or ctSetSequenceAttrs() functions.
  • The unknown value if the sequence has exceeded its minimum or maximum and is not cycling.

Sequence values are stored in the database in which they are defined, and persist between each call to the ctSetCurrentSequenceValue() or ctGetNextSequenceValue() function.

Return Values

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successfully created the sequence.

900

SEQDUP_ERR

A sequence having the specified name already exists.

903

SEQTYP_ERR

The specified sequence type contains an invalid combination of sequence type options.

904

SEQINI_ERR

The initial value specified for the sequence is out of range.

905

SEQCUR_ERR

The current value specified for the sequence is out of range.

906

SEQLIM_ERR

The limit value specified for the sequence is out of range.

907

SEQINC_ERR

The increment value specified for the sequence is out of range.

901

SEQNAM_ERR

An invalid sequence name was specified: the name is NULL, empty, or too long.

See FairCom DB Error Codes for a complete listing of valid error values.

Example

ctSEQATTR seqattr;

NINT rc;

/*

** Create an incrementing sequence that starts with 1, increments by 3, and

** terminates with 100.

*/

strcpy(seqattr.seqnam, "MyFirstSequence");

seqattr.seqini = 1;

seqattr.seqinc = 3;

seqattr.seqlim = 100;

seqattr.seqtyp = ctSEQINC | ctSEQTRM | ctSEQLIM;

if ((rc = ctCreateSequence(&seqattr))) {

printf("Error: Failed to create the sequence: %d\n", rc);

} else {

printf("Successfully created the sequence.\n");

}

See also

ctCreateSequence, ctDeleteSequence, ctOpenSequence, ctCloseSequence, ctGetSequenceAttrs, ctSetSequenceAttrs, ctGetCurrentSequenceValue, ctSetCurrentSequenceValue, ctGetNextSequenceValue

TOCIndex