Calling AS/400 programs from Excel spreadsheets

If any of you are downloading AS/400 files into Excel using macros, you probably have the users going to the green

screen to run an update or refresh program, then going into Excel to actually download the spreadsheet.� If you create a macro with the following four lines of code in it, the spreadsheet can run the refresh program on the AS/400 for the user and they need not go to the green screen.

The called program runs under QUSER, as most External Jobs do, but you can find the job by looking at the Job Threads of QUSER jobs. If the program has a message, it will need to be answered by the System Operator, as is the case with any Batch Job.

Code:

Set cn400 = CreateObject("ADODB.Connection") 

cn400.Open "Provider=IBMDA400;Data Source=(system name);", "", "" 

TempCommand = "{{CALL /QSYS.LIB/(library name).LIB/(program name).PGM}}" 

cn400.Execute TempCommand


 

This was first published in January 2001

Dig deeper on RPG iSeries programming

0 comments

Oldest 

Forgot Password?

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

Your password has been sent to:

SearchEnterpriseLinux

SearchDataCenter

Close