NeuroAgent

How to Identify Bug Icon Errors in Attachmate EXTRA! X-treme

Learn how to identify specific compilation errors indicated by bug icons in Attachmate EXTRA! X-treme's macro editor. Discover systematic debugging techniques and resolve your macro issues quickly.

How to identify the specific error indicated by a bug icon in Attachmate EXTRA! X-treme’s macro editor?

I’m writing a script in Attachmate EXTRA! X-treme using its in-application macro editor (Extra Basic), but I’m encountering a compilation error. When I run the code, I receive the message: ‘This macro cannot run because it failed to compile.’ I’ve noticed a little red bug icon next to a specific line of code, and code without these icons runs successfully.

The issue is that clicking or hovering over the bug icon doesn’t provide additional information about the error, and I can’t locate an error or warnings window. The help button in the Attachmate toolbar doesn’t provide useful documentation.

Here’s an example of the problematic code:

vb
Sub Main
    Dim Sys As Object, Sess As Object
    Dim names As String
    Dim bdays() As String

    ' Initialize session
    
    Set Sys = CreateObject("Extra.System")
    Set Sess = Sys.Sessions.Item(1)
    Sess.Activate

    ' Getting names
    
    names = "Annie Bella Carter"
    names = Split(Trim(name_list), " ") ' 
  
    ReDim bdays(UBound(names)) ' bug icon here

End Sub

How can I determine what specific error is causing the bug icon to appear next to the ReDim bdays(UBound(names)) line?

NeuroAgent

The bug icon in Attachmate EXTRA! X-treme’s macro editor indicates a compilation error that prevents your macro from running. Since hovering over the icon doesn’t provide details, you need to use systematic debugging approaches to identify the specific issue.

Contents

Common Causes of Bug Icons

The red bug icon typically appears for several reasons in EXTRA! X-treme’s macro editor:

Syntax Errors: Missing or incorrect syntax, unmatched parentheses, or invalid function calls
Variable Issues: Undeclared variables, type mismatches, or scope problems
Array Problems: Improper array dimensioning or bounds errors
Function Failures: Built-in functions returning errors or invalid results

In your example code, the issue likely stems from the line names = Split(Trim(name_list), " ") where you’re referencing name_list but the variable was declared as names.


Debugging Techniques for EXTRA! Basic

Since the built-in help system has known issues (as mentioned in the Tek-Tips discussion), you need alternative debugging approaches:

1. Breakpoint Debugging

Set breakpoints by clicking in the margin next to line numbers to step through code execution:

vb
Sub Main
    Dim Sys As Object, Sess As Object
    Dim names As String
    Dim bdays() As String
    
    ' Initialize session
    Set Sys = CreateObject("Extra.System")
    Set Sess = Sys.Sessions.Item(1)
    Sess.Activate
    
    ' Debug: Check if name_list exists
    Debug.Print "Variable before Split: " & name_list
    
    names = Split(Trim(name_list), " ")
    Debug.Print "After Split - Array size: " & UBound(names)
    
    ReDim bdays(UBound(names))
End Sub

2. Immediate Window Testing

Use the Immediate Window (Ctrl+G in some versions) to test individual expressions:

? Trim(name_list)
? Split("Annie Bella Carter", " ")

3. Error Handling with MsgBox

Add diagnostic message boxes to identify where the error occurs:

vb
Sub Main
    On Error GoTo ErrorHandler
    
    Dim Sys As Object, Sess As Object
    Dim names As String
    Dim bdays() As String
    
    ' Initialize session
    Set Sys = CreateObject("Extra.System")
    Set Sess = Sys.Sessions.Item(1)
    Sess.Activate
    
    ' Check variable existence
    If name_list = "" Then
        MsgBox "name_list is empty!", vbExclamation
        Exit Sub
    End If
    
    names = Split(Trim(name_list), " ")
    MsgBox "Split successful. Array size: " & UBound(names)
    
    ReDim bdays(UBound(names))
    Exit Sub
    
ErrorHandler:
    MsgBox "Error " & Err.Number & ": " & Err.Description & vbCrLf & _
           "Occurred at line: " & Erl(), vbCritical
End Sub

Analyzing Your Specific Code Example

Looking at your code, I can identify several specific issues:

Primary Issue: Variable Name Mismatch

vb
names = Split(Trim(name_list), " ")  ' References name_list

The variable names is declared but you’re trying to assign the result of splitting name_list, which is never defined.

Secondary Issues:

  1. Array ReDim without proper initialization: The ReDim statement depends on names being a valid array from the Split operation
  2. Missing error handling: No validation that the Split operation succeeded

Corrected Version:

