> -----Original Message-----
> From: IBM Mainframe Discussion List 
> [mailto:ibm-m...@bama.ua.edu] On Behalf Of Joe Reichman
> Sent: Friday, April 16, 2010 10:29 AM
> To: IBM-MAIN@bama.ua.edu
> Subject: Arithmetic on COBOL usage is pointer
> 
> I redefined a usage pointer to PIC 9(8) comp to do arithmetic 
> and got  
> weird
>   results
> Are there any rules for doing math on
> Usage is pointer
> 
> Sent from my iPhone

I use the SET ws-pointer TO ADDRESS OF ... . Something like the following could 
be done:

WORKING-STORAGE SECTION.
77 WS-POINTER POINTER.

...

LINKAGE SECTION.

77 LS-BIG  PIC X OCCURS 1024 TIMES.

...

PROCEDURE DIVISION.

SET WS-POINTER TO ADDRESS OF some-var.
SET ADDRESS OF LS-BIG TO WS-POINTER.
SET ADDRESS OF WS-POINTER TO LS-BIG(5).

The above is equivalent to adding 4 to the current value of WS-POINTER. That's 
because COBOL arrays are 1-origin. 

--
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

Reply via email to