Author: sergeyken
Posted: Tue Oct 18, 2016 6:57 pm (GMT 5.5)
The physical address of destination field for MOVE statement is calculated as:
(destination) = (array_start_address) + (element_size_in_bytes) * (index_value - lowest_index)
If index_value is outside of the range lowest_index...highest_index, then calculated physical address is outside of the memory chunk allocated for the whole array. Two results are possible (randomly):
1) This memory outside of this range may be still available to your program, but very likely you will accidentally override unexpected value(s) of other variables/fields/records/whatever.
2) This memory outside of the array is not allocated to your program, and that's why it is protected by memory access key. This situation for sure is causing "Protection exception" (e.g. ABEND S0C4/S0C5, etc.)
content of the merged post follows
It depends on the particular compiler how to handle the order of operations in the single MOVE
The A can be initialized to 0 either before, or after calculating the destination D(A), etc. There is a good chance that uninitialized (garbage) value of A is used to point to D(A)
Try to separate it, and verify the difference:
edited to consolidate two contiguous posts
_________________
Tyrannosaurus-REXX
Posted: Tue Oct 18, 2016 6:57 pm (GMT 5.5)
The physical address of destination field for MOVE statement is calculated as:
(destination) = (array_start_address) + (element_size_in_bytes) * (index_value - lowest_index)
If index_value is outside of the range lowest_index...highest_index, then calculated physical address is outside of the memory chunk allocated for the whole array. Two results are possible (randomly):
1) This memory outside of this range may be still available to your program, but very likely you will accidentally override unexpected value(s) of other variables/fields/records/whatever.
2) This memory outside of the array is not allocated to your program, and that's why it is protected by memory access key. This situation for sure is causing "Protection exception" (e.g. ABEND S0C4/S0C5, etc.)
content of the merged post follows
It depends on the particular compiler how to handle the order of operations in the single MOVE
Code: |
Move 0 To A D(A) |
The A can be initialized to 0 either before, or after calculating the destination D(A), etc. There is a good chance that uninitialized (garbage) value of A is used to point to D(A)
Try to separate it, and verify the difference:
Code: |
Move 0 To A Move 0 to D(A) |
edited to consolidate two contiguous posts
_________________
Tyrannosaurus-REXX