Solved

Problem running an AS400 command line from VB.NET

Posted on 2012-03-27
6
1,268 Views
Last Modified: 2012-03-28
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
Comment
Question by:esemmoc
6 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 350 total points
ID: 37772141
Try the approach used in the question here

http://www.experts-exchange.com/OS/AS_-_400/Q_24367101.html
0
 

Author Comment

by:esemmoc
ID: 37772377
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
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37774027
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 16

Assisted Solution

by:theo kouwenhoven
theo kouwenhoven earned 25 total points
ID: 37774112
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
 
LVL 27

Assisted Solution

by:tliotta
tliotta earned 25 total points
ID: 37774566
...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
 

Author Closing Comment

by:esemmoc
ID: 37777902
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

20 Experts available now in Live!

Get 1:1 Help Now