[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1314
  • Last Modified:

Problem running an AS400 command line from VB.NET

I am trying to run a command statement from VB.NET to an AS400 machine using the following code but get a CWBCO1049 error (See ERROR OCCURS ON THIS LINE below) - The IBM I Server is not started or the connection was blocked by a firewall.  

The IBM I Server is started.  I am using VB.NET 10 Express on a Windows 7 machine.

Any suggestions would be helpful.


 Dim system As New cwbx.AS400System()
        On Error GoTo failed
        Dim YOUR400 As New cwbx.AS400System
        Dim servers As New cwbx.SystemNames
        Dim Command As New cwbx.Command

        'YOUR400.Define(servers.DefaultSystem)
        Command.system = YOUR400

        ' Enter USERID and PWD so the users will not be prompted
        Command.system.Define("as400")

        Command.system.UserID = "joesmith"
        Command.system.Password = "mypass"
        Command.system.IPAddress = "100.100.1.1"

        ' ERROR OCCURS ON THIS LINE.
        Command.Run("CHGUSRPRF USPRPF(bobjones) STATUS(*ENABLED)")

Thanks,

Elliot
0
esemmoc
Asked:
esemmoc
3 Solutions
 
CodeCruiserCommented:
Try the approach used in the question here

http://www.experts-exchange.com/OS/AS_-_400/Q_24367101.html
0
 
esemmocAuthor Commented:
Thanks but my program already receives the AS400 error code -- CWBCO1049.  I am looking for what is causing this error and how to fix it.
0
 
CodeCruiserCommented:
I linked to that question because code is slightly different. For example, he is using ip address in define method where as you are using "as400". He is calling the system.Signon method before running the command and you are not.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
theo kouwenhovenCommented:
Yes CodeCruser is right,

Try to use the Command.system.Signon();

If you have still problems, replace the Command.system.Define("as400")
with Command.system.Define("100.100.1.1") and skip the Command.system.IPAddress part.

Regards,
Murph
0
 
tliottaCommented:
...the AS400 error code -- CWBCO1049

That's not an AS/400 error code. That's an error from PC code.

The IBM I Server is not started or the connection was blocked by a firewall.

That's the error that needs to be handled. At that point, you don't even have a useful connection that you can logon to. You haven't gotten far enough to get an AS/400 error code.

The IBM I Server is started.

How did you determine that? If it is in fact true, then you have a problem with the route to the AS/400. It might be a hardware or software firewall or it might be an addressing problem.

Regardless, as of yet, you haven't managed to contact the AS/400 on the appropriate port. Until the route is proven, there's nothing that can be done for your VB programming.

Tom
0
 
esemmocAuthor Commented:
Thank you for questioning my assumption about connecting to the system.  Using Command.system.Signon() helped me determine that I wasn't.

Turns out I was using the wrong IP address.   That and a little cleanup of the CHGUSRPRF statement and it is now working good.
0

Featured Post

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now