> -----Original Message----- > From: IBM Mainframe Discussion List > [mailto:ibm-m...@bama.ua.edu] On Behalf Of David Andrews > Sent: Monday, April 19, 2010 8:30 AM > To: IBM-MAIN@bama.ua.edu > Subject: Re: Arithmetic on COBOL usage is pointer > > On Mon, 2010-04-19 at 09:06 -0400, McKown, John wrote: > > MOVE LARGEST-INPUT-RECORD (UNSTRING-OFFSET: > > LENGTH OF SMF30ID) > > TO SMF30ID > > I dig now; you're moving the segments to a separate segment-defining > record in order to gain field addressability. Using pointers (and > redefines) I'd address that ID segment directly: > > 01 SMF30-ADDRVAL COMP PIC 9(8). > 01 SMF30-ADDRPTR REDEFINES SMF30-ADDRVAL POINTER. > 01 SMF30-ID-ADDRVAL COMP PIC 9(8). > 01 SMF30-ID-ADDRPTR REDEFINES SMF30-ID-ADDRVAL POINTER. > > IF (SMF30ION = 1) > COMPUTE SMF30-ID-ADDRVAL = > SMF30-ADDRVAL + SMF30IOF - 4. > SET ADDRESS OF SMFREC-30-IDENTIFICATION TO > SMF30-ID-ADDRPTR. > > I kinda like my way better, but as others have pointed out it > isn't all > that future-proof. Guess I should fix that if I ever have to > crack that > code open again. > > -- > David Andrews
That is a good way too. And more efficient due to not moving data around. I don't consider using SET WS-POINTER TO ADDRESS OF WS-VAR and SET ADDRESS OF LS-VAR TO WS-POINTER to be doing arithmetic on a pointer. Arithmetic on a pointer is defining a USAGE BINARY variable on top of a POINTER, then using the ADD and SUBTRACT verbs to manipulate it. That is no longer necessary. -- John McKown Systems Engineer IV IT Administrative Services Group HealthMarkets(r) 9151 Boulevard 26 * N. Richland Hills * TX 76010 (817) 255-3225 phone * (817)-961-6183 cell john.mck...@healthmarkets.com * www.HealthMarkets.com Confidentiality Notice: This e-mail message may contain confidential or proprietary information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. HealthMarkets(r) is the brand name for products underwritten and issued by the insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance Company(r), Mid-West National Life Insurance Company of TennesseeSM and The MEGA Life and Health Insurance Company.SM ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html