YEXCSQL (Execute SQL Statements) Command

The Execute SQL statements (YEXCSQL) command prepares and executes SQL/400 statements that are contained in a source file member.
ca2e87
The Execute SQL statements (YEXCSQL) command prepares and executes SQL/400 statements that are contained in a source file member.
Contents
Earlier, YEXCSQL worked only for the target object library being an SQL collection. But now, the target object library can be either an SQL collection or a normal library (non-SQL collection).
If an SQL collection is specified as the target object library, the tables, indexes, and views are created in the specified SQL collection, as before. If a normal library is specified as the target object library, the tables, views and indexes are created in that library but are not journaled. While the tables, views, and indexes are being created, you may receive warning messages that the library is a non-SQL collection and that the tables/views/indexes are not journaled. These messages can be ignored for generation purposes.
Warning: If a non-SQL Collection/Library is used as a target object library, then the tables/views/indexes created in it are not journaled automatically.
Required
YEXCSQL-Required
Optional
YEXCSQL-Optional YEXCSQL-Optional YEXCSQL-Optional YEXCSQL-Optional
Parameters
The following are parameters for the YEXCSQL command.
OBJLIB
Target library in which to place the SQL statements. This can either be an SQL Collection or a Library. Values for these parameters are as follows:
  • *CURLIB
    -- (default) Use current library for invoking job.
  • library name
    -- Specific library name.
SRCFILE
Qualified name of file from which SQL statements are processed. Values for these parameters are as follows:
  • *LIBL
    -- (default) Libraries named in the job library list to be processed.
  • *CURLIB
    -- Current library for the job to be processed.
  • library name
    -- Specific library name.
  • QSQLRSRC
    -- (default) SQL statements are in the QSQLRSRC source file.
  • source file name
    -- Specific name of source file containing the SQL statements.
MBR
Member name of source file to be executed. Values for these parameters are as follows:
  • *FIRST
    -- (default) Use first member in source file.
  • member name
    -- Name of specific member in source file.
NAMING
Naming convention used for naming the objects in SQL statements. Values for these parameters are as follows:
  • *SQL
    -- (default) Use SQL naming convention (collection-name.table-name).
  • *SYS
    -- Use system naming convention (library-name/file-name).
Example
To apply SQL/400 statements, stored in file QSQLSRC, to SQL/400 collection, MYLIB:
YEXCSQL OBJLIB(MYLIB) SRCFILE(QSQLSRC)