Querys

5 pts.
Tags:
AS/400
Hi! My question is how can I run current AS/400 query's in batch automatically. They have been created already but they are so many that the operator takes a long time running them. Is there a procedure or a program that can do this at AS/400 level? Thanks.

Answer Wiki

Thanks. We'll let you know when a new response is added.

The easiest way to do this is to encapsulate the queries in a C or RPG program, using EXEC SQL:

C:

EXEC SQL first query;
EXEC SQL second query;

RPG:

C/EXEC SQL
C+ first query
C/END EXEC
C/EXEC SQL
C+ second query
C/END EXEC

/s/Sheldon Linker
mailto:sol@linker.com
Linker Systems, Inc.

http://www.linkersystems.com

800-315-1174
+1-949-552-1904 from outside of North America

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

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
  • JPLamontre
    Queries ... Do you build *QMQRY objects ? if yes, build a CLP where you add one after the other STRQMQRY commands, that's all. Do you only prepare some SQL sentences ? insert them in a source member them run them with RUNSQLSTM or EXECUTESQL (http://jplamontre.free.fr/AS400/EXECUTESQL.htm) Have a look at http://search400.techtarget.com/ITKnowledgeExchange/viewMessage/0,294934,sid3_gci1123469,00.html#966798 the question is long but there is some differents approachs in the answers
    0 pointsBadges:
    report
  • Ddune3566
    They can be called from a CLP program. You can also do a dspobjd to an outfile. You then read that outfile in a loop in a clp PGM DCLF FILE(REGADMIN/RGADMINQRY) DSPOBJD OBJ(REGADMIN/AD*) OBJTYPE(*QRYDFN) + OUTPUT(*OUTFILE) OUTFILE(REGADMIN/RGADQRYOBJ) RUNQRY QRY(REGADMIN/RGADMINQRY) /* sorts queries alphabetically to insure they run in the right order outputs to a file (REGADMIN/RGADMINQRY) LOOP:RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) EOF RUNQRY QRY(&LIBRARY/&QUERY) GOTO CMDLBL(LOOP) END: ENDPGM
    0 pointsBadges:
    report
  • ClarkSysCoord
    I set ours up to run in the job scheduler - WRKJOBSCDE. You can preset the days, times, etc., and have them submit to batch.
    0 pointsBadges:
    report
  • LITTLELINDA
    I accomplished this by creating a CL program then specifying which queries to run, designating the printer to run to and the number of copies to print. I used WRKJOBSCDE to schedule the CL program to run at specific times, primarily off hours ( ie. 3:00 - 5:00 am) This really cuts down on operator time. Hope this helps. Melinda
    0 pointsBadges:
    report

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

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

Thanks! We'll email you when relevant content is added and updated.

Following