Link to home
Create AccountLog in
Avatar of Al Rice
Al RiceFlag for United States of America

asked on

How to Slow Down a AS400 .mac Macro when Call Using "StartMacro" Function Within VBA Code

I am having problems playing back an AS400 (.mac) Macro when my VBA Code calls the .mac file Using the "StartMacro" Function.  The AS400 (.mac) Macro (partially shown below), which includes a lot of "wait" functions  (in bold Italics) runs very fast and does not seem to recognized the waits during execution when using the "StartMacro" Function Within VBA Code.  The same macro runs perfectly when manually, selected from the PC5250 macro menu (Screenshot) in iSeries Access for Windows Menu
User generated image          Description =
[wait app]
[wait inp inh]
"20
[enter]
[wait inp inh]
wait 15 sec until FieldAttribute 0000 at (22,6)
wait 15 sec until cursor at (22,7)
[wait app]
[wait inp inh]
"7
[enter]
[wait inp inh]
wait 15 sec until FieldAttribute 0008 at (4,4)
wait 15 sec until cursor at (4,5)
[wait app]
[wait inp inh]
[tab field]
[tab field]
"1
[enter]
[wait inp inh]
wait 15 sec until FieldAttribute 0008 at (4,4)
[wait app]
[wait inp inh]
[pf3]
[wait inp inh]
wait 15 sec until FieldAttribute 0000 at (22,6)
[wait app]
[wait inp inh]
             ...

The PCOMM VBA syntax I am using to execute "StartMacro" is below
   SessObj.autECLPS.StartMacro ('JE#356BSB0421')

The macro runs very fast and throws the following error:
Runtime Error '440'
Emulator interface (ehllapi) error. reason 9
... and then the macro aborts about 3/4 of the way through execution.

Finally, might my problem be related to the VBA code is using PCOMM syntax and the AS400 Macro was created in .mac format, rather that .vbscript format.

Thanks in advance for your experts guidance

Al
Avatar of Al Rice
Al Rice
Flag of United States of America image

ASKER

I have asked my IT department to search for any patches for the PC5250 emulator: iSeries Access for Windows which may fix my issues with long AS400 macros which fail during execution.  No response yet.

Has anyone else had this same experience, and resolved it with alternative solution?

Any help is appreciated.

Thanks
Al
Avatar of David Johnson, CD
VBA Macro's (vbscript) are NOT AS400 macros.  Completely different interpreters
Hi,
I think you are after something like

Dim autECLOIAObj as Object

 

Set autECLOIAObj = CreateObject("PCOMM.autECLOIA")

autECLOIAObj.SetConnectionByName("A")

 
'' wait for system available with 15 second time out
if (autECLOIAObj.WaitForInputReady(15000)) then

msgbox "Ready for input"

else

msgbox "Timeout Occurred"

end if

Open in new window


What version of Windows?
What version of IBM i Access for Windows or PCOMM?
Do you have the most recent service pack available for your version of IBM iAW or PCOMM installed?
Avatar of Al Rice

ASKER

This is my old request, which brought me to this site.  My IT resource has been out on medical and has recently returned and is investigating the Service Pack question, which has some licensing implications.   We were finally able to get the VBA code to launch and run the pre-recorded Macro(.mac), only by splitting the Macro in multiple steps and then have the VBA code to "call" the various phases (steps) of the Macro in separate "calls".  It was very painful but we finally got it to run.  For some "unknown" reason, perhaps the AS400 manages "wait times" differently when the Macro is launched from the PCOMM menu versus being "called" from within VBA.  Not sure.

I came to this expensive site with one discrete question and cancelled my subscription when I could not find someone who had my same experience.  I renewed my subscription today because I was notified there were some response to my question.  I have a reminder to cancel again in 20 days so that I am not charged for standing by.  Not sure it the value proposition is the right model for this site.  Perhaps others disagree.  Thank to all who weighed in on my question.
Hi,
No problems with me.
I don't come here to gain points anymore - I was page editor for about 10 years.
I still get all the notifications - if I see a something  that interests me I try and help.
its great you have a resolution - post it - it could be helpful to others - it am a passionate about sharing solutions - especially on the more obscure areas such a client access macros.
Dave

ASKER CERTIFIED SOLUTION
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer