structure in a structure... howto?

Just starting out? Need help? Post your questions and find answers here.
yves
New User
New User
Posts: 2
Joined: Wed Aug 20, 2003 10:54 am

structure in a structure... howto?

Post 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.
spangly
User
User
Posts: 54
Joined: Mon Apr 28, 2003 8:26 pm
Contact:

Post 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"
yves
New User
New User
Posts: 2
Joined: Wed Aug 20, 2003 10:54 am

Post by yves »

thank you spangly, this worked just fine!

++
-y.
Post Reply