Need Help on File processing

I have a shell script, which calls number of other shell scripts and some of these shell scripts will call some other shell scripts.

The same is as follows

I need the output as mentioned below

What/Where is the input file ?

User has be pass mainksh.ksh as parameter and $RUN_DIR will be initialized with /usr/local/ramesh/run/ and $SUB_DIR with /usr/local/ramesh/run/cfg in env setting file