I need help to figure out how to ReDim a two-dimensional array. The column size is a fixed number of elements but the number of rows will vary based on the number of records in the input file. In this example, I am reading in an account number, gathering data from the screen, then going to the next account number and continuing until the end of file. The variable procrec% is just the current line number from the input file. Your help is very much appreciated!
Open "C:\test.txt" for Input as 1
Open "C:\audi.txt" for Output as 2
procrec% = 0
Dim tArray()
ReDim tArray(procrec%,4)
GetBal:
filend% = eof(1)
If filend% = -1 then Goto FileEnd:
acctno$ = Input$(12,1)
tArray(procrec%,0) = acctno$
Sess0.Screen.Sendkeys acctno$
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime%)
tArray(procrec%,1) = Trim(Sess0.Screen.GetString(14,3,11))
tArray(procrec%,2) = Trim(Sess0.Screen.GetString(14,6,11))
tArray(procrec%,3) = Trim(Sess0.Screen.GetString(14,9,11))
Print #2, tArray(procrec%,0),";",tArray(procrec%,1),";",tArray(procrec%,2),";",tArray(procrec%,3)
procrec% = procrec% + 1
Sess0.Screen.SendKeys("<PF14>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime%)
GoTo GetBal:
FileEnd:
Print #2, "Input Records: "; procrec%
Close 1, 2
Open "C:\test.txt" for Input as 1
Open "C:\audi.txt" for Output as 2
procrec% = 0
Dim tArray()
ReDim tArray(procrec%,4)
GetBal:
filend% = eof(1)
If filend% = -1 then Goto FileEnd:
acctno$ = Input$(12,1)
tArray(procrec%,0) = acctno$
Sess0.Screen.Sendkeys acctno$
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime%)
tArray(procrec%,1) = Trim(Sess0.Screen.GetString(14,3,11))
tArray(procrec%,2) = Trim(Sess0.Screen.GetString(14,6,11))
tArray(procrec%,3) = Trim(Sess0.Screen.GetString(14,9,11))
Print #2, tArray(procrec%,0),";",tArray(procrec%,1),";",tArray(procrec%,2),";",tArray(procrec%,3)
procrec% = procrec% + 1
Sess0.Screen.SendKeys("<PF14>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime%)
GoTo GetBal:
FileEnd:
Print #2, "Input Records: "; procrec%
Close 1, 2