Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL0035N  The file "P5353255.msg" cannot be opened

Posted on 2003-11-04
8
Medium Priority
?
1,495 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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
 

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

Quick Cloud Training

Looking for some quick training on the cloud in 2 hours or less? Check out these how-to guides in AWS, Linux, OpenStack, Azure, and more!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

715 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