Solved

Problem running an AS400 command line from VB.NET

Posted on 2012-03-27
6
1,291 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
[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
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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
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

Put Machine Learning to Work--Protect Your Clients

Machine learning means Smarter Cybersecurity™ Solutions.
As technology continues to advance, managing and analyzing massive data sets just can’t be accomplished by humans alone. It requires huge amounts of memory and storage, as well as the high-speed power of the cloud.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The DROP (Spamhaus Don't Route Or Peer List) is a small list of IP address ranges that have been stolen or hijacked from their rightful owners. The DROP list is not a DNS based list.  It is designed to be downloaded as a file, with primary intention…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

707 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