ibm-midrange

db2_fetch_assoc() fails midway through iterating over result set

梦想的初衷 提交于 2019-12-11 03:22:21
问题 I'm running on IBM i (an AS/400) V7R2, PHP v5.6.5, Zend Server v8.0.2. I have a query which takes less than a second to execute from iNavigator. When I run the same query from a PHP script and then loop through it using: $numRows = 0; while ($row = db2_fetch_assoc($stmt)) { //Do stuff $numRows++; } echo $numRows++; $numRows ends up only being a fraction of the expected result set and I get this error in the Zend logs: PHP Warning: db2_fetch_assoc(): Fetch Failure in /path/to/script.php on

Date Arithmetic with SQL and DB2 for i

╄→尐↘猪︶ㄣ 提交于 2019-12-11 03:06:27
问题 I am trying to run a SQL query that will update information in a specific table. the problem I am running into is that I need the query to pull today's date, for whatever the date may be when the query is run, and then only pull records going back to years. I then want it to return an AVG of the CUR_CASH_UNITS over that two year time period. I have tried DATEDIFF and DATEADD and those do not appear to work with the system I have because it returns a *libl error. Here is what I have: Select

How to find MAX() value of character column?

為{幸葍}努か 提交于 2019-12-11 02:38:22
问题 We have legacy table where one of the columns part of composite key was manually filled with values: code ------ '001' '002' '099' etc. Now, we have feature request in which we must know MAX(code) in order to give user next possible value, in example case form above next value is '100'. We tried to experiment with this but we still can't find any reasonable explanation how DB2 engine calculates that MAX('001', '099', '576') is '576' MAX('099', '99', 'www') is '99' and so on. Any help or

Setting JT400 to connect to IBM i (AS400) using port 23

陌路散爱 提交于 2019-12-11 02:06:25
问题 I'm trying to connect to IBM midrange (AS400) machine from my java program and then reset a user's password. Using Jt400.jar, I manage to do so. But the problem is, I need to set the port to specificly use port 23. I want it to follow tn5250 on how it connect to AS400. From the IBM website here, I knew I can do so by using as400.connectToPort(23) . What confuses me, when I add that method, I got a java.lang.RuntimeException: java.lang.NegativeArraySizeException . I did try to search what's

Return records with only most recent TIME value?

孤街醉人 提交于 2019-12-11 01:12:32
问题 I have a table I need to do some data conversion on. It is a simple tracking table as outlined below: SSN 9,0 KEY (ex. 123456789) NON-NULL DATE 8,0 KEY (ex. 20131202) NON-NULL TIME 6,0 KEY (ex. 133000) NON-NULL PRINT_NEW Z (ex.2013-12-02-11.23.47.965000) (CURRENT_TIMESTAMP used) NON-NULL PRINT_OLD Z (ex. 2013-12-02-11.23.47.965000) (CURRENT_TIMESTAMP used) NULLABLE Previously I was inserting the current system time into the [TIME] field, however, what I should have been doing is inserting the

Inserting special characters in database with IBM.Data.DB2.ISeries provider

自古美人都是妖i 提交于 2019-12-10 23:49:35
问题 I've been having an issue with an app written in VB.Net that relies on an iSeries database. Users can save notes, which (very) often are copy/pasted from their mailbox. But many mails contain invalid characters that trigger iDb2ConversionException when the data is saved to the database. For the time being, I scrub the data, replacing invalid characters with matching html entities, but I really dislike that approach : I have to maintain a conversion list, and even though I managed to cover

AS/400 Message queue filtering - JT400 (JAVA)

十年热恋 提交于 2019-12-10 23:39:33
问题 I'm trying to get queue message list. I already did it using this code. problem is i want to filter it to *inq. this code retrive all messages. but i want to get *inq messages only. how to do it ? I was used "/qsys.lib/qsysopr.msgq" to get QSYSOPR message queue messages. I want to get all message queue's messages. So whats the exact queue path to get all message queue's messages. Thanks in Advance! try { AS400 system = new AS400(); MessageQueue queue = new MessageQueue(system, "/qsys.lib

How to obtain current isolation level on DB2?

ⅰ亾dé卋堺 提交于 2019-12-10 22:22:26
问题 I am trying to learn how transactions work in DB and to do this I wrote the following test SQL: SAVEPOINT STOP_HERE ON ROLLBACK RETAIN CURSORS; INSERT INTO TESTSCHEMA."test" (ID, NAME) VALUES (89898, 'SDFASDFASD'); ROLLBACK TO SAVEPOINT STOP_HERE; SELECT * FROM TESTSCHEMA."test"; After execution of this code the one row is added into the table. But if I add the following line at the beginning: SET TRANSACTION ISOLATION LEVEL READ COMMITTED; all work as I expected, i.e. transaction correctly

How can I read the liblist from within an ILE-Program? (preferably RPG or CL)

我的未来我决定 提交于 2019-12-10 21:20:48
问题 We control on what objects our programs on the as400 work, by running them with different liblists. But some operations cannot be directly controlled by this. Therefore, my program needs to read the liblist and decide on some of the libraries in it, how to act. I could not find any api to read the liblist entries from within a program. What I would expect, is some kind of api that lets me iterate through the liblist entries by priority or gives me an array with them in the order given by the

Adapting current socket server design to SSL (C++, GSK, spawnp())

强颜欢笑 提交于 2019-12-10 19:48:35
问题 This is probably a big fat 'no' but I have a current socket architecture that is 3-tiered. Tier 1 does nothing but set up the requisite steps in order to become a vanilla socket server and then sits in a loop forever calling accept(). When accept() returns successfully that now-open socket is passed via sendmsg() to a pool of tier-2 programs that grab the socket and begin reading the contents and saving the contents in a temp file. This tier-2 program then reads the initial data and