Check ClearCase Version Version in VBA

One of my Excel VBA scripts loops through all versions of a particular ClearCase item to make sure it has been merged. This fails when a specific version has been removed using rmver (using destructive removals is discouraged, but we rarely do this to break a developer out of a dependency).

On DOS, the following works fine:

IF EXIST M:\View\LAMI\build.xml@@\main\lc_adhoc_dev\3 ECHO Yes
Yes

      

To do this in VBA, I tried to use the Dir method to check for a specific version:

Dim elementVersion As String
elementVersion = "M:\View\LAMI\build.xml@@\main\lc_adhoc_dev\3"

If Len(Dir(elementVersion)) > 0 Then
  ' Version exists
Else
  ' Version does not exist
End If

      

However, this results in a "Bad file name or number" error:

I have also tried the FileExists method of the fso object:

Dim elementVersion As String
elementVersion = "M:\View\LAMI\build.xml@@\main\lc_adhoc_dev\3"
Dim fsoObj As Object
Set fsoObj = CreateObject("Scripting.FileSystemObject")

If fsoObj.FileExists(elementVersion) = True Then
  ' Version exists
Else
  ' Version does not exist
End If

      

However, this call always returns False. It looks like all of these methods have problems with the ClearCase MVFS virtual M: drive. Is there anything else I can try?

+3


source to share


1 answer


I'm trying not to rely on Err

object
, i.e. not using a command cleartool

that fails when it encounters a non-existent version (like get or descr).

This is what you should rely on if you have no constraints (e.g. testing thousands of items per second or other performance bottleneck)



cleartool describe

can be applied to an extended path and will fail if it does not exist.

As Brian Cowen commented , you can check if Excel VBA can call commands from the ClearCase Automation Library ( CAL ) . I've used CAL in VB Script before .

+1


source







All Articles