I am getting an error "job_procfile not found" while excecuting a .ksh script. The script is used to create control-m ( scheduler ) jobs dynamically by reading parameter files ( flat filescomma seperated )
job_procfile is a function within the .ksh script
The script is something like this ... script start *****
job_procfile
{
set string to call control-m job creation ( ctmcreate )
eval(string)
}
for loop based on multiple processes defined fo a stream
do
call job_procfile -----> (B)
done
}
loadstream
{
if some value
then
call job_procfile -----> (A)
else
call job_start
if value is multiprocess
then
call job_multiprocess
else
call job_procfile
fi
call job_success
fi
}
# main
read files in awk ( do search to get values )
call loadstream ( to load control-m streams )
script end *****
When job_procfile is called at (A) it works fine. But when called from within job_multiprocess (B) it comes up with the error message "job_procfile not found "
all functions have been defined . I have missed putting the () after function names in the pseudo code. The strange bit is that the function call works from within one of the if condition blocks , but comes up with this error message when called from within a function .
Tried to debug using -x but the output lists only the code outside the functions i.e. any code the functions is not listed.
I am working on AIX 5.3 on an IBM P590 .
It may help to put the functions into external files:
create separate file for every function, named like the function and with filemode 644
put all these files into a directory
at the beginning of your main script set the variable "FPATH=" to the directory holding the functions. FPATH works similar to PATH, but tells the shell where it can find external functions instead of external executables. Export the variable FPATH after defining it
The files have to contain the same function definitions as if they would be included in the main scripts file for example, this would go into a file $FPATH/foo:
# first line of file foo
function foo
{
# ... inside function foo ....
return <int>
}
This may not necessarily help in your specific case, but it might help in narrowing down the problem and finally find it.