Add outputdataset API; fix issue #4043