ibm-midrange

Why am I getting a “[SQL0802] Data conversion of data mapping error” exception?

只愿长相守 提交于 2019-11-26 22:02:25
问题 I am not very familiar with iseries/DB2. However, I work on a website that uses it as its primary database. A new column was recently added to an existing table. When I view it via AS400, I see the following data type: Type: S Length: 9 Dec: 2 This tells me it's a numeric field with 6 digits before the decimal point, and 2 digits after the decimal point. When I query the data with a simple SELECT ( SELECT MYCOL FROM MYTABLE ), I get back all the records without a problem. However, when I try

Create a delimitted string from a query in DB2

别说谁变了你拦得住时间么 提交于 2019-11-26 16:32:25
问题 I am trying to create a delimitted string from the results of a query in DB2 on the iSeries (AS/400). I've done this in T-SQL, but can't find a way to do it here. Here is my code in T-SQL. I'm looking for an equivelant in DB2. DECLARE @a VARCHAR(1000) SELECT @a = COALESCE(@a + ', ' + [Description], [Description]) FROM AP.Checkbooks SELECT @a If the descriptions in my table look like this: Desc 1 Desc 2 Desc 3 Then it will return this: Desc 1, Desc 2, Desc 3 回答1: Essentially you're looking for

Equivalent of LIMIT for DB2

怎甘沉沦 提交于 2019-11-26 12:09:43
问题 How do you do LIMIT in DB2 for iSeries? I have a table with more than 50,000 records and I want to return records 0 to 10,000, and records 10,000 to 20,000. I know in SQL you write LIMIT 0,10000 at the end of the query for 0 to 10,000 and LIMIT 10000,10000 at the end of the query for 10000 to 20,000 So, how is this done in DB2? Whats the code and syntax? (full query example is appreciated) 回答1: Using FETCH FIRST [n] ROWS ONLY : http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp

How to make SendKeys act Synchronously in IBM Host Access Library

醉酒当歌 提交于 2019-11-26 10:03:07
问题 I use the IBM Host Access Class Library for COM Automation as a way to communicate with an IBM AS400 (aka iSeries, IBM i, green screen, 5250) through a terminal emulator. I notice that when you issue a \"SendKeys\" instruction, control returns to your application before the IBM emulator finishes with the command. This can lead to timing problems because you might then send another \"SendKeys\" instruction before the system is ready to accept it. For example: Imports AutPSTypeLibrary Imports

Convert String from ASCII to EBCDIC in Java?

自作多情 提交于 2019-11-26 09:39:52
问题 I need to write a \'simple\' util to convert from ASCII to EBCDIC? The Ascii is coming from Java, Web and going to an AS400. I\'ve had a google around, can\'t seem to find a easy solution (maybe coz there isn\'t one :( ). I was hoping for an opensource util or paid for util that has already been written. Like this maybe? Converter.convertToAscii(String textFromAS400) Converter.convertToEBCDIC(String textFromJava) Thanks, Scott 回答1: JTOpen, IBM's open source version of their Java toolbox has a