The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Passing global variable to a function which is called by another function sars Shell Programming and Scripting 4 06-30-2008 11:39 AM
Error in functions : file2: function: not found padarthy Shell Programming and Scripting 2 10-10-2007 10:55 PM
Installation Procedure.. mcseramana HP-UX 2 07-22-2007 12:30 AM
how can i check in csh if command found or not found ? umen Shell Programming and Scripting 2 03-03-2007 07:38 PM
Installer script -- function not found error asutoshch Shell Programming and Scripting 1 07-10-2006 02:07 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-02-2007
rajesh_ramaoz rajesh_ramaoz is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 4
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 (permalink)  
Old 11-02-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
1. confirm you have "#!/bin/ksh" as the start

2. define your functions

Code:
funcname()
{
    blah
}
See if that helps.
  #3 (permalink)  
Old 11-03-2007
rajesh_ramaoz rajesh_ramaoz is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 4
yep,
have done both
Still get the error ...
  #4 (permalink)  
Old 11-03-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
what does "call" do?
  #5 (permalink)  
Old 11-03-2007
rajesh_ramaoz rajesh_ramaoz is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 4
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 (permalink)  
Old 11-03-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by rajesh_ramaoz View Post
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 (permalink)  
Old 11-03-2007
rajesh_ramaoz rajesh_ramaoz is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 4
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 .
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0