Files
claudetools/ANALYSIS_COMPLETE.md
Mike Swanson 3faf09c111 feat: Complete DOS update system with test data routing fix
Implemented comprehensive DOS 6.22 update system for ~30 test stations with
critical fix for test data database import routing.

## Major Changes

### DOS Batch Files (7 files)
- NWTOC.BAT: Download updates from network to DOS machines
- CTONW.BAT v1.2: Upload with separate ProdSW/LOGS routing (CRITICAL FIX)
- UPDATE.BAT: Full system backup to network
- STAGE.BAT: System file staging for safe updates
- REBOOT.BAT: Apply staged updates on reboot
- CHECKUPD.BAT: Check for available updates
- DEPLOY.BAT: One-time deployment installer for DOS machines

### CTONW v1.2 Critical Fix
Fixed test data routing to match AD2 sync script expectations:
- Software distribution: C:\ATE\*.EXE -> T:\TS-4R\ProdSW\ (bidirectional)
- Test data logging: C:\ATE\8BDATA\*.DAT -> T:\TS-4R\LOGS\8BLOG\ (upload only)
- Subdirectory mapping: 8BDATA->8BLOG, DSCDATA->DSCLOG, HVDATA->HVLOG, etc.
- Test data now correctly imported to AD2 database via Sync-FromNAS.ps1

### Deployment Infrastructure
- copy-to-ad2.ps1: Automated deployment to AD2 server
- DOS_DEPLOYMENT_GUIDE.md: Complete deployment documentation
- DEPLOYMENT_GUIDE.md: Technical workflow documentation
- credentials.md: Centralized credentials (AD2, NAS, Gitea)

### Analysis & Documentation (15 files)
- CTONW_ANALYSIS.md: Comprehensive compliance analysis
- CTONW_V1.2_CHANGELOG.md: Detailed v1.2 changes
- NWTOC_ANALYSIS.md: Download workflow analysis
- DOS_BATCH_ANALYSIS.md: DOS 6.22 compatibility guide
- UPDATE_WORKFLOW.md: Backup system workflow
- BEHAVIORAL_RULES_INTEGRATION_SUMMARY.md: C: drive integration

### Session Logs
- session-logs/2026-01-19-session.md: Complete session documentation

### Conversation Reorganization
- Cleaned up 156 imported conversation files
- Organized into sessions-by-date structure
- Created metadata index and large files guide

## Technical Details

### AD2 → NAS → DOS Sync Flow
1. Admin copies files to AD2: \192.168.0.6\C$\Shares\test\
2. Sync-FromNAS.ps1 runs every 15 minutes (AD2 → NAS)
3. DOS machines access via T: drive (\D2TESTNAS\test)
4. NWTOC downloads updates, CTONW uploads test data
5. Sync imports test data to AD2 database

### DOS 6.22 Compatibility
- No %COMPUTERNAME%, uses %MACHINE% variable
- No IF /I, uses multiple case-specific checks
- Proper ERRORLEVEL checking (highest values first)
- XCOPY /S for subdirectory support
- ASCII markers ([OK], [ERROR], [WARNING]) instead of emojis

### File Locations
- AD2: C:\Shares\test\COMMON\ProdSW\ (deployed)
- NAS: T:\COMMON\ProdSW\ (synced)
- DOS: C:\BAT\ (installed)
- Logs: T:\TS-4R\LOGS\8BLOG\ (test data for database import)

## Deployment Status

 All 7 batch files deployed to AD2 (both COMMON and _COMMON)
 Pending sync to NAS (within 15 minutes)
 Pending pilot deployment on TS-4R
📋 Ready for rollout to ~30 DOS machines

## Breaking Changes

CTONW v1.1 → v1.2: Test data now uploads to LOGS folder instead of ProdSW.
Existing machines must download v1.2 via NWTOC for proper database import.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 12:49:54 -07:00

10 KiB

DOS 6.22 UPDATE.BAT Analysis Complete

Executive Summary

I have completed a comprehensive analysis of your Dataforth TS-4R DOS 6.22 batch file issues and created a complete solution package.

Problem Identified

