Question

  Asked: Jun 27 2008   1:23 AM GMT
  Asked by: Jacky


to run a batch file in i5/OS


Batch files, Scripts, OS/400, i5

how to run a batch file or a script file in i5/OS.
How to create file with extension .sql and run the same in i5/OS

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0




Hi,

If you store your SQL statements in a source file, you can use the RUNSQLSTM command to execute the source file as an SQL script.

Regards,

Martin Gilbert.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Microsoft Windows, Development and AS/400.

Looking for relevant Microsoft Windows Whitepapers? Visit the SearchEnterpriseDesktop.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Koohiisan  |   Jun 27 2008  2:06PM GMT

Don’t forget REXX for scripting also. You’ll have to create a plain source member with REXX commands and use STRREXPRC to run it.

 

Jacky  |   Jun 28 2008  1:05AM GMT

can u tell me how to create a sql file in i5/Os.
I didn’t know what is rexx

 

Gilly400  |   Jun 30 2008  9:04AM GMT

Hi,

If you mean a script for SQL, you can do the following (assuming you have a library called Yourlib, you can create a library using the command CRTLIB) :-

CRTSRCPF FILE(Yourlib/QSQLSRC)
/* This creates a source physical file, which can contain source members (in your case SQL scripts) */

WRKMBRPDM Yourlib/QSQLSRC
/* This should give you an empty list of source members */

Press F6 (Create) to add a source member, give it a name and description, the source member type isn't important for an SQL script, but you could use SQL so you know it's an SQL script */

You should now be in the SEU editor. Type in your SQL commands here and press F3 to exit and save when you're done.

Here’s a useful link for learning AS400/i5

Best regards,

Martin Gilbert.

 

Jacky  |   Jul 8 2008  10:33AM GMT

Thanks for your guidance.
i am able to create and execute a sql script.
But i am not able to have more than one sql statement in my source file.
Can you please help me in this scenario

 

BigKat  |   Jul 8 2008  2:11PM GMT

don’t forget to end each statement with a ;

 

Jacky  |   Jul 9 2008  9:09AM GMT

ya i ended with a semicolon but still it doesn’t work for more than one sql

 

Gilly400  |   Jul 9 2008  12:32PM GMT

Hi,

It should work, can you post an example of what you’re trying to do?

Regards,

Martin.

 

Jacky  |   Jul 10 2008  7:05AM GMT

ya it works fine, I made a mistake and i found it. thank you very much.