Solved

SQL0035N  The file "P5353255.msg" cannot be opened

Posted on 2003-11-04
8
1,396 Views
Last Modified: 2012-08-14
Hi,
I'm trying to create a SQL stored procedure, but after I ran
db2 -td@ -vf getAllChanges.db2
I got the following error:
--------------------
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0035N  The file "P5353255.msg" cannot be opened.
--------------------
There is a file called P5353255.sqc being created in /home/db2inst1/sqllib/function/routine/sqlproc/SOMEDB/DB2INST1/tmp directory, and the group id and user name are correct, I wonder why it cannot open the file P5353255.msg. Obviously it could created the file in the first place. My SQL stored procedure is as follows:

CREATE PROCEDURE get_all_changes ( IN p_group_name VARCHAR(15),
                                   IN p_inst_name VARCHAR(15),
                                   IN p_num_of_days INT)
    SPECIFIC get_all_changes
    DYNAMIC RESULT SETS 1
    LANGUAGE SQL
gac: BEGIN

    DECLARE v_dynSQL VARCHAR(200);
    DECLARE v_inst_num SMALLINT DEFAULT 1;
    DECLARE v_no_data SMALLINT DEFAULT 0;
    DECLARE v_hist_table VARCHAR(30);
    DECLARE v_stmt STATEMENT;
    DECLARE c_hist CURSOR WITH RETURN TO CALLER FOR v_stmt;
    DECLARE CONTINUE HANDLER FOR NOT FOUND
        SET v_no_data=1;

    SET v_hist_table = p_group_name||'_HIST';

    SELECT inst_num INTO v_inst_num FROM inst_lookup WHERE group_name=p_group_name AND inst_name=p_inst_name FETCH FIRST 1 ROW ONLY;

    IF (v_no_data=0) THEN
        SET v_dynSQL = 'SELECT param_name, from_value, to_value, date_modified FROM ' ||
                        v_hist_table || ' WHERE inst_num=v_inst_num AND modified_date>=current timestamp -      p_num_of_days days ORDER BY param_name';
        PREPARE v_stmt FROM v_dynSQL;
        OPEN c_hist;
    END IF;
END gac@

Any help will be appreciated.
0
Comment
Question by:minjiezen
  • 4
  • 4
8 Comments
 
LVL 2

Expert Comment

by:askanivg
ID: 9682242
When you installed the server you should have been prompted to create
another user "db2fenc1" (I think this is the default) with another group
db2fadmin (or something like that), try to use that user or to add your
instance owner to the fenc admin group.
0
 
LVL 2

Expert Comment

by:askanivg
ID: 9682267
SQL0035N The file "<name>" cannot be opened.  


Explanation: The message file "<name>" could not be opened.

Binding or precompilation has been terminated.

User Response: Ensure that the system can access the file.

0
 

Author Comment

by:minjiezen
ID: 9682614
Thanks for your response.
I tried to use db2fenc1 as user and got the same error.
My instance owner is db2inst1, which has more privillages than fenc group (it's db2fgrp1 in my system). Should I add db2inst1 to db2fgrp1?
0
 
LVL 2

Expert Comment

by:askanivg
ID: 9682661
try that.. and also give permissions to db2fgrp1 to do read/write/execute in that folder..

hth
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:minjiezen
ID: 9682810
I added db2inst1 into db2fgrp1, so if I do the following, it shows that now db2inst1 belongs to 2 groups:
> groups db2inst1
db2inst1 : db2grp1 db2fgrp1

However, when i ran
db2 -td@ -vf getAllChanges.db2 (getAllChanges.db2 is now owned by db2fenc1 and belongs to db2fgrp1)
I got the same error again. If I go to
/home/db2inst1/sqllib/function/routine/sqlproc/SOMEDB/DB2INST1/tmp,
all *.sqc files are created by db2inst1 and belongs to group db2grp1, does that signify anything incorrect? I thought at least the one I ran as db2fenc1 should be created by db2fenc1. And I still don't understand why it can create one file (the .sqc file) but not the other (the .msg file), unless .msg file is not being created in the same directory.
Thanks.
0
 

Author Comment

by:minjiezen
ID: 9682839
Sorry, I meant if I go to
/home/db2inst1/sqllib/function/routine/sqlproc/SOMEDB/DB2FENC1/tmp,
......
0
 
LVL 2

Accepted Solution

by:
askanivg earned 50 total points
ID: 9683180
log in as db2inst1 and give access to everyone.
chmod 777 * in this directory - /home/db2inst1/sqllib/function/routine/sqlproc/SOMEDB/DB2INST1/tmp

Thanks
0
 

Author Comment

by:minjiezen
ID: 9687337
askanivg, thanks a lot!! It worked after I added write permission to 'other' for each directory in the path  
/home/db2inst1/sqllib/function/routine/sqlproc/SOMEDB/DB2INST1/tmp/
Apparently the application is writing as 'other', instead of as db2inst1 or db2fenc1 (which I assumed it would be), to the above directory.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

708 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

15 Experts available now in Live!

Get 1:1 Help Now