Terminal Emulation & Transformation Community
  • Home
  • Blogs
  • FORUM
  • About
  • Contact
  • Resources

Macros in IBM Personal Communications

12/1/2017

1 Comment

 
Picture
When accessing any mainframe, application using an emulator, many of the day to day activities would be a certain set of actions performed as a routine. These can be automated using IBM Personal Communications macros. A series of actions can be recorded as a macro and it can be played/executed to perform those set of actions without much manual intervention
A simple VBS Macro which is recorded from PCOMM will look like below, and will need no user intervention.
In this example, user is navigating from first screen of host (after login) and going to ready prompt screen. For this operation user has to press ‘F3’, ‘F3’ and then type option 3 for “Process Option” field and “Enter”. Hence these keystrokes can be seen in the sample code generated by PCOMM.
/***********************************************
[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.autECLOIA.WaitForAppAvailable
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[pf3]"
   autECLSession.autECLPS.WaitForAttrib 22,13,"00","3c",3,10000
   autECLSession.autECLPS.Wait 3088
   autECLSession.autECLOIA.WaitForAppAvailable
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[pf3]"
   autECLSession.autECLPS.WaitForAttrib 4,24,"00","3c",3,10000
   autECLSession.autECLPS.WaitForCursor 4,25,10000
   autECLSession.autECLOIA.WaitForAppAvailable
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "3"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
end sub
**************************************************************/
Also we can edit above macro and make it interactive by seeking user input for any input field. Let us modify above code to seek user input for Entry option “3” i.e. for Process Option field
/*********************************************************************
[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)
 
REM This line calls the macro subroutine
subSub1_
 
sub subSub1_()
   Dim strAnswer
   autECLSession.autECLOIA.WaitForAppAvailable
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[pf3]"
   autECLSession.autECLPS.WaitForAttrib 22,13,"00","3c",3,10000
   autECLSession.autECLPS.Wait 3088
   autECLSession.autECLOIA.WaitForAppAvailable
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[pf3]"
   autECLSession.autECLPS.WaitForAttrib 4,24,"00","3c",3,10000
   autECLSession.autECLPS.WaitForCursor 4,25,10000
   autECLSession.autECLOIA.WaitForAppAvailable
   autECLSession.autECLOIA.WaitForInputReady
   strAnswer = InputBox("Please enter a Process Option:")
   autECLSession.autECLPS.SendKeys strAnswer  
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
end sub
******************************************************************/
A macro can be a PCOMM inbuilt runnable macro or it can be invoked through various applications like VBA, MS Excel, Java script, C# or C++. A programmatic access to a host emulator session can be achieved using HACL API’s.
The Host Access Class Library (HACL) is a set of objects that allows application programmers to access host applications easily and quickly. IBM Personal Communications provides support for a wide variety of programming languages and environments by supporting several different HACL layers and more about this is explained in support link
​1.https://www.ibm.com/support/knowledgecenter/en/SSEQ5Y_12.0.0/com.ibm.pcomm.doc/books/html/host_access06.htm
2.https://www.tetcommunity.com/blogs/interaction-with-mainframes-made-easy-with-ibm-personal-communications-api
 
The following list of use cases gives us an idea of what all can be achieved using macros in IBM Personal Communications.
​
Use case 1: Navigating from screen 1 to screen X
In a scenario, a user might be interested in going directly to screen X, whereas to reach screen X, user has to go through screen 1,2,3..X and execute certain set of commands and this can be automated by recording a macro. User has to play this macro at screen 1 and macro would perform all the necessary steps and would stop at screen X.

User case 2: Performing a simple print job
User can record a macro to navigate to print jobs and perform print operation. Playing this macro user can print pre-defined jobs whenever they are in need of and by this manual steps can be avoided and print job can be automated.

Use case 3: Logon operation
User can record a macro to perform login operation for a host machine and play this macro at the login screen for automated login.

Use case 4: File transfer operations
User can record a macro to perform File transfer operation to/from a host machine and play this macro to automatically receive/send files.

Use case 5: To generate reports
User can record a macro to generate periodic reports and play this macro to automatically generate reports using a set of operations. Also users can extend this as per their business needs.

Read more on Macro Play/record from IBM support websites.
1.https://www.ibm.com/support/knowledgecenter/en/SSEQ5Y_12.0.0/com.ibm.pcomm.doc/books/html/quick_beginnings08.htm#mcr
P.S: Macro play and record can be limited to Admin users only and read more on this “Advanced configurations” under “User Preferences”

Vinay Nanjundappa

L3 Support, PCOMM
v
inay.n@hcl.com ​

1 Comment
Mariyam Zaidi link
9/16/2019 05:03:59 am

Dear Blogger,

Can you help me with the code for for loop using VBA in the macro for the below code.

[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)
REM This line calls the macro subroutine

subSub1_
sub subSub1_()
Dim c, client,i
c= InputBox("Please select the Client 1. PFIZER 2. PFPEM")
If c=1 Then
client="PFIZERINTE"
Else
client="PFPEMFZLLC"
End If
autECLSession.autECLOIA.WaitForAppAvailable

For i=1 To 5
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "T8S"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[tab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[tab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[tab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[tab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[tab]"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys client
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "AED"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "105"
Next i // This line shows error
end sub

Reply



Leave a Reply.

    Archives

    May 2020
    October 2019
    July 2019
    June 2019
    May 2019
    March 2019
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    October 2017
    September 2017

    Categories

    All
    HACP
    HACPEE
    HATS
    HOD
    PCOMM

    RSS Feed

Proudly powered by Weebly
  • Home
  • Blogs
  • FORUM
  • About
  • Contact
  • Resources