Tip

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.