get error in my shell script

Hi experts

in my shell script i have this line : dosql " update txout_820 set flag821 = 'H' where edifname= '04050055.23'"
i want to update my database.
when i run the script through cron i got this error message :-23101 Unable to load locale categories.
and i checked the database and it wasnt updated.

i couldnt find why dosql is not runnig and how to fix it ? what that error message is about?

when i comment dosql in my script , the error message didnt show up .

could you please help me with that? i appreciate any help. i need to fix this for my co-op job.

sorry if i post my question in wrong category.


this is my script:

# This script will copy Bell Canada EDI file to AS2 server

export DBPATH=/swdbase/database
export DBTEMP=/swdbase/tmp
export PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/informix/bin:/usr2/reporting/bin:/usr2/reporting/cvs-bprpt/script:/usr4/edi/edi_script
mm=` date +%m`
dd=` date +%d`

echo "------------------------------------------------------" >> $THELOG
echo "`date +%m/%d/%y-%H:%M:%S` : edi autosend.as2 starting -----" >> $THELOG
echo "  sending Bell Canada file to AS2 server " >> $THELOG
cd /usr4/edi/edi_as2_ready

echo $mm$dd

for edi_as2 in `ls`
       echo $edi_as2
                   echo " `date ` - starting duplicate check" >> $THELOG

        bellcdn=`$BIN/viewedi < $edi_as2 |grep 'BELLOACCTREC' |wc -l`

                        echo " size: $bellcdn "
        if (test $bellcdn -gt 0) then

                                                $BIN/ $edi_as2 >> $THELOG

                                                case "$result" in
                                                                  echo "$edi_as2 is NOT duplicated"
                                                                  scp $edi_as2 esp@ ###
                                                                  echo "The following file sent out:" >> $THELOG
                                                                  echo $edi_as2 >> $THELOG
                                                                  #mv $edi_as2 /usr4/edi/edi_backup/ > /dev/null 2>&1

                                                                  echo "update txout_820" >>$THELOG
                                                                  dosql " update txout_820 set flag821 = 'H' where edifname= '04050055.23'"      
                                                                  echo "$edi_as2 is duplicated"
                                                                  sendmon 1 " autosend.as2----$edi_as2 is duplicated,  Please check"
                                                ##### mv $edi_as2 $EDIDIR/edi_hold
                                                #####      cp $edi_as2 $EDIDIR/edi_hold            
                                                                  echo $edi_as2 "has been moved to edi_hold "
                                                                  echo "------------------------------------" >> $THELOG
                                                                  echo "update txout_820" >>$THELOG
                                                              dosql " update txout_820 set flag821 = 'N' where flag821 = 'C' and edifname = '$edi_as2' "
                                                                  echo "not a 820 file"
                                                                  echo "not 820 file"  >> $THELOG

                                                #####       scp $edi_as2 esp@   ###

                                                ##### mv $edi_as2 /usr4/edi/edi_backup/ > /dev/null 2>&1
                                                #####      cp mv $edi_as2 /usr4/edi/edi_backup/ > /dev/null 2>&1            
                                                                  echo "no record found in database" ;;


                                          echo "result : $result"
           echo "No file to send." >> $THELOG
echo "`date +%m/%d/%y-%H:%M:%S` : edi autosend.as2 ended -----" >> $THELOG
echo "------------------------------------------------------" >> $THELOG

exit 0

Who is Participating?
root_startConnect With a Mentor Commented:
Hi Far22,

Check the following link:

It seems that one environment variable is not set or is not set correctly: INFORMIXDIR

Try, in your script to export this variable:
export INFORMIXDIR=<path to informix dir>

Sometimes the "<path to informix dir>" can be "/usr/users/informix"

I hope it helps you. =0)
Gabriel OrozcoSolution ArchitectCommented:
this problem has happend with informix and scripts running from crontabs

may be you need to add at the top of your crontab:

. /etc/profile

so you can add all provile variables. But you may need only the locale variables:
Far22Author Commented:
thanks for your response

i look at the link but i didnt get it what should i do to fix this.  i didnt understand the answer.sorry i'm new in that.

i understand this is a setting environment variable problem but i dont know how to fix this.
also, how can i add /etc/profile to the cron table?
i mean what is the syntax?
should i just put /etc/profile as the first line of the cron table? or should i put it before the line has my script?

is there a way i can fix it in my script instead of the cron table?

thanks a lot for your help.
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Gabriel OrozcoSolution ArchitectCommented:
sorry, change "crontab" for "script" instead:

may be you need to add at the top of your script:

. /etc/profile

but first be sure you have an /etc/profile =)
if it runs with your user, you might do something like
and have a look at your environment-settings (pretty close to what was mentioned above)
just export any environment-variable
e.g. if env displays a var like
then you can try
export SHELL=/bin/bash
and so on. Another possibility for you to use would be to trigger the command as the correct user.
this would be something like:
su - <username> -c /path/to/your/script
So cron would change to your UID and trigger the script with your environment...

Far22Author Commented:
thanks a lot. it is working now.

i wish experts in bluethoot category were like you.

thanks a loooooooooooooooooooooooooot
Gabriel OrozcoSolution ArchitectCommented:
Venabili: Please re-review the question as the user found an answer.

I think you would want to give the points to root_start perhaps
Did you read my message? Had I said that the solution is not found?
Gabriel OrozcoSolution ArchitectCommented:
I think I overlooked your message. On other previous emails I got you were already given recommendation so I think it was because of that

my apologies =)
I give them when I am sure what to do. When I am not after the third reading, I just ask the experts to help me make the decision :)

It is ok :)

Far22Author Commented:
hi experts

sorry i didnt check this email for a while for some reasons. i accepted the answer and it helped me to solve my problem.i thought it's clear from my last submission. thanks for your help again.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.