The volume serial is fairly easy, at least for Assembler programmers. Once the data set is open, locate a control block called the DEB. Use DCBDEBAD to get its address. The DEB is a complicated control area; it has a prefix at a lower storage address than what you get from DCBDEBAD, a basic section, and a device dependent section that starts after the basic section. The first 4 bytes of the device dependent section point to a UCB. The volume serial for tapes and disks is in UCBVOLI.
For disks, before the data set is opened, you can get the volume serial from the JFCB.
The unit is more complicated, and it depends on what you mean by "unit." If you want the binary device address, its in the 2 bytes at UCBCHAN. The old 3 byte UCBNAME field is not reliable any more; don't use it, though it would be preferred for systems before MVS/XA. Getting the device type, like '3390', for example, is quite complicated. It depends on the MVS system you're running, and it has changed quite a bit over the last 40 years. This is beyond the scope of this forum.