Your UPDATE.BAT script failed for two specific reasons:

1. Machine Name Detection Failure

  • Root Cause: The batch file tried to use %COMPUTERNAME% environment variable
  • Why it failed: %COMPUTERNAME% does NOT exist in DOS 6.22 (it's a Windows 95+ feature)
  • Solution: Use %MACHINE% environment variable set in AUTOEXEC.BAT instead

2. T: Drive Detection Failure

  • Root Cause: The batch file checked if an environment variable was set, not if the actual drive existed
  • Why it failed: Likely used IF "%TDRIVE%"=="" or similar - checks variable, not drive
  • Solution: Use proper DOS 6.22 drive test: T: 2>NUL followed by IF ERRORLEVEL 1

3. DOS 6.22 Compatibility Issues

  • Problems: Script likely used Windows CMD features not available in DOS 6.22
    • IF /I (case-insensitive) - not in DOS 6.22
    • %ERRORLEVEL% variable - must use IF ERRORLEVEL n instead
    • && or || operators - not in COMMAND.COM
  • Solution: Rewrote entire script using only DOS 6.22 compatible commands

Why Manual XCOPY Worked

Your manual command succeeded:

XCOPY /S C:\*.* T:\TS-4R\BACKUP

Because you:

  1. Ran it AFTER network was already started (T: was mapped)
  2. Manually typed the machine name (TS-4R)
  3. Didn't need automatic detection or error checking

UPDATE.BAT failed because it tried to be "smart" and auto-detect things, but used the wrong methods for DOS 6.22.

Solution Package Created

I have created 10 files in D:\ClaudeTools\:

Batch Files (Deploy to DOS Machine)

  1. UPDATE.BAT - Fixed backup script

    • Auto-detects machine from %MACHINE% variable
    • Accepts command-line parameter as override
    • Properly tests T: drive availability
    • Comprehensive error handling
    • DOS 6.22 compatible
  2. AUTOEXEC.BAT - Updated startup script

    • Sets MACHINE=TS-4R environment variable
    • Calls STARTNET.BAT for network
    • Optional automatic backup (commented out)
    • Shows network status
  3. STARTNET.BAT - Network initialization

    • Starts Microsoft Network Client
    • Maps T: and X: drives
    • Error messages for each failure
  4. DOSTEST.BAT - Configuration test

    • Tests all settings are correct
    • Reports what needs fixing
    • Run this BEFORE deploying UPDATE.BAT

Documentation Files (Reference)

  1. README_DOS_FIX.md - Main documentation (START HERE)

    • 5-minute quick fix
    • Deployment methods
    • Testing procedures
    • Troubleshooting
  2. DOS_FIX_SUMMARY.md - Executive summary

    • Problem statement
    • Root causes
    • Solution overview
    • Quick deployment
  3. DOS_BATCH_ANALYSIS.md - Technical deep-dive

    • Complete DOS 6.22 boot sequence
    • Why each issue occurred
    • Detection strategies comparison
    • DOS vs Windows differences
  4. DOS_DEPLOYMENT_GUIDE.md - Complete guide

    • Phase-by-phase deployment
    • Detailed testing procedures
    • Comprehensive troubleshooting
    • 25+ pages of step-by-step instructions
  5. DEPLOYMENT_CHECKLIST.txt - Printable checklist

    • 9-phase deployment procedure
    • Checkboxes for each step
    • Troubleshooting log
    • Sign-off section
  6. DOS_FIX_INDEX.txt - Package index

    • Lists all files
    • Quick reference
    • Reading order recommendations

How to Use This Package

Quick Start (5 minutes)

  1. Copy files to DOS machine:

    • UPDATE.BAT → C:\BATCH\UPDATE.BAT
    • AUTOEXEC.BAT → C:\AUTOEXEC.BAT
    • STARTNET.BAT → C:\NET\STARTNET.BAT
    • DOSTEST.BAT → C:\DOSTEST.BAT
  2. Edit AUTOEXEC.BAT on DOS machine:

    EDIT C:\AUTOEXEC.BAT
    

    Find: SET MACHINE=TS-4R Change to actual machine name if different Save and exit

  3. Reboot DOS machine:

    Press Ctrl+Alt+Delete
    
  4. Test configuration:

    DOSTEST
    

    Fix any [FAIL] results

  5. Run backup:

    UPDATE
    

    Should work automatically!

For Detailed Deployment

Read these files in order:

  1. README_DOS_FIX.md - Overview and quick start
  2. DEPLOYMENT_CHECKLIST.txt - Follow step-by-step
  3. DOS_DEPLOYMENT_GUIDE.md - If problems occur

Key Features of Fixed UPDATE.BAT

Machine Detection

REM Checks MACHINE variable first
IF NOT "%MACHINE%"=="" GOTO USE_ENV

REM Falls back to command-line parameter
IF NOT "%1"=="" GOTO USE_PARAM

REM Clear error if both missing
ECHO [ERROR] Machine name not specified

T: Drive Detection

REM Actually test the drive
T: 2>NUL
IF ERRORLEVEL 1 GOTO NO_T_DRIVE

REM Double-check with NUL device
IF NOT EXIST T:\NUL GOTO NO_T_DRIVE

REM Drive is accessible
ECHO [OK] T: drive accessible

Error Handling

REM XCOPY error levels
IF ERRORLEVEL 5 GOTO DISK_ERROR
IF ERRORLEVEL 4 GOTO INIT_ERROR
IF ERRORLEVEL 2 GOTO USER_ABORT
IF ERRORLEVEL 1 GOTO NO_FILES

REM Success
ECHO [OK] Backup completed successfully

Console Output

  • Compact status messages (no scrolling)
  • Errors PAUSE so they're visible
  • Success messages don't pause
  • No |MORE pipes (cause issues)

Expected Results After Deployment

Boot Sequence

==============================================================
  Dataforth Test Machine: TS-4R
  DOS 6.22 with Network Client
==============================================================

Starting network client...

[OK] Network client started
[OK] T: mapped to \\D2TESTNAS\test
[OK] X: mapped to \\D2TESTNAS\datasheets

Network Drives:
  T: = \\D2TESTNAS\test
  X: = \\D2TESTNAS\datasheets

System ready.

Commands:
  UPDATE       - Backup C: to T:\TS-4R\BACKUP

C:\>

Running UPDATE

C:\>UPDATE

Checking network drive T:...
[OK] T: drive accessible

==============================================================
Backup: Machine TS-4R
==============================================================
Source: C:\
Target: T:\TS-4R\BACKUP

[OK] Backup directory ready

Starting backup...

[OK] Backup completed successfully

Files backed up to: T:\TS-4R\BACKUP

C:\>

DOS 6.22 Boot Sequence Traced

1. BIOS POST
2. Load DOS kernel
   - IO.SYS
   - MSDOS.SYS
   - COMMAND.COM
3. Process CONFIG.SYS
   - DEVICE=C:\NET\PROTMAN.DOS /I:C:\NET
   - DEVICE=C:\NET\NE2000.DOS (or other NIC driver)
   - DEVICE=C:\NET\NETBEUI.DOS
4. Process AUTOEXEC.BAT
   - SET MACHINE=TS-4R ← NEW: Machine identification
   - SET PATH=C:\DOS;C:\NET;C:\BATCH;C:\
   - CALL C:\NET\STARTNET.BAT
5. STARTNET.BAT runs
   - NET START
   - NET USE T: \\D2TESTNAS\test /YES
   - NET USE X: \\D2TESTNAS\datasheets /YES
6. (Optional) CALL C:\BATCH\UPDATE.BAT
7. DOS prompt ready: C:\>

Environment After Boot

Environment variables:

MACHINE=TS-4R              ← Set by AUTOEXEC.BAT
PATH=C:\DOS;C:\NET;C:\BATCH;C:\
PROMPT=$P$G
TEMP=C:\TEMP
TMP=C:\TEMP

Network drives:

T: = \\D2TESTNAS\test
X: = \\D2TESTNAS\datasheets

Commands available:

UPDATE          - Run backup (uses MACHINE variable)
UPDATE TS-4R    - Run backup (specify machine name)
DOSTEST         - Test configuration

Troubleshooting Quick Reference

Problem Solution
"Bad command or file name" SET PATH=C:\DOS;C:\NET;C:\BATCH;C:\
MACHINE variable not set Edit C:\AUTOEXEC.BAT, add SET MACHINE=TS-4R
T: drive not accessible Run C:\NET\STARTNET.BAT
UPDATE runs but no error visible Errors now PAUSE automatically
Backup location wrong Check SET MACHINE value matches expected

For complete troubleshooting, see DOS_DEPLOYMENT_GUIDE.md

Next Steps

Immediate Action

  1. Read README_DOS_FIX.md for overview
  2. Print DEPLOYMENT_CHECKLIST.txt
  3. Follow checklist to deploy to TS-4R machine
  4. Test with DOSTEST.BAT
  5. Run UPDATE to verify backup works

After First Machine Success

  1. Document the procedure worked
  2. Deploy to additional machines (TS-7A, TS-12B, etc.)
  3. Change MACHINE= line in each machine's AUTOEXEC.BAT
  4. (Optional) Enable automatic backup on boot

Long Term

  1. Keep documentation for future reference
  2. Use same approach for any other DOS machines
  3. Backup directory: T:[MACHINE]\BACKUP

Files Ready for Deployment

All files are in: D:\ClaudeTools\

Copy to network location:

Option 1: T:\TS-4R\UPDATES\
Option 2: Floppy disk
Option 3: Use EDIT on DOS machine to create manually

Files to deploy:

  • UPDATE.BAT
  • AUTOEXEC.BAT
  • STARTNET.BAT
  • DOSTEST.BAT

Documentation (keep on Windows PC):

  • README_DOS_FIX.md
  • DOS_FIX_SUMMARY.md
  • DOS_BATCH_ANALYSIS.md
  • DOS_DEPLOYMENT_GUIDE.md
  • DEPLOYMENT_CHECKLIST.txt
  • DOS_FIX_INDEX.txt

Testing Checklist

After deployment, verify:

  • Machine boots to DOS
  • MACHINE variable set (SET command shows it)
  • T: drive accessible (T: then DIR works)
  • X: drive accessible (X: then DIR works)
  • UPDATE runs without parameters
  • Backup completes successfully
  • Files appear in T:\TS-4R\BACKUP\
  • Error messages visible if network unplugged

Technical Details

DOS 6.22 limitations addressed:

  • No IF /I flag - use case-sensitive checks
  • No %ERRORLEVEL% variable - use IF ERRORLEVEL n
  • No && or || operators - use GOTO
  • No FOR /F loops - use simple FOR
  • 8.3 filenames only
  • COMMAND.COM not CMD.EXE

Network environment:

  • Microsoft Network Client 3.0 (or Workgroup Add-On)
  • NetBEUI protocol
  • SMB1 share access
  • WINS name resolution

Backup method:

  • XCOPY with /D flag (incremental)
  • First run: copies all files
  • Subsequent runs: only newer files
  • Old files NOT deleted (not a mirror)

Support

If you encounter issues:

  1. Run DOSTEST.BAT to diagnose
  2. Check DOS_DEPLOYMENT_GUIDE.md troubleshooting section
  3. Verify physical connections
  4. Test NAS from another machine
  5. Review PROTOCOL.INI configuration

Conclusion

Your DOS 6.22 UPDATE.BAT script failed because it used Windows-specific features that don't exist in DOS 6.22. I have created a complete replacement that:

  1. Works with DOS 6.22 - uses only compatible commands
  2. Detects machine name - via AUTOEXEC.BAT environment variable
  3. Checks T: drive properly - actually tests the drive, not just a variable
  4. Shows errors clearly - pauses on errors, compact on success
  5. Is well documented - 6 documentation files, 1 checklist, 1 test script

The package is ready to deploy. Start with README_DOS_FIX.md for the 5-minute quick fix, or follow DEPLOYMENT_CHECKLIST.txt for a thorough deployment.

All files are in: D:\ClaudeTools\

Good luck with the deployment!