On Wed, 15 Oct 2014 08:46:51 -0500, Ron Thomas <[email protected]> wrote:
>Hi . > >In our cobol programs we have the variables declared as s9(09) COMP, now one >of the experts in our area is proposing to use s9(08) COMP as this would give >better performace . Could some one please let us know whether the change is >going to provide good performance ? > >Thanks in Advance > >Regards >Ron T Pic S9(09) Comp and Pic S9(08) Comp are the exact same size in a COBOL program, (1 fullword, 4 bytes). So there should be no difference in performance in changing the number of digits. From the COBOL Language Reference: Digits in PICTURE clause Storage occupied 1 through 4 2 bytes (halfword) 5 through 9 4 bytes (fullword) 10 through 18 8 bytes (doubleword) I can't speak to COBOL 5.1 since we don't have it yet, but in releases of COBOL prior to 5.1, there may be a performance penalty for Comp items that are larger than 9 digits, (subroutines may be used instead of native code). There is no real performance difference between a 2 byte and a 4 byte Comp field, (one will use Halfword binary instructions and the other will use Fullword binary instructions). Of more importance to the performance of Comp fields is the TRUNC COBOL Compiler option. OS/VS COBOL had only TRUNC or NOTRUNC and generated pretty efficient code for both options. COBOL II, (for some reason), felt the need to change this so you had 3 options, of which none of them generate code as good as OS/VS COBOL. Of the three TRUNC options available, TRUNC(OPT) is the best choice. If you need the equivalent of TRUNC(BIN) for one or more Comp fields, then define them as Comp-5 instead of Comp. -- Dale R. Smith ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
