Jump to content

AS400 tasks automation


Neutro
 Share

Recommended Posts

  • 2 weeks later...

This is great -  It's cool to see someone else interested in AS400 automation!

A few years ago I developed an application for my employer that automated iSeries and wrote a massive library to operate on these PCOMM classes. I found that using the AutScreenDesc class was a very reliable way of waiting for a screen by first describing it then calling the WaitForScreen() method. Alternatively, the WaitForString() and WaitForStringInRect() methods work just as well.

I also found the SetConnectionByHandle() method was a bit more reliable when dealing with multiple sessions.

I wish I could share the lib, but unfortunately it technically doesn't belong to me :(

Though IBM provides a wealth of knowledge on these classes here and even provide VB example code which makes it super easy to translate into AU3.

Link to comment
Share on other sites

  • 2 months later...

Welcome to the AS400 world :D

PTFs are the windows updates of AS400, so IBM are providing them ;)

Fyi all moderns AS400 are virtual and run on an IBM hypervisior (the same way a VM runs on ESXi), so I recommend you backup your virtual AS400 image before trying anything ;) 

Link to comment
Share on other sites

5 hours ago, Neutro said:

Welcome to the AS400 world :D

PTFs are the windows updates of AS400, so IBM are providing them ;)

Fyi all moderns AS400 are virtual and run on an IBM hypervisior (the same way a VM runs on ESXi), so I recommend you backup your virtual AS400 image before trying anything ;) 

Not ours.  Not one but 2 physical machines :)

and we have a TON of other servers and services that interface it.

Some of those might be virtual, not sure yet.

Edited by ViciousXUSMC
Link to comment
Share on other sites

13 hours ago, ViciousXUSMC said:

Not ours.  Not one but 2 physical machines :)

and we have a TON of other servers and services that interface it.

Some of those might be virtual, not sure yet.

When you have 2 physical machines, 1 is usually dedicated to business operations and the other one to backup/test.

I find it unlikely that your 2 physical machines are not hypervisors. If they are not then your hardware is most likely kinda old ^^

As i told you by PM you should try to contact IBM support :)

Edited by Neutro
Link to comment
Share on other sites

  • 6 months later...

Thanks for the information, that is very helpful.

I almost succeed to do what I try to do.

I tried to get screen content using  GetScreen function but I always got errors.

Is it my syntaxe or it's not possible to use that function ?


My code.

global $oOIA = ObjCreate("PCOMM.autECLOIA")
$oOIA.SetconnectionByName("A")

global $oPS = ObjCreate("PCOMM.autECLPS")
$oPS.SetConnectionByName("A")

Global $actualKw

$oPs.GetScreen($actualKw, 51, 9, 18, 50);

MsgBox($MB_SYSTEMMODAL,"Actual Web Keyword", _ArrayDisplay($actualKw))

 

Link to comment
Share on other sites

  • 2 years later...

Hi Guys, im new on this and i'm trying to automate an AS400 console, im following the example of Neutro but when trying to declare the variables im having the following error:

"C:\Windows_x86-64\TestScript.au3" (4) : ==> Variable must be of type "Object".:
$oOIA.SetconnectionByName("TESTENV")
$oOIA^ ERROR

Following the code:

global $oOIA = ObjCreate("PCOMM.autECLOIA")
$oOIA.SetconnectionByName("TESTENV")

global $oPS = ObjCreate("PCOMM.autECLPS")
$oPS.SetConnectionByName("TESTENV")

RunWait("acslaunch_win-64.exe")

Sleep(5000)

 

If you can give me a light on how to get around of this error or do the SetCursorPos on the window it will be appreciated.

 

Thanks.

Link to comment
Share on other sites

  • 3 weeks later...

Hey,

Sorry to answer a bit late but better late than never ;)

For this to work you need to have the IBM iseries software installed on your computer and check that you can effectively use it to connect to interface with your AS400 with the 5250 emulator as displayed in my screenshots in my first post.

