Solved

Problem running an AS400 command line from VB.NET

Posted on 2012-03-27
6
1,279 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

822 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