SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Apr 2003
    Location
    Stamford, CT, US
    Posts
    82
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Runtime Error 9 - Dynamic Multidimensional Array

    The code displayed below receives a comma delimited line from a file and gets some of its values. The purpose is to put these 3 values in a 3 dimensional array.
    '---------------------------------------------
    '$CStrings
    Dim Result As Integer
    Dim strState, strStateTemp As String
    Dim strLine As String
    Dim filePath As String

    '--------- Lower Bound value of Array
    Dim intArrLength, intArrCol As Integer
    intArrLength = 0
    intArrCol = 3

    Dim arEmpData() As String
    '---------- This would be input to this Sub
    strState = "2AR"
    filePath = "c:\\tcl\\sampletest\\EmployeeData.csv"
    '--------------------------------
    open filePath For Input Access Read As #1
    '--------------------------------
    Do While Not Eof(1)
    Line Input #1, strLine
    strLine = Trim(strLine)

    If (strLine <> "\0") And (strLine <> "") Then
    intArrLength = intArrLength + 1
    ReDim Preserve arEmpData(intArrLength, intArrCol)

    strStateTemp = GetField(strLine,9,",")

    If strStateTemp = strState Then

    arEmpData(intArrLength, intArrCol) = GetField(strLine$,5,",")

    End If
    Else
    SQAConsoleWrite "-------------- BLANK LINE - at Line Number - " & CStr(intArrLength+1)
    End If
    Loop
    '---------------------------------------------
    The syntax is fine. But while executing the code it gives 'Runtime Error 9 - ... Subscript Out of Range' error dialog at the following line.

    ReDim Preserve arEmpData(intArrLength, intArrCol)

    What could be the problem?

    [ 08-27-2004, 04:04 AM: Message edited by: NGera ]
    NGera

    If everyone is thinking alike, then somebody isn't thinking.

  2. #2
    Member
    Join Date
    Apr 2003
    Location
    Stamford, CT, US
    Posts
    82
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Runtime Error 9 - Dynamic Multidimensional Array

    Another observation is that it executes ReDim the 1st time but the second time it shows this error.

    I am not sure whether I am using the ReDim statement incorrectly or this is a limitation of SQABasic or to say VB.
    NGera

    If everyone is thinking alike, then somebody isn't thinking.

  3. #3
    Junior Member
    Join Date
    May 2002
    Location
    La Crosse, WI, USA
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Runtime Error 9 - Dynamic Multidimensional Array

    If I remember correctly, they (Rational support) told me that dynamic, multi-dimensional arrays were not allowed/supported.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.11%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:13 AM.

Copyright BetaSoft Inc.