Product Documentation

c-treeACE V10.0 Update Guide

Previous Topic

Next Topic

ctSetSequenceAttrs

Declaration

NINT ctSetSequenceAttrs(LONG seqhnd, pctSEQATTR pseqattr);

Description

Sets the attributes for the specified sequence.

  • seqhnd specifies the sequence handle.
  • pseqattr points to a ctSEQATTR structure that contains the modified sequence attribute values.

The following attributes can be changed:

  • seqnam - Changing the sequence name renames the sequence.
  • seqini - If the sequence enforces a limit, the initial sequence value must be less than the sequence limit for an incrementing sequence or must be greater than the sequence limit for a decrementing sequence.
  • seqcur - For an incrementing sequence, the current sequence value must be greater than or equal to the initial sequence value, and if the sequence enforces a limit the current sequence value must be less than or equal to the limit value. For a decrementing sequence, the current sequence value must be less than or equal to the initial sequence value, and if the sequence enforces a limit the current sequence value must be greater than or equal to the sequence limit. If sequnk is set to a non-zero value, the seqcur value is ignored, and the current sequence value is set to the unknown value.
  • seqinc - The sequence increment must be a positive value that is less than the difference between the initial sequence value and the sequence limit.
  • seqlim - The sequence limit must be greater than the initial sequence value for an incrementing sequence or must be less than the initial sequence value for a decrementing sequence. The sequence limit is only enforced if the sequence type specifies the ctSEQLIM bit.
  • seqtyp - The sequence type must be set to either ctSEQINC or ctSEQDEC, and either ctSEQCYC or ctSEQTRM, and optionally includes ctSEQLIM. By changing seqtyp, a sequence can be changed from an incrementing to a decrementing sequence and/or from a cycling to a terminating sequence, and a sequence limit can be enabled or disabled. If changing a sequence from incrementing to decrementing (or vice-versa), the initial and limit values must also be changed (see notes on seqini and seqlim).
  • sequnk - Setting the sequence unknown flag causes the current sequence value to be set to the unknown value

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 c-treeACE 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