It doesn't even have to be as large as a mainframe application.
For my senior thesis for my Bachelor's degree, I took on the task of taking on an old DOS flat file "database" system and creating a modern equivalent. I did the same as a sibling post, asking how they use it, what could be what, etc., and then I started to make the program. As I did so, I started looking at the data it held for myself--the format (which I forget at the moment, but I think it was something from IBM) could designate "columns" with data types, and then completely disregard those data types. So you would have a field like "weight", and then the data could be "X1444RTTJU8" because when they had a an entry related to a problem, they would use that field for notes. And the program had no problem with this, even searched on that.
I only had a short time to work on this, and I got in way over my head. In the end, I had to leave the company before I could complete the project. No one there was disappointed, though, as the only reason they seemed interested in replacing it was due to a corporate mandate about replacing technology no longer supported after X years, and I made the fifth or sixth person to attempt and fail (all of us being interns or otherwise low-level devs) on this very task.
What I took away from the whole project (and what I wrote as the final portion of my thesis) was that I approached it from a completely wrong angle: I was trying to copy the program, when instead I should have been focusing on the task and goals and working from there.[1] Not that you can't miss edge cases in this scenario, but you will be better able to handle them because you won't be trying as stringently to maintain an outdated input system.
[1] Although I likely wouldn't have gotten too far with this, either, as those who actually used it seemed unwilling to help me; they were all folks that seemed very set in their ways, resistant to any change, and I got the feeling that they saw a replacement as a threat to their jobs. In addition, all of them were trained to use a set of instructions that was "Press X, now press T", etc., and not actually describing what they were doing, but just how to do it. If the program suddenly disappeared, I suspect they would have no idea how to do half their jobs.