Please enable JavaScript to view this site.

This program will allow you to increment up to 99 different counters and reset them on request. Note: PARM3 & PARM4 added in Cobwebb Server versions > 6.2.82.

Parameter

In

Len

Out

Len

PARM1

Blank, *LAST, *END

7

Counter

1-7

PARM2

Instance (01 – 99)

2

-

 

PARM3

Length of Counter ( 1 - 7 default 3)

1

-

 

PARM4

Blank or *KEEP to keep leading zeros

5

-

 

PARM5

-

 

-

 

PARM6

-

 

-

 

Notes:

If you do not specify an Instance in PARM2 then 1 will be assumed except when *END has been specified.

PARM1 = Blank

The Counter for the instance supplied in PARM2 will be incremented by one and returned.

PARM1 = *LAST

The Counter for the instance supplied in PARM2 will be incremented by one, returned and then reset back to zeros.

PARM1 = *END

Regardless of the Instance all counters will be zeroed and the program will end

Using COBCOUNT to generate a Key Field for the Advanced Reformater

If  you have a spooled file that you wish to paginate using the Advanced Reformatting Utility but you don't want to change the original sort order of the documents when the new spooled file is generated, you can use COBCOUNT to generate a unique key for the *KEY call to ADVRFMT when there is a change in your document key e.g. Invoice Number, Order Number etc.

1.In a PAGE = *FIRST Condition you would first add your call to COBCOUNT to generate an incrementing number and copy the returned PARM1 into a Variable (in this case @HDRKEY1) e.g.
Call to COBCOUNT

2.Then, again in the PAGE = *FIRST Condition, you would add your *KEY call to ADVRFMT passing in the stored variable as PARM1 e.g.
*KEY call to ADVRFMT

3.Lastly, inside a PAGE = *END Condition, you need to clear the count and end the COBCOUNT program e.g.
*LAST call to COBCOUNT