Visible to Intel only — GUID: GUID-3B9FD79E-6FDA-4281-8F68-A1457DDA20B4
Visible to Intel only — GUID: GUID-3B9FD79E-6FDA-4281-8F68-A1457DDA20B4
Make Substrings Equivalent
When you make one character substring equivalent to another character substring, the EQUIVALENCE statement also sets associations between the other corresponding characters in the character entities; for example:
CHARACTER NAME*16, ID*9 EQUIVALENCE(NAME(10:13), ID(2:5))
These statements cause character variables NAME and ID to share space (see the following figure). The arrays can also be aligned by the following statement:
EQUIVALENCE(NAME(9:9), ID(1:1))
![](/content/dam/docs/us/en/developer-guide-reference/2023-1/ACD0418D-158E-4CD4-BEB5-3C8F4DC22635-low.gif)
If the character substring references are array elements, the EQUIVALENCE statement sets associations between the other corresponding characters in the complete arrays.
Character elements of arrays can overlap at any character position. For example, the following statements cause character arrays FIELDS and STAR to share storage (see the following figure).
CHARACTER FIELDS(100)*4, STAR(5)*5 EQUIVALENCE(FIELDS(1)(2:4), STAR(2)(3:5))
![](/content/dam/docs/us/en/developer-guide-reference/2023-1/4B921E54-2DFE-4BD9-9402-0BCC9ED6B9AD-low.jpg)
The EQUIVALENCE statement cannot assign the same storage location to two or more substrings that start at different character positions in the same character variable or character array. The EQUIVALENCE statement also cannot assign memory locations in a way that is inconsistent with the normal linear storage of character variables and arrays.