× 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.



Are you opening/closing the IFS file inside the procedure? That could cause that. Only open the IFS file once in the program and then close at the very end. If it is not that then we would need to at least see the code for the procedure.

Scott Mildenberger | Software Developer | Washington Corporations | 101 International Drive | Missoula, MT 59808 | Office: (406) 523-1536 | www.washcorp.com

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> On Behalf Of Buzz Fenner
Sent: Tuesday, December 18, 2018 8:10 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Write to IFS text file

All,

Pardon me if this sort of drags on; I figure when I get (or figure out) the answer to this it'll be a great teaching moment.

I have an RPGIV program that reads invoices and writes checks; a logic cycle program breaking on vendor number. Simple enough. It needed to be modified to produce a text file that our bank will use to prevent check fraud (we got hit recently).

I've used Scott Klement's wrappers (i.e. "RPG And the IFS") to read/write to the IFS and never had a problem - they're wonderful. I convert the source to ILE-RPG, get it into freeform, and remove the logic cycle processing. The code that executed on the vendor break I put into a local subprocedure.

However, after executing the program, the text file on the IFS had only one record in it, which corresponded to the last vendor in the input file. I put it into debug to prove the write statement in the procedure executed for each vendor break. Spent days trying to figure it out to no avail. In an act of desperation, I tested putting the code into a subroutine and moved the local declarations back into the main procedure. It worked like a charm; all records were written. It was as if when the code was in a subprocedure, all the writes were stomping on the data that was already there with the next write to the text file overwriting what was written previously.

So, what's the explanation for the difference?

--
Buzz Fenner, Analyst/Systems Administrator
+1 (870) 930.3374
+bfenner@xxxxxxxxxxxxxxxx<mailto:bfenner@xxxxxxxxxxxxxxxx>

City Water and Light of Jonesboro
Office: +1 (870) 935.5581 / Fax: +1 (870) 930.3301
Physical: 400 East Monroe Ave., Jonesboro, AR 72401
Mailing: PO Box 1289, Jonesboro, AR 72403-1289

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.