Newsletters   Subscriptions  Forums  Store   Career  Media Kit  About Us  Contact  Search   Home 
fhg
Volume 5, Number 33 -- August 31, 2005

Submit a Prompted Command to Batch


Hey, Ted:


If I put a question mark before a command name in a CL program and run the program interactively, the system prompts the command, allows me to fill in the blanks, and then executes the command. Is there a way to prompt the command, then send it to batch for execution?

--Mark


Yes, there's an API for this sort of thing. First, here's the type of code you're running interactively.
















? SAVOBJ
MONMSG     MSGID(CPF6801) EXEC(RETURN)

The system prompts the Save Object (SAVOBJ) command. If the user presses Enter, the system runs the command. However, if the user presses F3 or F12 to cancel the prompt, the Monitor Message command takes over.

If you want the command to run in batch, you need the QCMDCHK API. It is like the QCMDEXC API most of us are very familiar with in that it accepts the same parameters.

Here's an example that prompts a Save Object command and submits it to batch.

DCL        VAR(&CMD) TYPE(*CHAR) LEN(1024)
DCL        VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(1024)

CHGVAR     VAR(&CMD) VALUE('?SAVOBJ')
CALL       PGM(QCMDCHK) PARM(&CMD &CMDLEN)
MONMSG     MSGID(CPF6801) EXEC(RETURN)

SBMJOB     RQSDTA(&CMD)
SNDPGMMSG  MSG('Your command was submitted to batch.') +
           MSGTYPE(*COMP)

The &CMD variable is initialized to a prompted SAVOBJ command. Calling QCMDCHK causes the system to prompt the command and change the value of &CMD as modified by the user from the prompt screen.

After QCMDCHK runs, use Submit Job (SBMJOB) to start a batch job. Notice that the command is passed through the Request Data (RQSDTA) parameter, not the Command (CMD) parameter.

--Ted


Sponsored By
ADVANCED SYSTEMS CONCEPTS

SEQUEL can be used for virtually ALL data access functions on the iSeries.

A Windows-based user interface makes it easy to design queries and reports.

SEQUEL offers executive dashboards, drill-down data analysis and run-time prompts to deliver important iSeries data to managers and other non-technical users.

E-mail and FTP delivery let you deliver information to remote users and servers.

www.asc-iseries.com


Technical Editors: Howard Arner, Joe Hertvik, Ted Holt,
Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.


THIS ISSUE
SPONSORED BY:

T.L. Ashford
Advanced Systems Concepts
COMMON


Four Hundred Guru

BACK ISSUES

TABLE OF
CONTENTS
Let's See Those Command Parameters

Submit a Prompted Command to Batch

Admin Alert: Changing Your Mind When Loading Group PTFs


The Four Hundred
Taking the Pulse of the iSeries Base

Gartner Says Server Market Warmed Up Some More in Q2

IBM's Business Intelligence Plan Focuses on Partners, Middleware

The Source of All Good Bits

Four Hundred Stuff
Trustgenix and IdentityForge Put iSeries, zSeries at Center of SSO

IBM Buoys Workplace Development with New IDE

CabledSoft Delivers Graphical Cross Reference Tool for OS/400

DataMystic Provides iSeries Data Transformation Services

Four Hundred Monitor


Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc. (formerly Midrange Server), 50 Park Terrace East, Suite 8F, New York, NY 10034
Privacy Statement