Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#338 Empty SUBROUTINE params cause later params to be invalid

Behavioral
open-accepted
nobody
5
2007-10-19
2007-08-14
steve2k
No

With the Modeler that ships with OpenSTA 1.4.3.20, if you pass an empty string, i.e. "" as a parameter to a subroutine, all following parameters are ignored.

There is an example script below.
The first time CHECKRESPONSE is called with all 3 parameters populated, it works fine.

The second time CHECKRESPONSE is called with the first parameter set to "", it ignores all the parameters and uses the parameters passed the first time.

Problem has been confirmed by Bernie Velivis:
"I tried a simple subroutine with 4 string args. As soon as one (counting from left to right) is set to "", then all remaining arguments are set to "" or 0 if numeric. Looks like the code that parses arguments passed to subroutines quits when it see's a null. I would definitely report it on sourceforge."

============ EXAMPLE SCRIPT ==================
!Browser:IE5
!Date : 14/08/2007
Environment
Description ""
Mode HTTP
Wait UNIT MILLISECONDS

Definitions
! Standard Defines
Include "RESPONSE_CODES.INC"
Include "GLOBAL_VARIABLES.INC"

CHARACTER*512 USER_AGENT
Integer USE_PAGE_TIMERS
CHARACTER*256 MESSAGE

CHARACTER*256 p1
CHARACTER*256 p2
CHARACTER*256 p3

Timer T_QQQQ

CONSTANT DEFAULT_HEADERS = ""

Code
!Read in the default browser user agent field
Entry[USER_AGENT,USE_PAGE_TIMERS]

Start Timer T_QQQQ

CALL CHECKRESPONSE["1param1","1param2","1param3"]

CALL CHECKRESPONSE["","2param2","2param3"]

SYNCHRONIZE REQUESTS

End Timer T_QQQQ

SUBROUTINE CHECKRESPONSE[p1,p2,p3]
Log "Parameter 1:", p1
Log "Parameter 2:", p2
Log "Parameter 3:", p3
END SUBROUTINE

Exit

ERR_LABEL:

If (MESSAGE <> "") Then
Report MESSAGE
Endif

Exit

Discussion

  • Bernie Velivis
    Bernie Velivis
    2007-10-15

    Logged In: YES
    user_id=1868094
    Originator: NO

    Work around: If only one of your parameters may be empty, then make it the last in list of parameters. If more then one parameter may be empty, don't use parameters but instead pass the values in local variables.

     
    • summary: empty parameters cause other parameters to become empty --> Empty SUBROUTINparams cause other params to become empty
     
    • summary: Empty SUBROUTINparams cause other params to become empty --> Empty SUBROUTINE params cause later params to be invalid
    • status: open --> open-accepted