Link to home
Start Free TrialLog in
Avatar of coecho
coecho

asked on

Call QSYS.QCDEXC from C#

I was able to run this successfully in the past  -

CALL QSYS.QCMDEXC('SBMJOB CMD(CALL PGM(J09110Z) PARM(P09110Z FORECAST)) JOB(BDFORECAST) JOBQ(QPGMR) USER(FORECAST) INLLIBL(*JOBD)', 000000110.00000)

but now I'm getting the following error:

Error opening connectionERROR [HY000] [IBM][iSeries Access ODBC Driver][DB2 UDB]CPF1338 - Errors occurred on SBMJOB command.

Any ideas what could cause this error message when it worked before?  Is this a type of permissions issue on DB2?  Or a configuration issue?  What port is DB2 going over for its connection?  They closed down a bunch of ports here recently.  I'm using the i5 Series ODBC client driver.  Or - this there something wrong with the command I'm sending?  

thanks for your help!



string postCommand = @"CALL QSYS.QCMDEXC('SBMJOB CMD(CALL PGM(J09110Z) PARM(P09110Z FORECAST)) JOB(BDFORECAST) JOBQ(QPGMR) USER(FORECAST) INLLIBL(*JOBD)', 000000110.00000)";
  try
   {
        using (OdbcCommand myCommand2 = new OdbcCommand(postCommand, myConnection))
                {
                    if (myConnection.State == System.Data.ConnectionState.Closed)
                    {
                        myConnection.Open();
                    }
                    
                    int iRows = myCommand2.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Error opening connection" + ex.Message);
                return false;
            }

Open in new window

Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

That message means that the command made it to the command server job on the AS/400, but for some reason the command failed.  The easiest thing to do:

Sign onto the AS/400 in a green-screen session, preferably using the same profile that you use to submit the command.  Manually submit the command.  When the command failes, you can look at the detailed help (cursor on the error message, press F1) for a detailed explanation of the problem.  It could be lots of things:
  • Program J09110Z could be missing, deleted, moved, or renamed,
  • The library list could have changed for the user profile that the SBMJOB is being run under, and the system could be having trouble finding a required object.
  • User profile FORECAST could be deleted, disabled, or authority to a required object (program, jobd) revoked.
- Gary Patterson
ASKER CERTIFIED SOLUTION
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of coecho
coecho

ASKER

Hi Gary -

I was able to run the command on the green screen under a different account than I was trying to run the code under.  It turns out, that the JDE User I was using on the ODBC connection string, had the user permissions changed so that it no longer has permissions to run the DB2 CMD.  

Problem solved.  Thanks for your help.

Lisa
It sounded like something had changed.  Glad you could track it down.

- Gary Patterson
Hi coecho,

I'm almost sure that the comma between the command and the command length is not alowed, parameters in a as400 call are seperated by a space, not by a comma.

Regards,
Murph