|
Hi Sudha, This Could work Step 1) Select * From EMPPF where EMPNO > 1000 EMPLOYEE EMPLOYEE NUMBER NAME 1,001 Sadiq1 1,002 Sadiq2 Step 2) Copy book / member DSMBR looks like this 0001.00 DEMPDS E Ds EXTNAME(EMPPF) 0002.00 D Prefix(S_) INZ Step 3) Main Program RPGLE SQLFETCH looks like this 0001.00 FQsysprt O F 132 Printer 0002.00 * 0003.00 D/Copy Source,DsMbr 0004.00 0005.00 C/EXEC SQL 0006.00 C+ DECLARE SQLCSR CURSOR FOR SELECT EMPNO, EMPNA FROM EMPPF WHERE + 0007.00 C+ EMPNO > 1000 0008.00 C/END-EXEC 0009.00 * 0010.00 C/EXEC SQL 0011.00 C+ open SqlCsr 0012.00 C/END-EXEC 0013.00 * 0014.00 C EXCEPT Header 0015.00 * 0016.00 C SQLCOD DoUNe 0 0017.00 * 0018.00 C/EXEC SQL 0019.00 C+ FETCH FROM SqlCsr 0020.00 C+ Into :EMPDS 0021.00 C/END-EXEC 0022.00 * 0023.00 C IF SQLCOD = 100 0024.00 C Leave 0025.00 C EndIf 0026.00 * 0027.00 C EXCEPT Details 0028.00 * 0029.00 C Enddo 0030.00 * 0031.00 C/EXEC SQL 0032.00 C+ Close SqlCsr 0034.00 * 0035.00 * 0036.00 C Eval *Inlr = *On 0037.00 * 0038.00 OQsysprt E Header 0039.00 O 45 'Employee Details' 0040.00 O E Details 0041.00 O S_EMPNO 6 0042.00 O S_EMPNA 20 Step 4) Call the program and Execute WRKSPLF command The spool file QSYSPRT looks like this Employee Details 1001 Sadiq1 1002 Sadiq2 Step 5) Compare the above result with Step 1 query , both resulted two records Hence we can say that the program got executed successfully with out failure Thanks Sadiq .. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of SRamanujan@xxxxxxxxxxxxxxxxxx Sent: Friday, February 11, 2005 8:36 PM To: rpg400-l@xxxxxxxxxxxx Subject: RE: sqlrpgle & copy book Thanks Birgitta, We are on v5r3, I have a simple non qualified ds and I don't have nested ds either. Something like below and it does not compile. Once I put the DS within the sqlrpgle, it works. Thanks, Sudha Rpgle.myds dfieldDs ds d field1 5a d field2 15p 2 d field3 30a sqlrpgle : /copy rpgle,myds * d myDsNullI ds d based(myDsNullAd) d myNullAry 5i 0 dim(21) c/exec sql declare c cursor for select * from filea for read only c/end-exec c/exec sql open c c/end-exec c/exec sql fetch next from c into :fields :myNullAry c/end-exec c/exec sql close c c/end-exec Sudha Ramanujan SunGard Futures Systems sramanujan@xxxxxxxxxxxxxxxxxx (312) 577 6179 (312) 577 6101 - Fax -----Original Message----- From: HauserSSS [mailto:Hauser@xxxxxxxxxxxxxxx] Sent: Friday, February 11, 2005 12:11 AM To: RPG programming on the AS400 / iSeries Subject: AW: sqlrpgle & copy book Hi Sudha, do you use a qualified data structure or is the data structure defined in a nested data structure. If so, you must be on release VR3M0 to get it to work. Before Release V5R2M0 you have to define a non qualified data structure. If you don't use nested copy books, the data structure can be defined in a copy book. Birgitta -----Ursprungliche Nachricht----- Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von SRamanujan@xxxxxxxxxxxxxxxxxx Gesendet: Donnerstag, 10. Februar 2005 23:32 An: rpg400-l@xxxxxxxxxxxx Betreff: sqlrpgle & copy book Hi all, When I have a copy book that has the data structure, and fetch into the ds, I get a sql pre-compiler error SQL0312 'The DSNAME is not define or not usable' Is there anyway to avoid this? Thanks, Sudha Sudha Ramanujan SunGard Futures Systems sramanujan@xxxxxxxxxxxxxxxxxx (312) 577 6179 (312) 577 6101 - Fax -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.