If you still have the system based on that CD up and running, the productkey and productid are in the registry, totally free for you to read.

Use regedit to find it and write it down. In the left pane browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
then look for ProductKey and ProductID in the right pane.
As simple as that.

If for some reasons, you only have DOS do a find in c:\windows\system.dat or c:\system.1st

It would be illegal - although possible - to use the results of these steps from another Windows 98 machine, if that has a non-OEM version of Windows 98.

Hope this helps.