Code Snippet #1 - ET

I have also posted this on my web site: http://scctoolkit.atspace.com.

This is a bit of copycode(s) I use all the time because its the sort of thing that one can get wrong on occasions.

Copycode “ET”

0010 *
0020 * Standard ET processing copycode.
0030 * Written by pmacgowan@gmail.com
0040 *
0050 * To use, in the calling program:
0060 * 1. declare a numeric variable #ET (I1)
0070 * 2. include this copycode
0080 * INCLUDE ET ‘100’ /* where &1& = frequency of End Transactions
0090 * 3. The use:
0100 * INCLUDE ETEND /* to perform a final End Transaction
0110 *
0120 ADD 1 TO #ET
0130 IF #ET >= &1& THEN
0140 RESET #ET
0150 END TRANSACTION
0160 END-IF

Copycode “ETEND”

0010 *
0020 * Standard ending ET processing copycode.
0030 * Written by: pmacgowan@gail.com
0040 * Use this copy code with ET, eg
0050 *
0060 * INCLUDE ET ‘100’
0070 * …
0080 *
0090 * INCLUDE ETEND /* to perform a final End Transaction
0100 *
0110 IF #ET > 0 THEN
0120 RESET #ET
0130 END TRANSACTION
0140 END-IF

Copycode “ET-TIME”

0010 *
0020 * Standard ET processing copycode that will also et on a time interval
0030 * Written by pmacgowan@gmail.com
0040 *
0050 * To use, in the calling program:
0060 * 1. Add the following to your DEFINE DATA:
0070 * 1 #ET (I1)
0080 * 1 #ET-TIME (T) INIT
0090 *
0100 * 2. include this copycode (to ET every 20 OR every 90 sec)
0110 * INCLUDE ET-TIME ‘20’ ‘T"00:01:30"’
0120 *
0130 * 3. The use:
0140 * INCLUDE ETEND /* to perform a final End Transaction
0150 *
0160 ADD 1 TO #ET
0170 IF #ET >= &1& OR (*TIMX - #ET-TIME) > &2& THEN
0180 RESET #ET
0190 END TRANSACTION
0200 #ET-TIME := *TIMX
0210 END-IF

So when ever I want an ET every 20 I just code

INCLUDE ET ‘20’

INCLUDE ETEND

How easy is that … :slight_smile: