Develop macros in AS/400 system

58930 pts.
Tags:
AS/400
AS/400 macros
Hi everyone, Here's a question that a user needs help with regarding AS/400 macros. Please see below: Hi All, I am starting to develop macros in the AS/400 system we have in the company. I develop a macro that fill in specific orders with all the order line related to it. To do so, I go in a module called "Work with Requirmt Plan & Purchase order". Then I launch the macro as followed:
[PCOMM SCRIPT HEADER]

LANGUAGE=VBSCRIPT

DESCRIPTION=

[PCOMM SCRIPT SOURCE]

OPTION EXPLICIT

autECLSession.SetConnectionByName(ThisSessionName)

REM This line calls the macro subroutine

subSub1_

sub subSub1_()

autECLSession.autECLPS.SendKeys "[enter]"

autECLSession.autECLPS.SendKeys "1"

' Opening order XX1 XXXXXXX1

autECLSession.autECLPS.SendKeys "[delete]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "1"

autECLSession.autECLPS.SendKeys "XX1"

autECLSession.autECLPS.SendKeys "XXXXXXX1"

autECLSession.autECLPS.SendKeys "[enter]"

'Selecting order XX1 XXXXXXX1

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[tab]"

autECLSession.autECLPS.SendKeys "1"

autECLSession.autECLPS.SendKeys "[enter]"

'Go into 6. Products by Req. Plant

autECLSession.autECLPS.SendKeys "[tab]"

autECLSession.autECLPS.SendKeys "[enter]"

autECLSession.autECLPS.SendKeys "6"

'Enter Product XX8

autECLSession.autECLPS.SendKeys "1"

autECLSession.autECLPS.SendKeys "XX8"

autECLSession.autECLPS.SendKeys "[enter]"

'Provide Date & Qty

autECLSession.autECLPS.SendKeys "061117"

autECLSession.autECLPS.SendKeys "[eraseeof]"

autECLSession.autECLPS.SendKeys "400"

autECLSession.autECLPS.SendKeys "[eraseeof]"

autECLSession.autECLPS.SendKeys "[enter]"

autECLSession.autECLOIA.WaitForAppAvailable

autECLSession.autECLOIA.WaitForInputReady

autECLSession.autECLPS.SendKeys "[enter]"

autECLSession.autECLOIA.WaitForAppAvailable

autECLSession.autECLOIA.WaitForInputReady

autECLSession.autECLPS.SendKeys "[enter]"

autECLSession.autECLPS.SendKeys "1"

'Enter Order XX1 XXXXXXX2

autECLSession.autECLPS.SendKeys "[delete]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "1"

autECLSession.autECLPS.SendKeys "XX1"

autECLSession.autECLPS.SendKeys "XXXXXXX2"

autECLSession.autECLPS.SendKeys "[enter]"

'Select Order XX1 XXXXXXX2

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[down]"

autECLSession.autECLPS.SendKeys "[tab]"

autECLSession.autECLPS.SendKeys "1"

autECLSession.autECLPS.SendKeys "[enter]"

autECLSession.autECLPS.SendKeys "[tab]"

autECLSession.autECLPS.SendKeys "[enter]"

autECLSession.autECLPS.SendKeys "6"

'Enter Product XXT

autECLSession.autECLPS.SendKeys "1"

autECLSession.autECLPS.SendKeys "XXT"

autECLSession.autECLPS.SendKeys "[enter]"

'Enter Date & Qty

autECLSession.autECLPS.SendKeys "061117"

autECLSession.autECLPS.SendKeys "[eraseeof]"

autECLSession.autECLPS.SendKeys "1"

autECLSession.autECLPS.SendKeys "[eraseeof]"

autECLSession.autECLPS.SendKeys "[enter]"

autECLSession.autECLOIA.WaitForAppAvailable

autECLSession.autECLOIA.WaitForInputReady

'Enter Product XXT

autECLSession.autECLPS.SendKeys "1"

autECLSession.autECLPS.SendKeys "XXR"

autECLSession.autECLPS.SendKeys "[enter]"

'Enter Date & Qty

autECLSession.autECLPS.SendKeys "061117"

autECLSession.autECLPS.SendKeys "[eraseeof]"

autECLSession.autECLPS.SendKeys "1"

autECLSession.autECLPS.SendKeys "[eraseeof]"

autECLSession.autECLPS.SendKeys "[enter]"

autECLSession.autECLOIA.WaitForAppAvailable

autECLSession.autECLOIA.WaitForInputReady

autECLSession.autECLPS.SendKeys "[enter]"

autECLSession.autECLOIA.WaitForAppAvailable

autECLSession.autECLOIA.WaitForInputReady

end sub
In my example, I am limiting myself to the filling of 2 orders, but I am trying to do more. But sometimes, after 3,4 or 5 order filling, the system quit the module "Work with Requirmt Plan & Purchase Order" and continue the macro from the Main Menu, therefore blocking itself and crashing, even though I have never gave in the order to. What could I do to ensure after each order filling I come stay in my module without leaving? Is it to much instructions for the systems? Do I overwhelm him forcing him to reset on the main menu? Thanks in advance for your help and knowledge, Best regards, Paul” Thanks in advance for your help

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • PaulLerivrey
    Hi All,
    I am responsible of this discussion, but having issue on posting it properly.
    As an additional info: here is my AS/400 version 6.0 for Windows.
    20 pointsBadges:
    report
  • ToddN2000
    Seems like the task you are trying to do would be better done with an app or program. Macros do have limitations and are not as flexible.
    87,535 pointsBadges:
    report
  • WoodEngineer
    I suspect that this macro will become more of a liability than an asset. Macros just run blindly. If accidentally triggered on an unintended page many errors will probably be generated. I agree with ToddN2000.
    7,640 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: