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



Thanks Adam, that does help.

It sounds like for this interface I'm going to have to have the router job call the handling programs passing the first line of data, or I'm just going to have to prototype the IFS APIs and deal with the files directly.

Thanks for the explanation.

Wiley Ammons
*logimax*
Wiley.Ammons@xxxxxxxxxxxxx

CONFIDENTIALITY NOTICE: The ICS information and all ICS attachments contained in this electronic communication are legally privileged and confidential information and intended only for the use of the intended recipients. If the reader of this message is not an intended recipient, you are hereby notified that any review, use, dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately of the error by return e-mail and please permanently remove any copies of this message from your system and do not retain any copies, whether in electronic or physical form or otherwise. Thank you.

ICS, Inc. (904) 399-8500



AGlauser@xxxxxxxxxxxx wrote:
Wiley Ammons wrote on 29/06/2007 14:32:26:

I have prototyped open and close and I am using Scott's readline
almost
verbatim as an external procedure to my program. I have an interface
process that determines the type of message I have received by
reading the
header inside each file. There is a group of 3 programs that read the
list
of files, and then opens each file to see if it should process them.

The problem I am facing is that when I open, readline and close an
IFS
file in the first program, subsequent programs called by the same
parent
process open the same file and get line 2 of the file instead of line
1
like that first program. They therefore never process the
transaction. Any
help would be appreciated, thanks for your time.

The readline in the form you have it is limited to handling one file at a time, and it is not designed to partially read a file, and then re-read it from the beginning. It helps to understand that readline is in a sense 'virtualizing' access to the file. One of the main benefits of readline() is that it reads data in chunks from the file, in order to maximize I/O performance.


If it helps, here is my copy of readline:

//ReadLine - Get a line at a time from an IFS file
P $_readline B export
D $_readline PI 10I 0
D fd 10I 0 value
D text * value
D maxlen 10I 0 value

D rdbuf S 1024A static
D rdpos S 10I 0 static
D rdlen S 10I 0 static

Note the use of the 'static' keyword. That means that these variables retain their values across calls to this procedure within a given activation group. Also note that the buffer is is 1kB in size.


D p_retstr S *
D RetStr S 32766A based(p_retstr)
D len S 10I 0

c eval len = 0
c eval p_retstr = text
c eval %subst(RetStr:1:MaxLen) = *blanks
c dow 1=1
C* Load the buffer
c if rdpos>=rdlen

I'm guessing that your first line (the file header) is less than 1 kB long. Suppose your file is 2 kB long and the first line is 256 bytes long. Then, after reading the first line in program 1, you call this routine from program 2. When you hit this line, rdpos = 256, and rdlen = 1024. Therefore, we don't read from the file again, and just continue processing what is left in the buffer.

Hope this helps,
Adam

Attention:

The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this message in error, please contact the sender and delete the material from any system and destroy any copies. Thank you for your time and consideration.

Attention:
Le contenu de ce message et(ou) les fichiers ci-joints s’adressent exclusivement à la personne ou -entité à laquelle ils sont destinés. Ils peuvent contenir de l’information confidentielle, protégée et(ou) classifiée. Il est strictement interdit à toute personne ou entité autre que le(la) destinataire prévu(e) de ce message d’examiner, de réviser, de retransmettre ou de diffuser cette information, de prendre une quelconque action en fonction ou sur la base de celle-ci, ou d’en faire tout autre usage. Si vous avez reçu ce message par erreur, veuillez communiquer avec l’expéditeur(trice), supprimer ce message et les fichiers ci-inclus de tout système, et en détruire toutes copies, qu’elles soient électroniques ou imprimées. Nous vous remercions de votre entière collaboration.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.