|
Hi, You have to READE instead of a simple READ, if you only want to read the rows with the specified key! Another way is to use READ and check manually if your key fields match. If there is no match you have to leave the loop. Mit freundlichen Grüßen / Best regards Birgitta Hauser "Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown) "If you think education is expensive, try ignorance." (Derek Bok) -----Ursprüngliche Nachricht----- Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von Brian Piotrowski Gesendet: Friday, January 12, 2007 18:16 An: RPG programming on the AS400 / iSeries Betreff: SetLLs and Logical File Issues Hi List, I'm having a Friday afternoon brain cramp, and I'm wondering if someone can offer advice? I have a logical file composed of three fields (SST05A7): RAPLCD (Plant Code) RAQRL (Quick Receive Serial Number) RACSN (Serial Number) I have a key (QRLKEY) defined in my program as: PLCD (Plant Code) QRLNO (Quick Receive Serial Number) When I use the SQL interpreter and check a specific QRL number and plant code against the logical file, I get back 13 records. However, when I run the following code, I get back the 13 records plus a whole bunch of other records that are not associated with the same QRL. Anyone have any ideas where I am going wrong, I'd appreciate some comments. Code snippet is to follow. Thanks! /// if LABELTYPE = 'QRL'; setll QRLKEY sst05a7; if not %eof(sst05a7); read sst05a7; DoW not %eof(sst05a7); /end-free C* Get the current part name C/Exec SQL C+ Select PNPTNM, PNSUPP, PNSPLC into C+ :partname, :suppnum, :supploc from ssm05 C+ where pnplcd = :raplcd and pnptno = :raptno C+ and pnptcl = :raptcl C/End-exec C* /free If SQLCod = 100; partname = ''; suppnum = ''; supploc = ''; endif; select; when stockloc = 'P1'; SSTOCKLOC='1'; when stockloc = 'P2'; SSTOCKLOC='2'; when stockloc = 'QC'; SSTOCKLOC='C'; when stockloc = 'TR'; SSTOCKLOC = 'T'; endsl; serialno = racsn; osdatein = %timestamp; osdateout = *loval; write oss_fmt; read sst05a7; ENDDO; /end-free C* C* Add the location to SST05 C/Exec SQL C+ UPDATE SST05a4 set RASF01=:SSTOCKLOC C+ where raplcd = :plcd C+ and raqrl = :QRLNO C/End-exec C* /free ENDIF; /// /b; -=-=-=-=-=-=-=-=-=-=-=-=-=- Brian Piotrowski Assistant Mgr. - I.T. Simcoe Parts Service, Inc. Ph: 705-435-7814 x343 Fx: 705-435-6746 -=-=-=-=-=-=-=-=-=-=-=-=-=-
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.