Thanks in advance,
Jamie
There really is no limit for us.. I know the server admin ;)
In the future you need something changed just let me know...
Thanks for the DOC I will try to make sense of it.
Have a great weekend
Jamie
Helped me on this one
code to generate a table on the fly from SQLRPGLE
à *-------------------------------------------------------------------
à * CREATETBL - Create a table on the fly into QTEMP
à *
à * Had to create query over QSYS/QADBXFIL and extract my 5 fields
à * to a file called workfile.
à *-------------------------------------------------------------------
fWORKFILE if e k Disk rename(workfile:workfile2)
*
* Defined variables
*
d CmdString s 256
d CmdLength s 15 5
*
* Delete Work file incase it exists
*
c/Exec Sql
c+ DELETE FROM qtemp/somefile
c/End-Exec
*
* Create Work file in Qtemp
*
c/Exec Sql
c+ CREATE TABLE QTEMP/SOMEFILE (
c+ Filename Char (10) ,
c+ Library Char (10) ,
c+ Owner Char (10) ,
c+ Text Char (50) ,
c+ FileType Char (01)
c+ )
c/End-Exec
*
* File Description
*
c/Exec Sql
c+ LABEL ON TABLE QTEMP/SOMEFILE IS 'this is a junk file'
c/End-Exec
*
* Field examples only one field here TEXT and COLHDG
*
c/Exec Sql
c+ LABEL ON COLUMN QTEMP/SOMEFILE (FileName TEXT IS 'Test text')
c/End-Exec
c/Exec Sql
c+ LABEL ON COLUMN QTEMP/SOMEFILE(FileName IS 'Test column ')
c/End-Exec
c *start setll WORKFILE
c read WORKFILE
c dow not%eof(WORKFILE)
*
c/exec sql
c+ INSERT INTO QTEMP/SOMEFILE VALUES(:DBXFIL, :DBXLIB, :DBXOWN,
c+ :DBXTXT, :DBXTYP)
c/end-exec
*
c read WORKFILE
c enddo
*
c seton lr
*
I wish the weekends were longer......Not sure if I will have time this weekend to mess round with this.
Take care
Jamie
2nd - No, you don't need C-compiler, this is SQL. I usually run STRSQL or put it in a source member and run it with RUNSQLSTM.
But put the C/ EXEC SQL wrappers around it, and you can run it from inside an RPG pgm.
EDIT: Okay.. that's nasty looking.. and choice of attachments is limited... What's a good way to post something that big? There is a character limit on posts I belive, and I'm sure this one is over it.
I was supposed to execute command string for the qtemp file and I forgot to include that. I'll see what happens tomorrow when I get back to work and will post here whatever happens.
// create temporary tables in qtemp
#createTables();
************************************************** ********************
* procedure: #createTables *
* purpose: create temporary tables in qtemp *
************************************************** ********************
p #createTables b
d #createTables pi
* create table1
c/exec sql
c+ create table qtemp/epotable1 (
c+ upc char(12 ),
c+ voidDate decimal(8,0)
c+ )
c/end-exec
* create table2
c/exec sql
c+ create table qtemp/epotable2 (
c+ acct# char( 5 ),
c+ upc char(12 ),
c+ voidDate decimal(8,0),
c+ status char( 1 ),
c+ division char( 2 ),
c+ season char( 1 ),
c+ style char(12 ),
c+ color char( 3 ),
c+ size char( 3 ),
c+ retail decimal(7,2),
c+ price decimal(7,2),
c+ po# char(22 ),
c+ rcvDate decimal(8,0),
c+ lastPrint decimal(8,0)
c+ )
c/end-exec
p #createTables e
c+ CREATE TABLE QTEMP/TEMPRRD (
c+ Name Char (20) ,
c+ Address Char (40))
c/End-Exec
Ok, so this is only a small part of my program but basically this is my create statement for a temporary table named TEMPRRD. When I compile the program, the errors I get pretty much states that the file (TEMPRRD) does not exists and that the fields, naturally, does not exists as well. Based on the SQLRPGLE samples that I've seen, this create statement is what I only need to make a table on run-time.
Any hint on what I'm missing here?
There really is no limit for us.. I know the server admin ;)
In the future you need something changed just let me know...
Thanks for the DOC I will try to make sense of it.
Have a great weekend
Jamie
I tried to post it... this is the error I got: The text that you have entered is too long (83155 characters). Please shorten it to 40000 characters long.
#If you have any other info about this subject , Please add it free.# |
