Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschoen authored Feb 7, 2025
1 parent 1494746 commit 58ce924
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -691,11 +691,11 @@ The following example queries all the records from table QIWS/QCUSCTDT and place

**SQL** - Enter an SQL SELECT statement to query some specific data.

**PARMS** - SQL placeholder parameter names. Enter up to 30 parameter placeholder values you want to replace dynamiclly in your SQL statements at runtime. These are not required if you don't want to dynamic parameter replacement.
**PARMS** - SQL placeholder parameter names. Enter up to 30 parameter placeholder values you want to replace dynamically in your SQL statements at runtime. These are not required if you don't want to dynamic parameter replacement.

Ex: ```@@LIB``` for library or ```@@FILE``` for file.

**PARMVALS** - SQL parameter replacement values. Enter up to 30 replacement values you want to replace dynamiclly in your SQL statements at runtime. These values correspond with each placeholder value you set in the list of PARMS. These are not required if you don't want to dynamic parameter replacement.
**PARMVALS** - SQL parameter replacement values. Enter up to 30 replacement values you want to replace dynamically in your SQL statements at runtime. These values correspond with each placeholder value you set in the list of PARMS. These are not required if you don't want to dynamic parameter replacement.

Ex: ```QIWS``` for library or ```QCUSTCDT``` for file.

Expand All @@ -711,6 +711,58 @@ Ex: ```QIWS``` for library or ```QCUSTCDT``` for file.

**IDCOLNAME** - This parameter will allow naming of the new identify column if one is added. Default is ```RECID```.

Note: The following data areas are auto-created in the current job library QTEMP to track resulting query info. You can retreive a resulting record count or the name of the outfile to check for existence in case it didn't get created for some reason such as query failure.
```
SQLQRYCNT - Query result record count.
SQLQRYFIL - Output file created by the query.
SQLQRYLIB - Output file library for the file created by the query.
```
# Using the QSHQRYSRC CL command to run a SELECT query and output the results to an OUTFILE.

The command returns a CPF9898 excape message on error. Otherwise a CPF9898 completion message.

The following example queries all the records from table QIWS/QCUSCTDT and places the result in to an output table named: SQLTMP0001 in library QTEMP. It also replaces the selected placeholder parameters values in the SQL query that gets read from the source file.

```
QSHQRYSRC SQLLOC(*SRCMBR)
SRCFILE(QSHONI/SOURCE)
SRCMBR(SQLTEST3)
PARMS(@@LIB @@file)
PARMVALS(qiws qcustcdt)
```

# QSHQRYSRC command parms

**Overview** - This CL command is a convenience command that can be used to run an SQL data selection query and create an outfile of resulting data. Instead of an SQL input statemment parameter, the query pulls SQL source from a source member or IFS file member.

**SQLLOC** - Thie parameter determines if the SQL query is sourced from a source member or an IFS file. Default is *SRCMBR.

**SRCFILE** - This parameter holds the source file information if the query is sourced from a source member.

**SRCMBR** - This parameter holds the source member name for the selected source file if the query is sourced from a source member.

**PARMS** - SQL placeholder parameter names. Enter up to 30 parameter placeholder values you want to replace dynamically in your SQL statements at runtime. These are not required if you don't want to dynamic parameter replacement.

Ex: ```@@LIB``` for library or ```@@FILE``` for file.

**PARMVALS** - SQL parameter replacement values. Enter up to 30 replacement values you want to replace dynamically in your SQL statements at runtime. These values correspond with each placeholder value you set in the list of PARMS. These are not required if you don't want to dynamic parameter replacement.

Ex: ```QIWS``` for library or ```QCUSTCDT``` for file.

**OUTFILE** - This is the output file/table where data gets selected in to via an SQL query. The table will get automatically created as a result of the query if it doesn't exist.

**EMPTYERROR** - This parameter determines whether a CPF9898 escape message is thrown if no records were selected by the query. *YES - Throw an escape message if no records. *NO - Don't throw an error if no records selected. Default - *YES

**NAMING** - This parameter determines whether SQL format your queries are using. *SYS or *SQL.

**PROMPT** - This parameter will interactively prompt the RUNSQL statement if desired. Only use this parameter in an interactive 5250 session. *YES - Prompt for RUNSQL command. *NO - Do not prompt for RUNSQL. Default - *NO

**CRTIDCOL** - This parameter will allow adding of a unique identity column to your outfile table after it's created. Specify *YES to add a unique identifier to your table. Default is *NO.

**IDCOLNAME** - This parameter will allow naming of the new identify column if one is added. Default is ```RECID```.

**DLTTMPSRC** - This parameter determines if the temporary source member TMPQRYSRC created in temporary source file QTEMP/TMPQRYSRC gets deleted after query processing.

Note: The following data areas are auto-created in the current job library QTEMP to track resulting query info. You can retreive a resulting record count or the name of the outfile to check for existence in case it didn't get created for some reason such as query failure.
```
SQLQRYCNT - Query result record count.
Expand Down

0 comments on commit 58ce924

Please sign in to comment.