C5 QUEUE and GROUP TYPEs

Hi All.

According to the C5 doco I can use a GROUP,TYPE to define the structure of a QUEUE. I can’t seem to get it to work. I’m not sure if the doco is correct or it’s a bug or I’m not understanding correctly. Perhaps someone can shed some light?

In the APP/Global Data I declare a GROUP,TYPE first:

POSTCODEGT      GROUP,TYPE
Suburb            STRING(40)
State_Territory   STRING(3)
Postcode          STRING(4)
                END

and then create a QUEUE,TYPE using the GROUP,TYPE to give it (inherited) structure:

POSTCODEQT QUEUE(POSTCODEGT),TYPE
END

however when I use the QUEUE,TYPE as a parameter/prototype in a procedure, when I call that procedure I get:

Syntax Error: No matching prototype available
Syntax Error: Parameter kind does not match

If I declare the QUEUE,TYPE identically to the GROUP,TYPE no error.

Is it me or C5?

Andrew

Hi Andrew,

You’re using my preferred approach.
But I developed it after I moved on from C5
So I don’t know if it worked in C5, and I no longer have a 32 bit OS to test it …

The following program works in C10,
Can you please test it in C5.

  PROGRAM
       
POSTCODEGT      GROUP,TYPE
Suburb            STRING(40)
State_Territory   STRING(3)
Postcode          STRING(4)
                END

POSTCODEQT QUEUE(POSTCODEGT),TYPE
END

  MAP
   Dump(*PostCodeQt Q)
  END
 
MyQ POSTCODEQT
  CODE
  MyQ.Suburb = 'A'; MyQ.State_Territory = 'FL';  ADD(MyQ)
  MyQ.Suburb = 'B'; MyQ.State_Territory = 'WI';  ADD(MyQ)
                         
  Dump(MyQ)

Dump PROCEDURE(*POSTCODEQT Q) 
Ptr LONG,AUTO
  CODE
  LOOP Ptr = 1 to RECORDS(Q) 
    GET(Q, Ptr)
    MESSAGE('Rec['& Ptr &']|Suburb['& Q.Suburb &']|State_Teritory['& Q.State_Territory &']')
  END

Thanks Mark.

I followed your example and figured out what I did wrong. This is what I was doing wrong (the declaration of the queue):

MyQ QUEUE(POSTCODEQT)
END

which according to the doco is correct.
Thanks for your help again.

FWIW, I re-tested with

MyQ QUEUE(PostCodeQt)
    END   

and it works fine. So that wasn’t the issue.

I also tested with

MyQ QUEUE(POSTCODEQT)
X      LONG
    END

And that works fine too.

Might just be a C5 thing.

the code from Mark compile and run ok in cw5a