procedure/function not found in .ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting procedure/function not found in .ksh
# 1  
Old 11-02-2007
procedure/function not found in .ksh

Hi all ,

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)
}

job_multiprocess
{
read parameter files and init values ( awk )

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 "

Any ideas ?

Thanks !
# 2  
Old 11-02-2007
1. confirm you have "#!/bin/ksh" as the start

2. define your functions

Code:
funcname()
{
    blah
}

See if that helps.
# 3  
Old 11-03-2007
yep,
have done both
Still get the error ...
# 4  
Old 11-03-2007
what does "call" do?
# 5  
Old 11-03-2007
sorry should have been more specific ..

I have mentioned the framework of the shell script i.e. not the entire script
"Call" refers to calling the sub routine ( procedure )

I the program itself its just

if [[ ..something ...]]
then
job_procfile ( i have written this down as call job_procfile for clarity )
fi

The entire script runs over 600 lines and if required I can paste it over here ...
Thanks .
# 6  
Old 11-03-2007
Quote:
Originally Posted by rajesh_ramaoz
The entire script runs over 600 lines and if required I can paste it over here ...
Are you sure that every function is called after it is defined?

Have you tried debugging using

Code:
#!/bin/ksh -x

as the first line?
# 7  
Old 11-03-2007
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 .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command not found, but using function in bash

In the bash below, if the answer is "y" then goto function remove. If the answer is "n" then goto the id variable line (where the date is inputted). However, I am getting command remove not found, but remove is a function not an command. I must have the syntax incorrect? Thank you :). ... (3 Replies)
Discussion started by: cmccabe
3 Replies

2. UNIX for Dummies Questions & Answers

Function not found error

Hi All, I have written one shell script where I should call a function by passing variables to the actual function based on some condition. Each time I run the script I am getting the below error dsadm@bunyipd: /var/datastage/FRPDEVL/work/script> sh MClub_Validations.sh Iteration: 1... (1 Reply)
Discussion started by: tpk
1 Replies

3. Shell Programming and Scripting

ksh and Oracle stored procedure output in logfile

Friends, I pass some runtime arguments (date, number) through ksh script to Oracle procedure, use input value and pass it on to procedure. Oracle procedure gets input value, run query and logs everything in the logfile. I'm facing with couple of challenges 1. Even though I pass all... (5 Replies)
Discussion started by: homer4all
5 Replies

4. Shell Programming and Scripting

Calling Oracle stored procedure from ksh script

Friends, I'm newbie with ksh so wanting some help.... 1. I'm trying to call oracle stored procedure from ksh script by taking variable value from runtime, feed into script and execute procedure. 2. Put name1 and name2 value from script run replacing $3 & $4 I'm trying to put name1 in... (4 Replies)
Discussion started by: homer4all
4 Replies

5. Shell Programming and Scripting

Variable not found error for a variable which is returned from stored procedure

can anyone please help me with this: i have written a shell script and a stored procedure which has one OUT parameter. now i want to use that out parameter as an input to the unix script but i am getting an error as variable not found. below are the unix scripts and stored procedure... ... (4 Replies)
Discussion started by: swap21783
4 Replies

6. Shell Programming and Scripting

ksh:not found

Hi, i used to run oracle queries in unix and then transfer the result in to csv files. it was working fine for a month.but today it showed an error like ksh>dimens_minus_scpt.sh not found. Can someone please help. Thanks. :wall: (4 Replies)
Discussion started by: varadharajan87
4 Replies

7. Shell Programming and Scripting

Read Table,View,Package,Function and Procedure Name in a File

Hi I am new to Unix shell scripting. But i need help to slove the below issue. Issue description: I want to read table, view names and package names in a file my plan to find the table name is : search "From" key word find the table or view To find the packge name : Search "Package... (5 Replies)
Discussion started by: sboss
5 Replies

8. Shell Programming and Scripting

Function not found message

I have shell script as below: #!/bin/ksh #set -xv function set_variable { VARIABLE_NAME=$1 CURRENT_PATH=`pwd` if ; then echo "\nconfiguration_file.lst file not found in $CURRENT_PATH/common/common_scripts" exit 1; fi VARIABLE_COUNT=`cat... (2 Replies)
Discussion started by: findprakash
2 Replies

9. Shell Programming and Scripting

function: not found error on solaris

shell script in very simple, #!/bin/sh function msgs { echo 'this' } msgs It works on linux, apple, but can not run on solaris. On solaris, when I enter "./t.sh", it gave me following error, ./t.sh: function: not found this ./t.sh: msgs: not found What's wrong with... (3 Replies)
Discussion started by: microstarwwx
3 Replies

10. Shell Programming and Scripting

calling a PL/SQL stored procedure from KSH

Hi I have a stored procedure which should be called from KSH. Could ayone please help me with this. Thanks (1 Reply)
Discussion started by: BlAhEr
1 Replies
Login or Register to Ask a Question