You can use custom VBScript macros with the OFCRUNPC command in iSeries Office Integrator. 
 
Prerequisites:
  • iSeries Office Integrator PC Component version 1.1.57 or above
  • RJS VBScript Editor (installed automatically when you use the main iSeries Office Integrator PC Component installer)
 

Creating Macro Files to use with iSeries Office Integrator

 
You can create VBScript macros with any text editor or RJS VB Script Editor, which is found in C:\Program Files\RJSOFFICE\rjsscripteditor.exe. In RJS VBScript Editor, press F8 to step through the MAIN subroutine and test the VBScript interactively.
 

Running VBScript Macros with the OFCRUNPC Command

 
Use the following syntax to run VBScript macros with the OFCRUNPC command:
 
OFCRUNPC PORT(21000) CMD('RJSVBSCRIPT~C:\Program files\rjsoffice\rjsvbscriptmacrosamples.bas~LaunchURL;>http://www.rjssoftware.com;') OPTION(*OTHER)           
 
  • Separate parameters with a tilde (~).
  • Parameter 1: RJSVBSCRIPT - tells iSeries Office Integrator you are running a VBScript macro.
  • Parameter 2: The name of the VBScript macro file.
  • Parameter 3: A parameter list for the macro. Separate parameters with a semicolon (;).
 

Calling the iSeries Job Log with OFCRUNPC Macro and Returning Messages

 
If a VBScript macro sets a value for the RunVBScript return parameter, that value is returned to the job log on the iSeries after the VBScript macro completes. To read this value, use a CL program to call the RCVMSG command and look for an entry in the job log that starts with 215. You can also use the DSPJOBLOG command to review the returned message contents.
 
For example: The following is a sample job log after the OFCRUNPC command has been called that returns the success of a launched URL:
 
Object FTPCMD in QTEMP type *FILE deleted.  File FTPCMD created in library QTEMP.       Member FTP added to file FTPCMD in QTEMP.   Object FTPLOG in QTEMP type *FILE deleted.  File FTPLOG created in library QTEMP.       Member FTPLOG added to file FTPLOG in QTEMP.PC Commands Completed.                      PC Commands Completed Normally.             215 URL was launched.
 

Testing the Sample VBScript Macro

To test the sample VBScript macro that you downloaded above:
  1. Extract the file to C:\Program Files\RJSOFFICE\RJSVBScriptMacroSamples.bas.
  2. From the iSeries, launch a Word document on your PC:

    Note: The following example assumes Microsoft Word is installed on your PC and there is a document C:\TEST.DOC.

    OFCRUNPC  CMD('RJSVBSCRIPT~C:\Program files\rjsoffice\rjsvbscriptmacrosamples.bas~StartWord;c:\test.doc;') OPTION(*OTHER)

    If the command places a value in the RunVBScript parameter, you can retrieve that value from the job log with RCVMSG or display it with DSPJOBOG.

  3. From the iSeries, launch a web URL:

    OFCRUNPC CMD('RJSVBSCRIPT~C:\Program files\rjsoffice\rjsvbscriptmacrosamples.bas~LaunchURL;>http://www.rjssoftware.com;') OPTION(*OTHER)

    If the command places a value in the RunVBScript parameter, you can retrieve that value from the job log with RCVMSG or display it with DSPJOBOG.

Still have questions? We can help. Submit a case to technical support

Last Modified On:
You don't have the appropriate permissions.
No, open a new Support Case