Proper Use of WAIT Command Within .ksh

I am trying to write a korn shell script (Z.ksh) that will execute three other korn shell scripts within it. The three korn shell scripts (A.ksh,B.ksh,C.ksh) each execute a series of .sas programs. A.ksh, B.ksh, and C.ksh must each wait until the last .sas program within them executes and finishes before the shell script itself finishes. Once C.ksh executes all it's .sas programs and they finish, Z.ksh can finish.

I have provided pseudo code for Z.ksh below, but also could use some advice about how to code A.ksh, B.ksh. and C.ksh.

I look forward to your responses.

Thanks.

#!/usr/bin/ksh
cd /some/directory/containing/korn/shells/on/Linux
ksh A.ksh
wait
ksh B.ksh
wait
ksh C.ksh
wait

Welcome to the forum.

wait waits for a shell's background processes ("jobs") to finish. None of your scripts is executed in background - unless we're talking of some code part within either, for which it would make more sense to wait within.
When executed in "normal" foreground mode, each script WILL execute the .sas commands in sequence AND exit only when all are finished.

An example of how you'd use wait:

sleep 5 &
echo "Sleep is running in background"
wait
echo "Sleep has quit"

The ampersand causes sleep to run in the background, allowing the shell to continue and print the next statement. Then wait prevents the shell from continuing until sleep has finished.