Find parent process (not process ID)

Hi:

I have a program written in FORTRAN running on AIX platform.
It is because missing of documentation and without root password, therefore we want to modify the program so that we can find out which script/program that call this FORTRAN program.

I have google for few days, all of them are get parent process id, in this case it is not useful to us.

After you have extracted the PPID, use below command to know the corresponding process.

ppid=<your_ppid>
ps -ef | awk -v ppid=$ppid '($2==ppid) {print}'

Call the following shell wrapper that prints the calling process then executes the final program

#!/bin/ksh -p
ps -fp $ppid
exec /path/to/fortranprogram "$@"

Of course can be redirected to a logfile

ps -fp $ppid >> logfile

It is because there are many scripts call the fortran program, so we cannot do so.
By the way, some scripts are not starts with:
#!/bin/ksh

It make krishmaths's solution return "sh" only.