|
Would you have this in a Do-Loop, to read each 1024 blocks of data? Say something like... C DOU Whatever C EVAL CHARSREAD = read(fp: %addr(input): 1024) C IF CHARSREAD <= 0 C LEAVE C ENDIF C ENDDO Would this be accurate? Will the read() know to pull the next 1024 each time? David L. Mosley, Jr. Systems Analyst 2000 CentreGreen Way Suite 250 Cary, NC 27513 jpcarr@tredegar.c om To: rpg400-l@midrange.com Sent by: cc: rpg400-l-admin@mi Subject: RE: Search for SELECT / FROM parameters in a CGI source from drange.com RPG 04/03/02 09:53 AM Please respond to rpg400-l I read in blocks(say 1024) EVAL CHARSREAD = read(fp: %addr(input): 1024) C IF CHARSREAD <= 0 C EVAL CURCHAR = EOF C EVAL EOD = *ON etc. Then you can scan the whole 1024 or look at each character in an array one at a time looking for EOL etc. Simple John Carr --------------------------------------------------- The potential problem here is that there may not be an end of line character reached before your buffer is filled. In C this creates a buffer overflow and in RPG an array index error. A solution to this is to allocate memory for a dynamic array as needed. Then you just need to be careful that you set a limit of some kind on how much memory your program will allocate. Your file may be very large and not contain any end of line characters. You could end up eating all the memory on the system. James Rich james@eaerich.com _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.