to run a batch file in i5/OS

160 pts.
Tags:
Batch files
i5
OS/400
Scripts
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

Answer Wiki

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

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.

Discuss This Question: 8  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
  • Koohiisan
    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.
    5,020 pointsBadges:
    report
  • Jacky
    can u tell me how to create a sql file in i5/Os. I didn't know what is rexx
    160 pointsBadges:
    report
  • Gilly400
    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.
    23,730 pointsBadges:
    report
  • Jacky
    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
    160 pointsBadges:
    report
  • BigKat
    don't forget to end each statement with a ;
    8,060 pointsBadges:
    report
  • Jacky
    ya i ended with a semicolon but still it doesn't work for more than one sql
    160 pointsBadges:
    report
  • Gilly400
    Hi, It should work, can you post an example of what you're trying to do? Regards, Martin.
    23,730 pointsBadges:
    report
  • Jacky
    ya it works fine, I made a mistake and i found it. thank you very much.
    160 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