If you do not have the iseries software and the 5250 interface emulator installed the object creation will fail in autoIT and you will get the error message that you had.

Also in your code you used SetconnectionByName("TESTENV") but "TESTENV" here is wrong. Please read again my first post, instead of "TESTENV" this should be the letter of the session that is displayed when you open the 5250 interface emulator as shown in my screenshots (letter A and B in my examples).

If you set anything else than the right letter in SetconnectionByName the code will fail.

Also if i recall correctly, when i did this post back in 2017 it was on windows 7. If my memory is right i've tried using the same on Windows 10 and it also worked, but i'm not 100% sure.

Also i just checked and saw that the "IBM i Access for Windows" software that includes the iseries software that i'm referring to has been discontinued if i'm not wrong:

https://www.ibm.com/support/pages/ibm-i-access-windows

and replaced by the new version called "IBM i Access Client Solutions". 

I stopped working on AS400 for a while now so i dont know if the code in my first post still work with this version, but even if IBM say in their article that the first version of I Access for Windows has been discontinued and does not support Windows 10, it might still work properly as i tested it back then when i was working on migrating our IT from windows 7 to win10 and had no problems.

Link to comment
Share on other sites

  • 1 month later...

Hi ,

Error message “unknown function name” is thrown when trying to create objects for autECLOIA or autECLPS. Do we have to include any libraries before hand. If so how to include them. 
I have gone threw different posts but unable to find the libraries or how to include them.

Thanks in advance.

@water: could you provide me an advice on the above issue.

Edited by Ravali
Link to comment
Share on other sites

I have never worked with AS400, just with IBM mainframes.
You have to make sure that the correct software and the correct version is installed (as Neutro describes above).
How to do this and how to set up the computer for automation is described in the docu of the software.

Sorry for not being more specific but that's all I can do based on the information you provide.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

@water/ @Neutro : Sorry for the less information provided. I am just trying to connect and automate ibm as400 database using autoit.Do i have to include or download any libraries for auto it to recognize the below statements. Unknown function name is thrown when trying to create object for autECLOIA or autECLPS.

global $oOIA = ObjCreate("PCOMM.autECLOIA")
$oOIA.SetconnectionByName("A")

global $oPS = ObjCreate("PCOMM.autECLPS")
$oPS.SetConnectionByName("A")
Link to comment
Share on other sites

@Ravali :welcome: to logo_autoit_210x72.svg forum.

Please make a small reproducer just how you create object and connect, of course do not forget to anonymize your security related data.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

But please first answer Danp2' s questions.

  • Which software do you use?
  • Which version do you use?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hi,

I am able to access the AS400 Ibm sessions manually. But facing the issue when trying to automate through autoit.

As am able to access the application without any issue , I dnt think this might be the download problem of the software.

I am using IBM Personal Communications iseries as neutro mentioned in his first post.

Session manager version 6.0 for windows is used.

The code in autoit is

Global $oOI=ObjCreate(“PCOMM.autECLOIA”)

Global $oPS=ObjCreate(“PCOMM.autECLPS”)

 

this might be a silly mistake but am unable to figure it out as am new to autoit.

Thanks in advance.

 

Link to comment
Share on other sites

Maybe when installing PComm the libraries needed by AutoIt haven't been selected and hence are now missing?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

14 hours ago, mLipok said:

Please make a small reproducer just how you create object and connect, of course do not forget to anonymize your security related data.

Again please post small reproducer to this

2 hours ago, Ravali said:

Global $oOI=ObjCreate(“PCOMM.autECLOIA”)

Global $oPS=ObjCreate(“PCOMM.autECLPS”)

Complete I mean which you run to check....

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

According to this post you need to create objects for the connection manager and a session and then you call autECLOIA and autECLPS.
Could you please give this code a try?

Edit: You need HACL (Host Access Class Library) objects as described here to automate a PCOMM session.
A good overview can be found here.
My understanding is that at least you have to create a connection.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...