|
Hi Brian You're using a READ and not a READE. With the READE you specify the key that you want to use to read the file against and therefore limit the records you get back: Read(e) QRLKEY SSTO5A7 All the best Jonathan -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Brian Piotrowski Sent: 12 January 2007 17:16 To: RPG programming on the AS400 / iSeries Subject: 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.