× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Yuriy,


If that is *all* that you did, you did not fix the problem. The (E) op-code extender merely replaces resulting indicator 2, and allows one to code an error routine using the %error( ) bif. Putting the (E) extender just masked any error your program had which, as Tommy pointed out, has a few anomalies.


        * Jerry C. Adams
*IBM System i Programmer/Analyst
B&W Wholesale Distributors, Inc.* *
voice
        615.995.7024
fax
        615.995.1201
email
        jerry@xxxxxxxxxxxxxxx <mailto:jerry@xxxxxxxxxxxxxxx>



Yuriy Veletnik wrote:

Thanks I just changed to UPDATE(E) and it processed file

Yuriy Veletnik
AS/400 Administrator
Trade Associates Group, ltd
1730 W. Wrightwood
Chicago, IL 60614
773.871.1300 x130

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Holden Tommy
Sent: Monday, May 01, 2006 10:38 AM
To: Holden Tommy; RPG programming on the AS400 / iSeries
Subject: RE: Modiiyng a field value

Oops....I should have said you're skipping the last record in the file
since you are processing from the bottom up...which seems a bit odd for
the application....

Thanks,
Tommy Holden


-----Original Message-----
From: Holden Tommy Sent: Monday, May 01, 2006 10:36 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Modiiyng a field value

2 issues with this.  First off you'll be skipping the first file record
every time.  Using a primary read outside of the loop you really should
put you read inside the loop at the END of the loop.  IF you remove the
primary read outside the loop if you want the read at the top of the
loop you'll need to check for %EOF prior to executing any other code in
the loop.  Most likely what is happening is the error is occuring on the
last pass through the loop, %EOF is on but you still try to update since
the previous record's data is in memory.

Thanks,
Tommy Holden


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Yuriy Veletnik
Sent: Monday, May 01, 2006 10:20 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Modiiyng a field value

I have a file with 4 fields:

Columns . . . :    1  80                                      Browse


SEU==>


FMT A* .....A*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6
...+.

       *************** Beginning of data
********************************

0001.00      A* TEMPORARY FILE FOR EARLY BUY FIX


0002.00      A          R ORDINV


0003.00      A            ORDNO          3S 0       TEXT('ORDER NUMBER')


0004.00      A            CUST           5          TEXT('CUSTOMER
NAME')
0005.00      A            INVNO          3S 0       TEXT('INVOICE #')


0006.00      A            PROMO          3S 0       TEXT('PROMOTION
CODE')

0007.00      A          K ORDNO




The data I'm trying to change is:



Original file data: 1 XYZ 11 654 2 ABC 15 654 3 ABC 15 000 4 LKJ 18 000 5 LKJ 18 000 6 LKJ 18 321 7 LKJ 18 000 8 LKJ 18 000 9 FGH 23 000 10 FGH 23 000 11 FGH 23 000 12 FGH 23 987 13 JKL 48 000 14 JKL 48 000 15 JKL 48 000 I'm trying to change it to: 1 XYZ 11 654 2 ABC 15 654 3 ABC 15 654 4 LKJ 18 321 5 LKJ 18 321 6 LKJ 18 321 7 LKJ 18 321 8 LKJ 18 321 9 FGH 23 987 10 FGH 23 987 11 FGH 23 987 12 FGH 23 987 13 JKL 48 000 14 JKL 48 000 15 JKL 48 000



So, whenever there is a value in the PROMO field it has to be populated
into the records with the same value in the INVNO field.



To do that I created a logical file keyed on the PROMO + INVNO fields.
I'm trying to read a file from the end to the begging and replace a
PROMO value.

Logical file and a program as following:





SEU==>
FMT FX FFilename++IPEASF.....L.....A.Device+.Keywords+

       *************** Beginning of data *************

0001.00 FORDINVL UF E K DISK 0002.00 0003.00 D PROMO_S S 3 0 0004.00 D INVNO_S S 3 0 0005.00 0006.00 C *HIVAL SETGT ORDINVL 0007.00 C READP ORDINVL 0008.00 0009.00 C EVAL INVNO_S = INVNO 0010.00 C EVAL PROMO_S = PROMO 0011.00 0012.00 C DOW NOT %EOF 0013.00 C READP ORDINVL 0014.00 C IF INVNO = INVNO_S 0015.00 C IF PROMO_S <> 0 0016.00 C EVAL PROMO = PROMO_S 0017.00 C UPDATE ORDINV 0018.00 C ENDIF 0019.00 C ELSE 0020.00 C EVAL INVNO_S = INVNO 0021.00 C EVAL PROMO_S = PROMO 0022.00 0023.00 C ENDIF 0024.00 0025.00 C ENDDO 0026.00 0027.00 C EVAL *INLR = *ON 0028.00 C RETURN 0029.00








FMT LF .....A..........T.Name++++++.Len++TDpB......Functions++++++

       *************** Beginning of data *************************

0001.00 A R ORDINV PFILE(ORDINV) 0002.00 A K INVNO 0003.00 A K PROMO
       ****************** End of data ****************************



I get and error message:



Update or delete in file ORDINVL without prior input operation (C G D
F).





Please help me fix that error or is there another solution for the
problem?





Yuriy Veletnik

AS/400 Administrator

Trade Associates Group, ltd

1730 W. Wrightwood

Chicago, IL 60614

773.871.1300 x130





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.