Page 1 of 1

structure in a structure... howto?

Posted: Wed Aug 20, 2003 11:01 am
by yves
hello all,

i'd like to use the following structure imbrication:

Structure COUNTRY
name.s
month.s
number_of_users.s
national_cost.f
international_cost.f
roaming_cost.f
subscription_cost.f
other_cost.f
total_cost.f
EndStructure

Structure DATAFILE_STATS
filename.s
filesize.l
number_of_countries.w
Dim COUNTRY_INFO.COUNTRY(20)
EndStructure

then declare a variable as:
Global CURRENT_DATAFILE_STATS.DATAFILE_STATS

the problem is that PB compiler halts on references like:
CURRENT_DATAFILE_STATS\COUNTRY_INFO(6)\name=current_country

with an error:
"'COUNTRY_INFO' offset not found in this structure.


am I doing something wrong, or is this structure imbrication impossible?

thank you for any advice

-y.

Posted: Wed Aug 20, 2003 12:27 pm
by spangly
try this

Code: Select all

Structure COUNTRY 
  name.s 
  month.s 
  number_of_users.s 
  national_cost.f 
  international_cost.f 
  roaming_cost.f 
  subscription_cost.f 
  other_cost.f 
  total_cost.f 
EndStructure 

Structure DATAFILE_STATS 
  filename.s 
  filesize.l 
  number_of_countries.w 
  COUNTRY_INFO.COUNTRY[20]
EndStructure 

Global CURRENT_DATAFILE_STATS.DATAFILE_STATS 

CURRENT_DATAFILE_STATS\COUNTRY_INFO[6]\name="Country"

Posted: Wed Aug 20, 2003 12:38 pm
by yves
thank you spangly, this worked just fine!

++
-y.