DIM GROUP Array does not allow Dot syntax to reference inner GROUP

I am declaring this structure:

QPEX                 QUEUE(pex:Record),PRE(qpex),TYPE.  !Q1
QPER                 QUEUE(per:Record),PRE(qper),TYPE.  !Q2
QPLA                 QUEUE(pla:Record),PRE(qpla),TYPE.  !Q3
QGE2                 QUEUE(ge2:Record),PRE(qge2),TYPE.  !Q4
GEMB0                GROUP,TYPE
REmb                   GROUP(emb:Record). 
RVap                   GROUP(vap:Record).  
Q1                     &QPEX
Q2                     &QPER
Q3                     &QPLA
Q4                     &QGE2
                     END

emba                 GROUP,DIM(8)
Emb                    LONG    
Dat                    &GEMB0  
                     END

but the compiler refuses this (and similar) statement:

 emba[i].Dat.REmb = emb:Record

I can not find the problem. Any ideas ? thanks

The problem is in some lacuna in the type descriptor format which does not allow to get in some contexts the correct type information for elements of the array of a GROUP. This was one of reasons to design another format of the stored type information.

The attached program demonstrates the work around for this problem. The commented line must raise the same compile time errors if to remove the comment sign.
test.clw (539 Bytes)

1 Like

thanks for your answer,
I will put the suggested workaround in my program.
regards, marcelo

Your suggestion worked ok, the program is compiling now.
Juyst as a comment, I got the following error doing the changes:

Internal Compiler Error (06451AF1H : 06454944H)

cw 11.0.0-13244 EE
Perhaps using a newer distribution will help ?? Are there in the new compilers any changes in this area ??
thanks

There were too many changes in the CLW compiler since release 13244, for example, reference variables of procedural type have been introduced. So, I can’t determine where exception occurred.

As a work around, I find that altering the number of characters in a (global) label solves the internal compiler errors that I encounter once a month or so.

FixInternalCompilerError byte,auto
! Change to 
FixInternalCompilerError2 byte, auto

“Internal compiler error” means that some exception occurred during compiler’s work. First reported number is the address of instruction caused exception, second one - the address of the COMPILE function exported from compilers’ DLLs. Reasons for exceptions can be different. It’s need to have a test program allowing to reproduce the exception to cure it.

1 Like

many thanks to all; you have been very useful. I have now the program running ok.

I changed your subject “Question, I can compile this” to one that tries summarize your question “DIM GROUP Array does not allow Dot syntax to reference inner GROUP”. You can edit this.

Your post contents are very nicely done with all the details needed to answer your questions including CODE that hep a lot here. Please take the time to make your Subject line as good. A good Subject attracts people that can answer your question. More important is in the future when searching these posts a good Subject makes it easy to pick the topics in the search results that are most desirable.

Can you post your fixed code?

Based on the @also Test CLW it seems the workaround is to create the same GROUP without the DIM and use a &Reference assignment to the DIM Group like below?

emba_TYPE   GROUP,TYPE
Emb           LONG    
Dat           &GEMB0  
            END
emba        GROUP(emba_TYPE),DIM(8)
            END
emba_REF    &emba_TYPE
    CODE
    emba_REF &= emba[i]   !Reference &= Assign Array [i] to non-array of same GROUP Type
    emba_REF.Dat.REmb = emb:Record   !was: emba[i].Dat.REmb = emb:Record

I pasted most of the @also Test.CLW code below:

Q         QUEUE,TYPE
V           LONG
          END
G         GROUP,TYPE
F           LONG
QRef        &Q
          END

GG        GROUP,TYPE
X           LONG
GRef        &G
          END

AG      GROUP(GG),DIM(4),AUTO.
GGRef   &GG,AUTO

  CODE
! AG[2].GRef.F = 0  !original code that would not compile
  GGRef &= AG[2]	!Reference Assign Arrayed Group to Simple Group
  GGref.Gref.F = 0	!Use Simple Group for dot syntax assigment
  RETURN