RE: What the beep is wrong with this?

Don Brown via RPG400-L <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <SYBP282MB35581CE6161CFF40726E3305E993A@SYBP282MB3558.AUSP282.PROD.OUTLOOK.COM>
   Not sure if this just the formatting but if this is commented out

   // C API Prototypes - renamed to avoid opcode conflicts Dcl-Pr openFile
   Int(10) ExtProc('open');

   Then this will not find openFile

   FileDesc = openFile(FilePath: O_RDONLY + O_TEXTDATA );

   Cheers
   Don

    

   Don Brown

   Senior Consultant
    
   [1]OneTeam IT Pty Ltd
   P: 1300 088 400

   -----Original Message-----
   From: RPG400-L <rpg400-l-bounces-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org> On Behalf Of Jon
   Paris
   Sent: Sunday, 25 January 2026 10:07 AM
   To: RPG programming on the IBM i (AS/400 and iSeries)
   <[email protected]>
   Subject: What the beep is wrong with this?

   I'm playing with Bob and asked him (it?) to create an RPG program to read
   an IFS file.

   I'm familiar with all of the required APIs (or thought I was) - but the
   Bob program will not open the file and I'm danged if I can see why. Here's
   an extract of the code which demonstrates the issue.

   Ctl-Opt DftActGrp(*No);

   // C API Prototypes - renamed to avoid opcode conflicts Dcl-Pr openFile
   Int(10) ExtProc('open');
   *N Pointer Value Options(*String);
   *N Int(10) Value;
   *N Uns(10) Value Options(*NoPass);
   *N Uns(10) Value Options(*NoPass);
   End-Pr;

   // Constants for open()
   Dcl-C O_RDONLY 1;
   Dcl-C O_TEXTDATA 16777216;

   // Variables
   Dcl-S FilePath Varchar(256) Inz('/home/PARIS/Bob/Test.csv'); Dcl-S
   FileDesc Int(10);

   // Open the IFS file
   FileDesc = openFile(FilePath: O_RDONLY + O_TEXTDATA );

   If FileDesc < 0;
   Dsply 'Error opening file';
   Else;
   Dsply 'File Open';
   EndIf;

   *InLr = *On;

   The file opens just fine if I use SQL ( SELECT * FROM
   TABLE(QSYS2.IFS_READ(PATH_NAME => '/home/paris/bob/Test.csv'))

   So I don't think it is a permissions problem (and yes I have checked that
   tooj. It has to be something dumb and I just can't see it.

   Jon Paris
   [email protected]

   --
   This is the RPG programming on IBM i (RPG400-L) mailing list To post a
   message email: [email protected] To subscribe, unsubscribe, or
   change list options,
   visit: [2]https://lists.midrange.com/mailman/listinfo/rpg400-l
   or email: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
   Before posting, please take a moment to review the archives at
   [3]https://archive.midrange.com/rpg400-l.

   Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related
   questions.

   --
   Message protected by MailGuard: e-mail anti-virus, anti-spam and content
   filtering.
   [4]https://www.mailguard.com.au

   Click here to report this message as spam:
   [5]https://console.mailguard.com.au/ras/2bX46aVUxL/11ThXLPPWgUKWwImjcf4Km/-0.1

References

   Visible links
   1. https://www.oneteamit.com.au/
   2. https://lists.midrange.com/mailman/listinfo/rpg400-l
   3. https://archive.midrange.com/rpg400-l.
   4. https://www.mailguard.com.au/
   5. https://console.mailguard.com.au/ras/2bX46aVUxL/11ThXLPPWgUKWwImjcf4Km/-0.1

-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.