On 1 Apr 2008 13:37:53 -0700, in bit.listserv.ibm-main you wrote: >On Tue, 1 Apr 2008 13:57:09 -0500 Don Higgins <[EMAIL PROTECTED]> wrote: > >:>Optimizing COBOL generated assembler > >:>Consider the cobol statements: > >:>000034 02 R-CNTR PIC S99 COMP SYNC VALUE +0. >:>... >:>0000072 ADD 1 to R-CNTR > >:>Which generated the following assembler code: >:> >:> 000620 4830 A012 LH 3,18(0,10) PGMLIT >AT +6 >:> 000624 4A30 9028 AH 3,40(0,9) R-CNTR >:> 000628 1823 LR 2,3 >:> 00062A 8E20 0020 SRDA 2,32(0) >:> 00062E 5D20 C000 D 2,0(0,12) SYSLIT >AT +0 >:> 000632 4020 9028 STH 2,40(0,9) R-CNTR > >:>This snippet of code is from the following COBOL/370 generated assembler >:>LIST option: > >:>http://www.cs.niu.edu/~t90jfl1/class/job2.htm > >:>I think the LR, SRDA, and D instructions could be surpressed by specifying >the >:>option NOTRUNC to allow values greater than the PIC digits 99. > >Yes. > >Also, isn't there now a PIC clause to specify a half-word (so TRUNC would not >be needed)? TRUNC(OPT) would be best. Usage COMP-5 could do the same. There also are new usages in the 2002 COBOL Standard which IBM has not implemented so that various word lengths would be accommodated. These USAGE clauses probably don't require a PICTURE clause for the item. > >:>With the new z10 instruction ADD LOGICAL WITH SIGNED IMMEDIATE, the >:>entire 6 instruction sequence could be reduced to a single instruction: > >:> ALSI R-CNTR,1 > >Which would generate incorrect results, as (1) R-CNTR is signed and (2) it is >a halfword.
---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html