get error in my shell script

Posted on 2006-05-10
Last Modified: 2007-12-19
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

Question by:Far22
    LVL 19

    Expert Comment

    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:

    Author Comment

    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.
    LVL 19

    Expert Comment

    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 =)
    LVL 1

    Expert Comment

    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...

    LVL 3

    Accepted Solution

    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)

    Author Comment

    thanks a lot. it is working now.

    i wish experts in bluethoot category were like you.

    thanks a loooooooooooooooooooooooooot
    LVL 19

    Expert Comment

    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
    LVL 20

    Expert Comment

    Did you read my message? Had I said that the solution is not found?
    LVL 19

    Expert Comment

    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 =)
    LVL 20

    Expert Comment

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


    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
    Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now