Hello everyone,
I’m having an issue with a BTEQ script. The objective of the script is to:
- Perform a SELECT on DBC.Databases for DatabaseName; this generates a list of all of our databases on that TPDID.
- Export that list of names to a file.
- Call the database names from that file as inputs to a macro called ShowDatabase.
- The macro is supposed to generate the DDL, list of roles/users with privileges on the database and their privs based upon being supplied the DatabaseName.
- Export all of this info for each database to a second file.
Here is the BTEQ script:
.logon <node IP address>/<myusername>,<mypassword>;
.export report file=c:\bteq\dbnames.txt;
SELECT DatabaseName (TITLE '') FROM "DBC".Databases;
.export reset;
.export report file=c:\bteq\dbdefs.txt;
.import report file=c:\bteq\dbnames.txt;
Using (DatabaseName varchar(30))
EXECUTE DBADMIN.ShowDatabase (:DatabaseName);
.Repeat *;
.export reset;
.quit;
The script errors after the EXECUTE statement; the messaging is:
***Growing buffer to 65473
***Failure 2673 The source parcel length does not match data that was defined.
Now the DatabaseName field in DBC.Databases is derived from DBC.Dbase. In Dbase, the field is a varchar (128); the DBC.Databases view CASTS the field as char (30). The ShowDatabase macro sets the DatabaseName as a varchar (30), as shown from the first few lines of the macro below:
CREATE MACRO DBADMIN.ShowDatabase (
DatabaseName VARCHAR(30)
)
AS
(
SELECT
'CREATE DATABASE '
|| TRIM(DatabaseName)
I have tried changing the USING statement in the BTEQ script to call DatabaseName as a char(30) and as a varchar (128). This yielded no different result. I also tried SELECTING directly from DBC.Dbase instead of DBC.Databases; this also resulted in no change to the error.
Any and all help on this would be greatly appreciated. Thanks!