If you need to make a series of permenant permanent changes to the VB6 source that you get from a client, -- for example, to make it ready for running and testing in a specific environment , -- you can use the gmPF fix gmPL Fix
command. Not to be confused with compile/fix
, the gmBasic fix command gmPL Fix
is a top-level command that does a search and replace on a specific named file. The command may be placed in a custom script file .'
For example: The following script will do a search and replace and write the modified file to disk:
<gmBasic>
...
and added to your Migration Project file (.gmProj
) so that it is handy for applying on new versions of the source as it changes over time.
For example here is a script that changes the database connection information in a file.
Code Block |
---|
SrcName = [VB6_Edit] SrcProj = [C:\gmClients\clientX\proj\usr\VB6_Edit.xml] SrcType = [XML] BldType = [CUSTOM] TScript = [C:\gmClients\clientX\proj\usr\VB6_Edit.xml] <gmBasic> <Storage Action="Create" Identifier="VB6Edit" /> |
...
<Select Progress="1"/> |
...
...
<Fix name="Pre-Edit" fileFilter="C:\gmClients\ |
...
clientX\src\ |
...
clientX\Claims_Administration\SourceCode\frmDBselect.frm"> |
...
<Replace name="frmDBselect.frm"> |
...
<OldBlock><![CDATA[ |
...
mainModule.strprimaryConnection = "Provider=SQLOLEDB;Integrated Security=SSPI;" & |
...
_ "Initial Catalog=" & cboDB.Text & ";Data Source=" & cboServer.Text & ";Network Library=dbnmpntw" |
...
]]></OldBlock> |
...
<NewBlock><![CDATA[ |
...
cboServer.Text = "GMI-CS-02.gmi.local" 'GM fix: modify ConnectionString for GM |
...
Lab mainModule.strprimaryConnection = "Provider=SQLOLEDB;Integrated Security=SSPI;" & |
...
_ "Initial Catalog=" & cboDB.Text & ";Data Source=" & cboServer.Text & ";" 'Network Library=dbnmpntw" |
...
]]></NewBlock> |
...
</Replace> |
...
</Fix> |
...
<Storage Action="Close" /> |
...
</gmBasic>
...
</gmBasic> |
When applied, this script produces the following log:
Basic Processor V20.01(Beta.003) System Build(12/03/13 13:51:18)
REPLACE Line=[7] Lang=[All] Name=[Pre-Edit:frmDBselect.frm] host=[C:\gmClients\clientX\src\clientX\Claims_Administration\SourceCode\frmDBselect.frm] Type=[ReplaceGlobal]
Translation Time (sec) = 0.11