DataSection and Reading Data items issue
Posted: Thu Jul 26, 2018 2:42 am
I am building more knowledge on PB and am having a lot of fun with it.
I have an issue with using the DataSection. I have this datasection:
I am accessing the data with this procedure:
The Debug results are horrendous and do not represent the the correct values for the Data.d part. The Data.i part works correctly and returns the correct values.
Can somebody advise me what I am doing wrong?
I am using PB5.6 in 64bit on MacOS.
Simon.
I have an issue with using the DataSection. I have this datasection:
Code: Select all
DataSection
NumberLives:
Data.i 100000,99362,99317,99289,99266,99249,99234,99219,99206,99194,99184,99174,99164,99151,99131,99100,99059,99006,98941,98863,98771
Data.i 98663,98542,98410,98272,98131,97989,97844,97698,97547,97393,97235,97072,96906,96736,96562,96383,96198,96006,95809,95603,95389
Data.i 95164,94925,94671,94397,94102,93784,93436,93054,92632,92168,91659,91103,90501,89851,89150,88396,87588,86724,85802,84819,83772
Data.i 82663,81498,80277,78995,77644,76216,74704,73100,71393,69574,67640,65592,63426,61130,58693,56117,53406,50564,47585,44475,41251
Data.i 37939,34566,31158,27748,24374,21079,17915,14934,12186,9714,7549,5706,4193,2996,2083,1410,932,600,376,228
Data.i 124,76,42,22,11,5,2,1,0,0
EndDataSection
DataSection
AgeTo:
Data.d 76.15,75.63,74.67,73.69,72.71,71.72,70.73,69.74,68.75,67.76,66.76,65.77,64.78,63.79,62.80,61.82,60.84,59.88,58.91,57.96
Data.d 57.01,56.08,55.14,54.22,53.29,52.37,51.44,50.52,49.59,48.67,47.75,46.82,45.90,44.98,44.06,43.14,42.22,41.30,40.38,39.46
Data.d 38.54,37.63,36.72,35.81,34.90,34.00,33.11,32.22,31.34,30.46,29.60,28.75,27.90,27.07,26.25,25.43,24.63,23.83,23.05,22.27
Data.d 21.51,20.75,20.00,19.27,18.53,17.81,17.09,16.38,15.68,14.98,14.30,13.63,12.97,12.33,11.70,11.08,10.48,9.89,9.33,8.77
Data.d 8.24,7.72,7.23,6.75,6.30,5.87,5.45,5.06,4.69,4.35,4.03,3.73,3.46,3.21,2.99,2.80,2.63,2.48,2.34,2.22
Data.d 2.11,2.00,1.89,1.79,1.69,1.59,1.50,1.41,1.33,1.25,1.17,1.10,1.03,0.96,0.89,0.83,0.77,0.71,0.66,0.61
EndDataSection
Code: Select all
;- Global Variables
Global NewList AgeFactor.i()
Global NewList AgeExpectation.d()
;- Internal Procedures
Procedure Init()
Shared AgeFactor()
Shared AgeExpectation()
ClearList(AgeFactor())
ClearList(AgeExpectation())
Restore AgeTo
For l = 0 To 10
Read r5.d
AddElement(AgeExpectation())
AgeExpectation() = r5
Next
Restore NumberLives
For l = 0 To 113
Read r4.i
AddElement(AgeFactor())
AgeFactor() = r4
Next
ForEach AgeExpectation()
Debug AgeExpectation()
Next
EndProcedure
Can somebody advise me what I am doing wrong?
I am using PB5.6 in 64bit on MacOS.
Simon.