× 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'm using Scott's utility for reading a text IFS file.  The file has a
heading,

These are IBM APIs, not my utilities! :)

The top of the file looks like this...
-----BEGIN

PEM encoded digital certificate?


My code looks like this...

   H DFTACTGRP(*NO)

     /copy QSRC,ifsio_h

    D fd              s             10I 0
    D data            s             50A
    D wait            s              1A

     /free

       fd = open('/testfile.asc': O_RDONLY );
       if (fd < 0);
           dsply ('Something went wrong, open() failed.') '' wait;
          return;
       endif;


       if read(fd: %addr(data): 10) < 10;
           dsply ('The file does not have 10 bytes to read!') '' wait;
           return;
       endif;

This isn't the problem, but... you should have a "callp close(fd)" prior to the RETURN statement here. Otherwise, if the file doesn't have 10 characters, your program will end without ever closing it.


However, when I look at the field Data in DEBUG - it looks like this?
DATA = 'âáåñ+&å&(áëë åá                       '

Can you (in debug, at the same statement) type the following:

   eval data:x

This will give us a view of the data in hex, which might be helpful. You should do this WITHOUT specifying O_TEXTDATA so that we know what the actual hex values of the bytes in the file are.

Code page on the file is 437.
I've tried "O_TEXTDATA", but when I try that - it returns fd of "-1".

Can you tell us what the value of errno is when you receive the -1? More info about errno can be found on my Web site at the following link:
http://www.scottklement.com/rpg/ifs_ebook/errors.html

O_TEXTDATA should definitely be used when you're reading a file that's in ASCII -- I suspect that this is the problem, but without knowing what "errno" is, I have no idea why open() is returning a -1.

When you say the codepage is 437, do you mean that the data in the file is in codepage 437, or that the file's attributes are set to 437, or both? In other words, do the hex values of the data in the file (obtained by calling debug with :x) make sense for the codepage that you've assigned to the file?

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.