It's because the underlaying function first free's off the memory of X(100) before storing the value of A into it. Problem is, the contents for A actually reside in the just free'd up memory location for X(100),
hence you are trying to store something that was previously defined in that location BACK into the same location. No can do.


Glenn

At 01:36 PM 02/17/2004, you wrote:
I'm on UV 10 and got the same results.

George

>-----Original Message-----
>From: Mike Rajkowski [ mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ]
>Sent: Tuesday, February 17, 2004 12:17 PM
>To: U2 Users Discussion List
>Subject: Need/Want/Would like to know
>
>
>Someone came to me with the following code sample, and asked
>why this would happen, while I have some thoughts, I would
>like a more definitive answer (note no matter what the answer,
>I believe the solution is don't do that....)
>
>Thanks,
>Mike
>
>On Universe 9.5:
>
>04 ED BP P1 P2
>
>SELECTed record name = "P1".
>6 lines long.
>
>----: P
>0001: *
>0002: DIM X(100)
>0003: MAT X = ""
>0004: X(100) = 1
>0005: CALL P2(X(100), MAT X)
>0006: END
>Bottom at line 6.
>----: EX
>
>SELECTed record name = "P2".
>13 lines long.
>
>----: P
>0001: SUBROUTINE P2(A, MAT X)
>0002: DIM X(100)
>0003: CRT 'A = ':A
>0004: CRT 'X(100) = ':X(100)
>0005: *
>0006: CRT ; CRT "SETTING X(100) = A"
>0007: X(100) = A
>0008: CRT ; CRT "NOW RE-CHECKING THE VALUES"
>0009: *
>0010: CRT 'A = ':A
>0011: CRT 'X(100) = ':X(100)
>0012: RETURN
>0013: END
>Bottom at line 13.
>----: EX
>
>File name        = BP
>Record name =
>>RUN BP P1
>A = 1
>X(100) = 1
>
>SETTING X(100) = A
>
>NOW RE-CHECKING THE VALUES
>A = Program "P2": Line 10, Variable "A" previously undefined.
>Empty string used
>.
>
>X(100) = Program "P2": Line 11, Variable "$R0" previously
>undefined.  Empty stri
>ng used.
>
>--
>u2-users mailing list
>[EMAIL PROTECTED]
> http://www.oliver.com/mailman/listinfo/u2-users
<http://www.oliver.com/mailman/listinfo/u2-users>
>

--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users

-- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users

Reply via email to