2016-21. OS/2 EcomStations may not notice that CD/DVD media has changed until the drive door is closed manually. Common physical utilities like CDRECORD and DVDDAO fail to notify the operating system when they open or close the door programmatically. As a result, following an optical disc change, the operating system may be using the previously cached directory and data. An effective workaround is to have OS/2 check the disc (e.g., taking a dir) immediately after programmatically opening the tray with such utilities.
This issue can be demonstrated with two optical discs, one that contains files, the other ready to write but with no files (e.g. formatted but unwritten DVD+RW, virgin or blanked DVD-RW, or CD-R). For the sake of example, suppose the optical drive is logical 'S:' and physical '0,1,0'.
To repeat, it appears that a workaround is that any time you programmatically eject a disc, you immediately have the operating system attempt to access the drive while the door is still open. Then it realizes there's been a disc change. You can use CHKDSK, DIR, VOL, as well as the Rexx Utility functions SysDriveInfo, SysFileSystemType (not in Classic Rexx), and SysFileTree.
I found it convenient to use this Rexx Script for testing (hardcoded to use my drive S and 0,1,0):
/* @#Walter Gregg of Juneau:2016.2021.12.29#@TestCDRChange */
/*
You must have DVDDAO, available at Hobbes.NMSU.EDU. You must
also set your drive letter and SCSI Device here because I am
ignoring \config.sys variables.
*/
CDR_DRIVE='S:' /* Format 'S:' */
CDR_DEVICE='0,1,0' /* Format '0,1,0' */
'@echo off'
parse source system calltype script
THIS=filespec('name',script)
parse upper arg NOTIFY
select
when NOTIFY='CHKDSK' then nop
when NOTIFY='DIR' then nop
when NOTIFY='VOL' then nop
when NOTIFY='SYSDRIVEINFO' then nop
when NOTIFY='SYSFILESYSTEMTYPE' then nop
when NOTIFY='SYSFILETREE' then nop
when NOTIFY='NONE' then nop
otherwise do
say 'Use' THIS 'to see if OS/2 detects an optical media change.'
say 'You must have DVDDAO (available at Hobbes.NMSU.EDU).'
say 'You need a disc with files and one with none but ready to write.'
say 'Syntax:'
say ' 'THIS
say ' [None] [ChkDsk] [Dir] [Vol] '
say ' [SysDriveInfo] [SysFileSystemType] [SysFileTree]'
say 'where:'
say ' You pick one method to test whether OS/2 sees a disc change.'
exit 0
end
end
Say 'Opening the drive tray...'
'dvddao -L nul -d' CDR_DEVICE '--eject'
say 'Please insert a disc with files and press Enter to close the door.'
'pause >nul'
say 'Closing tray, getting directory...'
'dvddao -L nul -d' CDR_DEVICE
'dir' CDR_DRIVE
say 'Opening tray...'
'dvddao -L nul -d' CDR_DEVICE '--eject'
say 'Please insert a disc with no files and press Enter to close the door.'
'pause >nul'
/* The method we hope helps OS/2 detect changed media */
select
when notify='CHKDSK' then 'CHKDSK' CDR_DRIVE
when notify='DIR' then 'DIR' CDR_DRIVE
when notify='VOL' then 'VOL' CDR_DRIVE
when notify='SYSDRIVEINFO' then do
call RxFuncAdd 'SysDriveInfo','RexxUtil','SysDriveInfo'
toss=SysDriveInfo(CDR_DRIVE) /* xyzzy */
end
when notify='SYSFILESYSTEMTYPE' then do
call RxFuncAdd 'SysFileSystemType','RexxUtil','SysFileSystemType'
toss=SysFileSystemType(CDR_DRIVE) /* xyzzy */
end
when notify='SYSFILETREE' then do
call RxFuncAdd 'SysFileTree','RexxUtil','SysFileTree'
toss=SysFileTree(CDR_DRIVE'\*','entry','bo')
end
when notify='NONE' then nop
otherwise nop
end
say 'Closing tray...'
'dvddao -L nul -d' CDR_DEVICE
say 'Press Enter to verify that the directory of the blank disc is blank.'
say "If you see the last disc's directory, it's a bugaboo."
'pause >nul'
'dir' CDR_DRIVE
exit 0