vb
Sub Main
    Dim Sys As Object, Sess As Object
    Dim name_list As String  ' Correct variable name
    Dim names() As String    ' Should be array type
    Dim bdays() As String
    
    ' Initialize session
    Set Sys = CreateObject("Extra.System")
    Set Sess = Sys.Sessions.Item(1)
    Sess.Activate
    
    ' Correct variable name and assignment
    name_list = "Annie Bella Carter"
    names = Split(Trim(name_list), " ")
    
    ' Now ReDim will work properly
    ReDim bdays(UBound(names))
End Sub

Step-by-Step Error Resolution Process

Follow this systematic approach when encountering bug icons:

  1. Check Variable Declarations

    • Ensure all variables are properly declared
    • Verify variable names match throughout the code
    • Confirm variable types are appropriate
  2. Test Individual Lines

    • Isolate problematic code sections
    • Test expressions in the Immediate Window
    • Use message boxes to display intermediate values
  3. Enable Error Handling

    vb
    On Error Resume Next  ' Temporarily ignore errors
    ' Test problematic line here
    If Err.Number <> 0 Then
        MsgBox "Error: " & Err.Description
        Err.Clear
    End If
    On Error GoTo 0  ' Reset error handling
    
  4. Consult Documentation

  5. Search Known Issues

    • Check forums for similar error patterns
    • Look for version-specific bugs in EXTRA! X-treme

Best Practices for Error Prevention

1. Defensive Programming

vb
Sub SafeMacro()
    On Error GoTo ErrorHandler
    
    ' Validate inputs before processing
    If IsEmpty(name_list) Or name_list = "" Then
        MsgBox "Input data is empty", vbExclamation
        Exit Sub
    End If
    
    ' Process with error checking
    Dim names() As String
    names = Split(Trim(name_list), " ")
    
    ' Check if Split returned valid array
    If IsArray(names) And UBound(names) >= 0 Then
        ReDim bdays(UBound(names))
    Else
        MsgBox "Failed to create name array", vbExclamation
        Exit Sub
    End If
    
    Exit Sub
    
ErrorHandler:
    LogError Err.Number, Err.Description, "SafeMacro"
    MsgBox "Macro failed: " & Err.Description, vbCritical
End Sub

2. Proper Array Handling

As discussed in the MicroFocus community, array dimensioning requires careful attention:

vb
' Safe array initialization
Dim tempArray
tempArray = Split("Annie Bella Carter", " ")

If IsArray(tempArray) Then
    ReDim bdays(UBound(tempArray))
Else
    ' Handle error case
    ReDim bdays(0)  ' Minimum size
End If

3. Version-Specific Considerations

From the support documentation, different versions of EXTRA! X-treme may have different behaviors:

  • Version 8.0 has known help system issues
  • Version 9.0+ includes improved productivity features
  • Always test macros in the target environment

Advanced Debugging Resources

When basic debugging doesn’t reveal the issue, consider these advanced approaches:

1. External Debugging Tools

  • Use Windows Script Host for more detailed error reporting
  • Implement logging to external files
  • Consider using Excel VBA debugging when integrating with Excel (as mentioned in MrExcel discussions)

2. Community Support

  • Tek-Tips Forums: Active community for EXTRA! X-treme issues
  • MicroFocus Community: Official support from the current maintainer
  • Stack Overflow: General programming questions (as seen in this discussion)

3. Documentation References

  • EXTRA! Basic Language Reference: Official syntax and function documentation
  • Migration Guides: For upgrading between versions
  • API Documentation: For object model references

The key to resolving bug icon errors in EXTRA! X-treme is systematic debugging, proper error handling, and leveraging community resources when the built-in tools fall short.

Sources

  1. EXTRA! X-treme 8.0 Macro Editor Help problem - Tek-Tips
  2. Programming in Extra!: using array to collect data from screen and paste to Excel - MicroFocus Community
  3. Controlling Productivity Features in EXTRA! X-treme - MicroFocus Support
  4. Running EXTRA! X-treme from the Command Line - MicroFocus Techdocs
  5. Macro syntax failure in attachmate extra - Stack Overflow

Conclusion

Identifying specific errors indicated by bug icons in Attachmate EXTRA! X-treme requires a systematic debugging approach:

  1. Check basic syntax and variable names first, as simple mismatches are common causes
  2. Use error handling and message boxes to isolate problem areas when hovering doesn’t work
  3. Test expressions individually in the Immediate Window to pinpoint exact failures
  4. Leverage community resources when built-in help fails, as noted in multiple forum discussions
  5. Implement defensive programming with proper validation and error checking

For your specific code example, the issue appears to be a variable name mismatch where name_list should be names. Always validate that array operations succeed before using their results in dimensioning statements. If you continue to experience compilation errors, consider posting your specific code to the Tek-Tips or MicroFocus communities for more targeted assistance.