NEXTNUMBER

This activity generates the next number in a series that is identified by the two "key" values that can be specified in the input parameters. It may be suitable in some applications for generating sequential batch numbers or similar for processed data.

The series from which the number is generated is determined by the two number "keys" specified in the parameters. You can use the keys to generate a sequence number identified appropriately for your purpose or application. For example, you might specify "ORDER_IN" as the first key and "BATCHNUMBER" as the second key. The first time the activity runs (in any processing sequence) with these keys, the number 1 (one) is returned. Each subsequent invocation with these keys (in any processing sequence) returns the next number in the ORDER_IN/BATCHNUMBER series.

The numbers generated have a maximum precision of 30, 0. When the number reaches its maximum capacity it will roll-over to zero. The numbers and the keys are held in a Composer database file.

For any number series identified by the two key values, you can conditionally or unconditionally trigger the numbering to restart at 1 (one) using the RESTART and RESTARTVALUE parameters.

Note that triggering a series to restart numbering will affect all processing sequence runs that use the same number series, including any that may be concurrently active.  You should fully consider the implications of this in your solution design.

This activity may not meet the standards for data integrity and security required for some applications. You should consider the requirements of your application carefully before using this activity.

INPUT Parameters:

NUMBERKEY1: Optional

This is the first of two optional "keys" that are used to uniquely identify the series from which the next sequential number will be generated. If this parameter is not specified, the activity will use the internal identifier of the containing processing sequence (a unique 32 character string). This results in a series of numbers unique to that processing sequence. But two instances of the activity in the same processing sequence would generate numbers from the same series (unless you specify a value for the NUMBERKEY2 parameter).

The NUMBERKEY1 value, if specified, should be 32 characters or less.

NUMBERKEY2: Optional

This is the second of two optional "keys" that are used to uniquely identify the series from which the next sequential number will be generated. This parameter has no default - if not specified, a blank key value will be used.

The NUMBERKEY2 value, if specified, should be 32 characters or less.

RESTART: Optional

This parameter may be used to conditionally or unconditionally trigger the number series to restart at 1 (one).  You may specify one of the following values:

*NO: (the default value) does not restart numbering.  (The value of the RESTARTVALUE parameter is not used and is not stored.)

*YES: causes numbering to restart unconditionally (of course, your Processing Sequence may condition the use of this parameter value!).  The value of the RESTARTVALUE parameter will be stored as a trigger "value" for use if future instances of the NEXTNUMBER activity for the same series specifies *VALUE for the RESTART parameter.

*VALUE: compares the value specified in the RESTARTVALUE parameter with one that was previously stored from the a prior instance of the NEXTNUMBER activity.  If they are different, then the numbering will restart at 1 (one).  If they are the same, numbering will not be restarted.

RESTARTVALUE: Optional

This optional parameter is used mainly if *VALUE is specified for the RESTART parameter.  It provides the application value that will be compared with a previous stored value to determine whether numbering will restart at 1 (one).  If they are different, then numbering will restart at 1 (one) and the value provided will be stored for future comparisons.

If *YES is specified for the RESTART parameter, the value of the RESTARTVALUE parameter does not affect renumbering – numbering WILL restart unconditionally.  However, the value of the RESTARTVALUE parameter will be stored for possible future comparison if future instances of the NEXTNUMBER activity for the same series specify *VALUE for the RESTART parameter.

Note that if you wish to restart numbering on a time basis, you may use built-in variables such as *NOW_LOCAL_DATE, *NOW_LOCAL_YYYY, *NOW_LOCAL_YYYYMM, *NOW_LOCAL_MM, *NOW_LOCAL_WEEK and *NOW_LOCAL_DOW as the value of the RESTARTVALUE parameter.

The value used and stored is a maximum of 256 characters long.

OUTPUT Parameters:

NUMBEROUT:

Upon completion, this parameter contains the next sequential number in the series identified by the specified (or assumed) "keys".