SQLRPGLE Questions


Dynamic operator on WHERE statement
I have a file that has 2-fields that will be used to select records from file B. File A, field 1 = date_a & field 2 = Operator. I want to select records from File B and based on the value within the operator ( EQ, LT, LE, GT, GE) and the date_a. Ex: If [...]

Answer Question   |  May 16, 2013  9:54 PM
iSeries, SQLRPGLE
asked by:
50 pts.

SQLRPGLE program executing at log off
I wrote a simple SQLRPGLE program. It accepts a “from” and “to” code, deletes all records with the “to” code, then copies all “from” records, replacing the “from” code with the “to” code. It runs fine, produces expected results. When I log off the session which ran the program, even hours later, it seems to [...]

Answer Question   |  April 9, 2013  4:31 PM
AS/400, SQLRPGLE
asked by:
20 pts.

RPG – Roll your own level breaks
Has anyone every heard of ‘Roll your own Level Breaks’ in RPG? Can you enlighten me on how it works? I have to mimic a program that does this already with a different set of data. Here is a basic overview of the application. A selection screen allows you to select a date range, region, [...]

Answer Question   |  March 19, 2013  9:04 PM
AS/400, RPG, SQLRPGLE
asked by:
1,380 pts.

SQLRPGLE
Please help. I am trying to execute the below code but the update doesn’t seems to be happening. DDATS E DS EXTNAME(PF1) C/EXEC SQL C+ DECLARE TESTC CURSOR FOR SELECT * FROM PF1 ORDER BY NUMBER C+ FOR UPDATE OF STATUS C/END-EXEC *OPEN the CURSOR C/EXEC SQL C+ OPEN TESTC C/END-EXEC C/EXEC SQL C+ FETCH [...]

Answer Question   |  February 15, 2013  2:04 AM
AS/400, SQLRPGLE
asked by:
190 pts.

Delete 72 hours old record from a file using SQLRPGLE
I have a file containing two fields…First one contains date with century and second one contains time in time stamp format. I want to delete 72 hours old record from this file using SQLRPGLE.

Answer Question   |  February 4, 2013  11:09 AM
AS/400, SQLRPGLE
asked by:
55 pts.

Cursor is returning previous values in SQLRPGLE
I have an SQLRPGLE program which accepts the SQL statement as an input parameter to the program from an RPGLE program. (The SQL is entered by user .) My intention is to validate the SQL and make a prepare statement out of it, and then initiates a Fetch Next from C1 into a :wSTR. Check [...]

Answer Question   |  February 1, 2013  5:10 AM
AS/400, SQLRPGLE
asked by:
1,955 pts.

Validate SQL and display the output
I have a screen where the user can enter an SQL script, I need to validate whether the SQL query is a valid one, if so then display the output on to the screen. I am planning to execute a SQL prepare statement out of the script entered and then use SQLCOD to determine whether [...]

Answer Question   |  January 29, 2013  8:14 AM
SQL Query, SQL scripts, SQLRPGLE
asked by:
1,955 pts.

Viewing stored procedure statements in AS/400
Hi, I created many stored procedures using STRSQL. And I called those procedures using SQLRPGLE program. It worked but I need to view those statements. I don’t know how to view stored procedure statements which was created using STRSQL. Can anybody help me?

Answer Question   |  January 22, 2013  10:26 AM
AS/400, SQLRPGLE, STRSQL
asked by:
270 pts.

SQLRPGLE- Query Not fetching records in program
Hi I have below query in my program , when i executed it interactively thro strsql , its fetching records but the same query is not fetching records when i execute it in my program. Please provide your valuable answers as soon as possible.. as i need it very urgently… As si mentioned it has [...]

Answer Question   |  January 17, 2013  7:28 AM
AS/400, i series, IBM, SQLRPGLE
asked by:
95 pts.

SQLRPGLE
what is the difference to update a file using rpgle/ sqlrpgle program?

Answer Question   |  November 20, 2012  5:42 AM
SQLRPGLE
asked by:
55 pts.

