DB2 for z/OS - REXX for inserting rows with a VARCHAR

Charlie Kondo

DB2 for z/OS - REXX for inserting rows with a VARCHAR
I am looking for a sample REXX to insert rows that has two VARCHARs at
the end of the row colX(150) and colY(500). I've tried using host
variables with parameter markers, SQLDA but am doing something wrong
obviously. If anyone has a sample of a REXX or knows the trick to change
it from a literal string so that I can get around the -102 error would
be greatly appreciated.


---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm

Matthew Rhea

Re: DB2 for z/OS - REXX for inserting rows with a VARCHAR
(in response to Charlie Kondo)
Here's an example that I use.

Table definition:

COLUMN NAME TYPE(LEN)
------------------ ---------------
DB2_SUBSYSTEM CHAR(4)
ACTIVITY CHAR(8)
USERID CHAR(8)
TABSCHEMA VARCHAR(24)
TABNAME VARCHAR(128)
ACTIVITY_TS TIMESTMP
ACTIVITY_TS_CHAR CHAR(26)

REXX excerpt:

insertstmt = 'INSERT INTO DBA1.DBAUDIT (DB2_SUBSYSTEM, ACTIVITY,USERID,',
'TABSCHEMA, TABNAME, ACTIVITY_TS, CTIVITY_TS_CHAR)',
'VALUES ?, ?, ?, ?, ?, ?, ?)'

"EXECSQL PREPARE S2 FROM :insertstmt"


Address DSNREXX ,
"EXECSQL EXECUTE S2 USING :db2.j, :type.j, :authid.j,",
":database.j, :table_name.j, :timestamp.j, :timestamp.j"

HTH,
Matthew

On Wed, 18 Jan 2006 13:10:58 -0800, Kondo, Charles
<[login to unmask email]> wrote:

>I am looking for a sample REXX to insert rows that has two VARCHARs at
>the end of the row colX(150) and colY(500). I've tried using host
>variables with parameter markers, SQLDA but am doing something wrong
>obviously. If anyone has a sample of a REXX or knows the trick to change
>it from a literal string so that I can get around the -102 error would
>be greatly appreciated.
>
>
>--------------------------------------------------------------------------
-------
>Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and
home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page
select "Join or Leave the list". The IDUG DB2-L FAQ is at
http://www.idugdb2-l.org. The IDUG List Admins can be reached at DB2-L-
[login to unmask email] Find out the latest on IDUG conferences at
http://conferences.idug.org/index.cfm
>

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm