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



I am having problems with open and closing IFS file using Scott's IFS stuff.

I am working under 7.1 and trying to open a file on the IFS. The first time I run the program I get an Invalid Descriptor error. But if I run it again right after the first time, it works with no problem.

Then, after reading the file using the same descriptor, the close gets the same error.

Here is the code:
//------------------------------------------------------------
// Variables
//------------------------------------------------------------
d headers s 20a dim(50)
d fd s 10i 0 inz
d fdclose s 10i 0 inz
d line s 1024a
d msg s 52a
d index s 10i 0
d bytesread s 10i 0
d start s 10i 0
d len s 10i 0
d info s 256a varying
d replymsg ds likeds(ReplyMsg_T)
//------------------------------------------------------------
// Prototypes
//--------------------------------------------------------------
d lexnexrcpr pi
d pathto 256a
d path 256a
d filename 256a
/EJECT
//------------------------------------------------------------
// Main Program
//------------------------------------------------------------
/free
pathto = %trim(pathto) + x'00';
fd = open(pathto:O_RDONLY+O_TEXTDATA);
if fd < 1;
die('open ' + %trim(pathto) + %str(strerror(errno)));
*inlr = *on;
return;
endif;

// load headers
bytesread=readline(fd: %addr(line): %size(line));
if bytesread <= *zero;
sndmsg('CPF9898':'file did not have a header');
*inlr = *on;
return;
endif;
line = %trim(line) + ',';
start = 1;
for index = 1 to 50;
len = %scan(',':line:start) - start;
if len <= 0;
leave;
endif;
headers(index) = %subst(line:start:len);
headers(index) = %subst(headers(index):2);
headers(index) = %subst(headers(index):1
:%len(%trim(headers(index)))-1);
start += len + 1;
endfor;

fdclose = close(fd);
if fdclose < 1;
die('close: ' + %str(strerror(errno)));
endif;

*inlr = *on;
return;

Can you see if there is anything I am doing wrong?
Notice: This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. This message may also contain Protected Health Information (PHI) and must be treated confidentially and handled in accordance with HIPAA and other federal and state privacy laws. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately and delete this e-mail (and any accompanying attachments).

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.