Using cursor in SQLRPGLE
Can i use single cursor for multiple SQL statements? ex:  declare c1 cursor for select * from ……. also declare c1 cursor for select * from xxx

Answer Question   |  October 10, 2012  11:37 AM
SQL statement, SQLRPGLE
asked by:
40 pts.

SQLRPGLE producing invalid output
I’ve got an SQLRPGLE program used to determine, among other things, whether data in one file member does or does not exist – if data exists in the current version but not in the previous a record is written to a transaction file. Thing is, I’m getting multiple records being written even though the data [...]

Answer Question   |  September 7, 2012  3:08 PM
iSeries AS/400, SQLRPGLE, V6R1
asked by:
5,670 pts.

How to acheive FULL OUTER JOIN on three files in IN SQLRPGLE program.
Hi, I have 3 seperate files called Duty, Freight and Brokerage and i need to process all the records from all the three files into one output file based on key values matching across all the files, if i dont find the match in anyother two files then i need to populate coresponding fields with Zeroes. [...]

Answer Question   |  May 22, 2012  3:50 PM
as400/DB2, SQL/400, SQLRPGLE
asked by:
695 pts.

how to write more than one sql statement under EXEC SQL in SQLRPGLE.
Hi, Can anyone please help me to write more than one SQL statements under single EXEC SQL and END EXEC as below. Since i have 10 sql statements and wanted to include all those 10 statements under single block of EXEC SQL and END EXEC by using any seperator like below. C/EXEC SQL C+Insert into [...]

Answer Question   |  March 26, 2012  7:52 PM
as400/DB2, SQLRPGLE
asked by:
695 pts.

Can not able to declare character field with the length of 6000 in SQLRPGLE program.
Hi, I am declaring a stand alone character field with the length of 6000 in my SQLRPGLE program, but when i debug the program to see the the values in this character field i could find only 1024 length is allocated for this field. Could anyone please help me urgently to declare a character field [...]

Answer Question   |  March 26, 2012  9:30 PM
AS/400, RPG ILE, SQLRPGLE
asked by:
695 pts.

sqlrpgle-6
query to find n’th Highest salary in a file?

Answer Question   |  March 17, 2012  6:56 AM
AS/400, SQLRPGLE
asked by:
275 pts.

Cursor
Hi, I have posted my SQLRPGLE program, output is not showing down,what mistake i did in my program,please correct it, FMA01F     IF   E           K DISK    FMA01FTES  IF A E    K DISK   RENAME(RMA01F:REMA01F) PREFIX(P_)   D COMNO           S              3  0        D SHPNO           S              5  0   D ITMNO           S             15A   D TOTAL           S              7  2    D COUNT           S              2  0       [...]

Answer Question   |  March 17, 2012  7:26 AM
AS 400, SQLRPGLE
asked by:
510 pts.

Sqlrpgle
I have two pf are PF1 & PF2. PF1 has 100 records & PF2 has 90 records.how to i find the unmatched records ? PF1 Fields are typ1,typ2 Pf2 Fields are Typ3 ,typ2. plz guide me…..

Answer Question   |  March 19, 2012  5:25 AM
SQLRPGLE
asked by:
275 pts.

SQLCODE 30 on fetch SQLRPGLE
Hello All,  I’m trying to execute a fetch into DS on a SQL statement and keep getting code 30: Number of host variables less than result values. The DS and SELECT statement both have the same number of values as far as I can see.  Here’s the DS and select fields code: D ClaimRecDS     [...]

Answer Question   |  March 17, 2012  9:09 PM
coalesce, NULL values, SQL, SQLRPGLE
asked by:
465 pts.

Files-Sqlrpgle
******************************************************** C                   READ      OUTSRC               C                   EVAL      MBR  = mlname         C/EXEC SQL                                         C+ SELECT * FROM LIB/:MBR                          C/END-EXEC                                        ********************************************************* In above code MBR contains the file name. Is it possible to have Host variable for FILE NAME in above query?? In that above code Host variable for File name is not working… plz guide me [...]

Answer Question   |  March 17, 2012  5:40 AM
SQLRPGLE
asked by:
275 pts.