|
Pete, I'm not exactly sure what you mean by 'work with' but I have embedded SQL into several programs where I use /FREE. You can't place the /EXEC directive inside the /FREE /END-FREE directives. I have enclosed 2 samples from actual programs below. Example 1: /Free isoDate = %Date(); chrDate = %Char(isoDate :*ISO0); oichdt = %Dec(chrDate :8 :0); usatime = %Time(); chrTime = %Char(usaTime :*HMS0); oichtm = %Dec(chrTime :6 :0); oichgu = sds_User; /End-Free c/EXEC SQL c+ insert into lspoid c+ (select oiid#, oiconm, left(contact, locate(' ', contact) - 1), c+ substr(rtrim(contact), locate(' ', contact) + 1, c+ length(rtrim(contact)) - locate(' ', contact)), c+ oiph#, :oich10, :oich25, :oinu70, :oinu72, :oinu13, :oichgu, c+ :oichdt, :oichtm c+ from lspoidxl) c/END-EXEC c Eval *InLR = *On Example 2: * Declare cursor for SQL statement c/Exec SQL c+ Declare C1 Cursor for c+ Select mmCty, mmNote, mmName, mmAdr1, mmAdr2, mmAdr3, mmAdr4, mmAdr5, c+ mmZip, mmZip2, mmLast, mmFrst c+ From LNMMAD c+ Where MMMGID = :pMgID c+ Order by MMCTY, MMZIP, MMZIP2, MMLAST, MMFRST c/End-Exec * Open cursor c/Exec SQL c+ Open C1 c/End-Exec * Retrieve first record c/Exec SQL c+ Fetch from C1 for :NbrRows rows into :sqlRecord c/End-Exec /Free Select; // Fetch returned an empty set When SQLStt = '02000'; // Fetch returned a good record set When SQLStt = '00000'; // Fetch records until end of file DoW SQLStt = '00000'; // Read through returned records For RowCnt = 1 to SQLER3 by 1; . . . // Move to next record sqlRecord@ = sqlRecord@ + %Size(sqlRecord); EndFor; // If end of table reached exit loop If SQLER5 = 100; Leave; EndIf; // Reset to beginning of data structure sqlRecord@ = sqlMem@; /End-Free * Retrieve next record c/Exec SQL c+ Fetch from C1 for :NbrRows rows into :sqlRecord c/End-Exec /Free EndDo; // SQLStt = '00000' . . . /End-Free HTH, Rick -----Original Message----- From: Pete Hall [mailto:pbhall@ameritech.net] Sent: Wednesday, January 22, 2003 8:43 PM To: midrange-l@midrange.com Subject: SQLRPGLE Free Has anybody been successful in getting the /FREE directive to work with embedded SQL? Pete Hall pbhall@ameritech.net http://www.pbhall.us/ _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo.cgi/midrange-l or email: MIDRANGE-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-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.