KPG_ISEQN

Increments a sequence string

Description:

This routine takes an input string comprising two parts: an alphanumeric string ending in an non-numeric character; followed by a sequence number of digits, possibly with leading zeroes. The sequence number is incremented or decremented by a supplied number in a returned string of the same length as the input string. For example, u20100320_0084 would become u20100320_0085 for an increment of 1, and u20100320_0074 for an increment of -10.

An error results if the supplied string is not of the correct form, or the increment takes the sequence counter beyond its range. The sequence number cannot be negative or require additional characters. For example incrementing string DATA999 by one would be rejected as it would require an extra character.

Invocation

CALL KPG_ISEQN( IN, INCREM, OUT, STATUS )

Arguments

IN = CHARACTER ( ) (Given)
String containing a trailing sequence number.
INCREM = INTEGER (Given)
The increment to apply to string IN. It may be positive or negative. A value of 0 causes IN to be merely copied to OUT.
OUT = CHARACTER ( ) (Returned)
The supplied string but with its sequence number incremented by INCREM. It must have at least the length of IN.
STATUS = INTEGER (Given and Returned)
Global status value. An SAI__ERROR is returned, should any of the errors listed above be detected.

Notes:

The sequence number can have up to twelve digits.