Numeric Variables & Computation Statements
Last update: 18 May 2005
QuestionWhat are people's experiences with regards efficiency when comparing the use of Integer and Packed format variables as counters, indices, or other such fields?
AnswersFrom Jim Wisdom and Dieter Storr
If any 'numeric' fields are on Adabas files that are used for arithmetic reasons, define them as packed for the DDM (easy if you use Predict). This way, you eliminate data conversion by Adabas when it provides the data contents on==in the record buffer. I have too often seen where people define them as D format. Thus means:
ExampleExecuted the following program with 16 format combinations. Each format combination ran 10 times. See the results.
0010 DEFINE DATA LOCAL 0020 1 #SUM (P9) INIT <1> 0030 1 #INCREMENT (P9) INIT <1> 0040 1 #LIMIT (P9) INIT <100000> 0050 * For #SUM and #INCREMENT 0060 * Format combination: P9, N9, I4, F4 0070 END-DEFINE 0080 ST. SETTIME 0090 REPEAT UNTIL #SUM > #LIMIT 0100 ADD #INCREMENT TO #SUM 0110 END-REPEAT 0120 DISPLAY *TIMD(ST.) 0130 END