Skip to content

Commit 89972e8

Browse files
authored
Apply suggestions from code review
1 parent 873bcd9 commit 89972e8

1 file changed

Lines changed: 29 additions & 30 deletions

File tree

docs/ssma/db2/executing-the-ssma-console-db2tosql.md

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -637,23 +637,19 @@ Or
637637
sql-files="<folder-name>\*.sql" />
638638
```
639639

640-
## Executing SSMA Console in parallel
640+
## Execute SSMA console in parallel
641641

642-
The SSMA Console utility can be executed in parallel through scripting by specifying the database name and corresponding folder path as input parameters. In the example provided below, the databases SAMPLE1, SAMPLE2, and SAMPLE3 with their respective folder paths are supplied as input to the script.
643-
644-
**Input to the script:**
642+
The SSMA console utility can be executed in parallel through scripting, by specifying the database name and corresponding folder path as input parameters. In the following example, the databases `SAMPLE1`, `SAMPLE2`, and `SAMPLE3`, with their respective folder paths, are supplied as input to the script.
645643

646644
```txt
647645
SAMPLE1,C:\folder path\SSMA Project1
648646
SAMPLE2,C:\folder path\SSMA Project2
649647
SAMPLE3,C:\folder path\SSMA Project3
650648
```
651649

652-
The following sample PowerShell script enables parallel execution of the SSMA Console command.
653-
654-
**Sample script:**
650+
The following sample PowerShell script enables parallel execution of the SSMA console.
655651

656-
```script
652+
```powershell
657653
$baseFolder = "C:\folder path\folder1"
658654
$ssmaExe = "C:\folder path\SSMAforDb2Console.exe"
659655
$databaselistPath = Join-Path $baseFolder "Databaselist.txt"
@@ -672,14 +668,15 @@ $preparedEntries = foreach ($entry in $entries) {
672668
$dbNameCounts[$dbName]++
673669
$suffix = "_{0:D2}" -f $dbNameCounts[$dbName]
674670
$fileDbName = "$dbName$suffix"
675-
} else {
671+
}
672+
else {
676673
$dbNameCounts[$dbName] = 0
677674
$fileDbName = $dbName
678675
}
679676
[PSCustomObject]@{
680-
DbName = $dbName
677+
DbName = $dbName
681678
WorkingFolder = $workingFolder
682-
FileDbName = $fileDbName
679+
FileDbName = $fileDbName
683680
}
684681
}
685682
@@ -695,33 +692,35 @@ $preparedEntries | ForEach-Object -Parallel {
695692
$conversionXmlPath = Join-Path $using:baseFolder "ConversionAndDataMigrationSample_$fileDbName.xml"
696693
$convTree.Save($conversionXmlPath)
697694
698-
# Update VariableValueFileSample.xml
699-
$varTree = [xml](Get-Content $using:variableXmlTemplate)
700-
$nodes = $varTree.SelectNodes('//variable[@name="$WorkingFolder$"]')
701-
if ($nodes.Count -eq 0) {
702-
Write-Host "No variable node found for `$WorkingFolder$"
703-
} else {
704-
$nodes | ForEach-Object { $_.value = $workingFolder }
705-
}
706-
$nodes2 = $varTree.SelectNodes('//variable[@name="$Db2InitialCatalog$"]')
707-
if ($nodes2.Count -eq 0) {
708-
Write-Host "No variable node found for `$Db2InitialCatalog$"
709-
} else {
710-
$nodes2 | ForEach-Object { $_.value = $dbName }
711-
}
712-
$variableXmlPath = Join-Path $using:baseFolder "VariableValueFileSample_$fileDbName.xml"
713-
$varTree.Save($variableXmlPath)
695+
# Update VariableValueFileSample.xml
696+
$varTree = [xml](Get-Content $using:variableXmlTemplate)
697+
$nodes = $varTree.SelectNodes('//variable[@name="$WorkingFolder$"]')
698+
if ($nodes.Count -eq 0) {
699+
Write-Host "No variable node found for `$WorkingFolder$"
700+
}
701+
else {
702+
$nodes | ForEach-Object { $_.value = $workingFolder }
703+
}
704+
$nodes2 = $varTree.SelectNodes('//variable[@name="$Db2InitialCatalog$"]')
705+
if ($nodes2.Count -eq 0) {
706+
Write-Host "No variable node found for `$Db2InitialCatalog$"
707+
}
708+
else {
709+
$nodes2 | ForEach-Object { $_.value = $dbName }
710+
}
711+
$variableXmlPath = Join-Path $using:baseFolder "VariableValueFileSample_$fileDbName.xml"
712+
$varTree.Save($variableXmlPath)
714713
715714
# Prepare output/error file paths
716715
$outputFile = Join-Path $using:baseFolder "ssma_output_$fileDbName.txt"
717716
$errorFile = Join-Path $using:baseFolder "ssma_error_$fileDbName.txt"
718717
719718
# Prepare argument list
720-
$args = "-s `"$conversionXmlPath`" -v `"$variableXmlPath`""
719+
$arguments = "-s `"$conversionXmlPath`" -v `"$variableXmlPath`""
721720
722721
# Run SSMA console
723-
Start-Process -FilePath $using:ssmaExe -ArgumentList $args -RedirectStandardOutput $outputFile -RedirectStandardError $errorFile -Wait
724-
Write-Host "Executed command: `"$using:ssmaExe`" $args"
722+
Start-Process -FilePath $using:ssmaExe -ArgumentList $arguments -RedirectStandardOutput $outputFile -RedirectStandardError $errorFile -Wait
723+
Write-Host "Executed command: `"$using:ssmaExe`" $arguments"
725724
}
726725
```
727726

0 commit comments

Comments
 (0)