× 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 for your reply Kevin
Once I remembered to sign off and sign back in again – there was no error
MUCH appreciated

Alan Shore
Solutions Architect
IT Supply Chain Execution

[cid:image003.png@01D782DD.33F70910]

60 Orville Drive
Bohemia, NY 11716
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
E-mail : ASHORE@xxxxxxxxxxxxxxxxxxxx

‘If you're going through hell, keep going.’
Winston Churchill

From: Kevin Bucknum [mailto:Kevin@xxxxxxxxxxxxxxxxxxx]
Sent: Tuesday, July 27, 2021 11:39 AM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Cc: Alan Shore <ashore@xxxxxxxx>
Subject: Re: [EXTERNAL] Re: Using _C_IFS_fopen and _C_IFS_fgets to read files in the ifs

CloseFile takes the pointer you got back from the open. Not the address of the file. You want CloseFile(FilePtr)

On Tue, 2021-07-27 at 15:34 +0000, Alan Shore via MIDRANGE-L wrote:
Hi Jon
I was able to FINALLY find time to implement what you suggested

My problem was that the program is not closing the files and eventually it reaches a maximum number of files already open
Im hoping that someone can see what I am doing wrong with my opens and closes
Here is my pertinent code

0196.00 PathFile2read = %trim(PriorPathfile) + x'00' ;
0197.00 OpenMode = 'r' + x'00' ;
0198.00 FilePtr = OpenFile(%addr(PathFile2read):%addr(OpenMode)) ;
0199.00
0200.00 perrno = get_errno; // Now the errno value is visible is visible in c_errno
0201.00 perrorString = strerror(c_errno);
0202.00
0203.00 if (FilePtr = *null) ;
0204.00 CannotreadPriorBAI2();
0205.00 return;
0206.00 endif ;
0207.00
0208.00 dow (ReadFile(%addr(RtvData):32767:FilePtr) <> *null) ;
0209.00 RtvData = %xlate(x'00':' ':RtvData) ; //End of record null
0210.00 RtvData = %xlate(x'25':' ':RtvData) ; //Line feed (LF)
0211.00 RtvData = %xlate(x'0D':' ':RtvData) ; //Carriage return (CR)
Some logic here
0236.00 enddo ;
0237.00 CloseFile(%addr(PathFile2read));
0238.00 perrno = get_errno; // Now the errno value is visible is visible in c_errno
0239.00 perrorString = strerror(c_errno);

When I look at the field errorString after line 239.00, the value is
File is not open.
And the field C_ERRNO = 3004



Alan Shore
Solutions Architect
IT Supply Chain Execution

[cid:image002.png@01D782DB.5679CAB0<mailto:image002.png@01D782DB.5679CAB0>]

60 Orville Drive
Bohemia, NY 11716
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
E-mail : ASHORE@xxxxxxxxxxxxxxxxxxxx<mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx>

'If you're going through hell, keep going.'
Winston Churchill

From: Alan Shore
Sent: Sunday, July 25, 2021 5:41 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>>
Subject: RE: [EXTERNAL] Re: Using _C_IFS_fopen and _C_IFS_fgets to read files in the ifs

Thanks for your reply Jon
I'm assuming the error is on the open, as the check for null is directly after the open

Thanks for the code to get the error
I will look to applying this in the morning



Sent via the Samsung GALAXY S(r) 5, an AT&T 4G LTE smartphone


-------- Original message --------
From: Jon Paris <jon.paris@xxxxxxxxxxxxxx<mailto:jon.paris@xxxxxxxxxxxxxx><mailto:jon.paris@xxxxxxxxxxxxxx<mailto:jon.paris@xxxxxxxxxxxxxx>>>
Date: 7/25/21 17:12 (GMT-05:00)
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx><mailto:midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>>>
Subject: [EXTERNAL] Re: Using _C_IFS_fopen and _C_IFS_fgets to read files in the ifs
Is the pointer set by the open? Or is it null?

You say it can't be read but you're not testing to see if it was actually opened.

Whether the failure is on the open or the read you should be looking at the value of errno to determine what the system think s the problem is.

If you don't know how to do this ...

Dcl-pr get_errno Pointer ExtProc('__errno'); // Note _double_ underscore

Dcl-s c_errno Int(10) based(perrno);

perrno = get_errno; // Now the errno value is visible is visible in c_errno

// To get the text value
Dcl-pr strerror pointer ExtProc('strerror');
errno Int(10) Value;
End-Pr;

Dcl-s errorString Char(100) Based(perrorString);

perrorString = strerror(c_errno);


Jon Paris


On Jul 25, 2021, at 2:39 PM, Alan Shore via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx><mailto:midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>>> wrote:

Hi everyone
I just re-read my e-mail and realized that it is misleading
Using that web site -
A better way to read a file in the IFS with RPG @ RPGPGM.COM<https://www.rpgpgm.com/2016/03/a-better-way-to-read-file-in-ifs-with.html<https://www.rpgpgm.com/2016/03/a-better-way-to-read-file-in-ifs-with.html><https://www.rpgpgm.com/2016/03/a-better-way-to-read-file-in-ifs-with.html<https://www.rpgpgm.com/2016/03/a-better-way-to-read-file-in-ifs-with.html>>>
The problem is with the the OpenFile

Here is the pertinent code

dcl-pr OpenFile pointer extproc('_C_IFS_fopen') ;
*n pointer value ; //File name
*n pointer value ; //File mode
end-pr ;

dcl-pr ReadFile pointer extproc('_C_IFS_fgets') ;
*n pointer value ; //Retrieved data
*n int(10) value ; //Data size
*n pointer value ; //Misc pointer
end-pr ;

dcl-pr CloseFile extproc('_C_IFS_fclose') ;
*n pointer value ; //Misc pointer
end-pr ;


PathFile2read = %trim(PriorPathfile) + x'00' ;
OpenMode = 'r' + x'00' ;
FilePtr = OpenFile(%addr(PathFile2read):%addr(OpenMode)) ;

if (FilePtr = *null) ;
CannotreadPriorBAI2();
return;
endif ;



Alan Shore
Solutions Architect
IT Supply Chain Execution

[cid:image001.png@01D78162.E7C4C710<mailto:image001.png@01D78162.E7C4C710>]

60 Orville Drive
Bohemia, NY 11716
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
E-mail : ASHORE@xxxxxxxxxxxxxxxxxxxx<mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx><mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx<mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx>>

'If you're going through hell, keep going.'
Winston Churchill

From: Alan Shore
Sent: Sunday, July 25, 2021 1:26 PM
To: midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx><mailto:midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>>
Subject: Using _C_IFS_fopen and _C_IFS_fgets to read files in the ifs

Hi everyone
We are on V7r3
We have a number of files in the ifs that I am attempting to use _C_IFS_fopen, _C_IFS_fgets and _C_IFS_fclose to read
Please see the following web page
A better way to read a file in the IFS with RPG @ RPGPGM.COM<https://www.rpgpgm.com/2016/03/a-better-way-to-read-file-in-ifs-with.html<https://www.rpgpgm.com/2016/03/a-better-way-to-read-file-in-ifs-with.html><https://www.rpgpgm.com/2016/03/a-better-way-to-read-file-in-ifs-with.html<https://www.rpgpgm.com/2016/03/a-better-way-to-read-file-in-ifs-with.html>>>

I have a situation where one of the files is not read by these utilities
Does anyone know how I can determine why?
I am able to go into that file using wrklnk and edtf - so I believe its NOT an authority situation

However, the program is not able to read the rest of the files AFTER that one
I can sign off, sign back in, change the program to start AFTER that one particular file, and the rest of the files can be read
So I am assuming that something needs to be initialized after such a read, but In am unable to find anything as to what that could possibly be
Does anyone have any knowledge of such a situation and how to rectify it?

As always - all answers gratefully accepted

Alan Shore
Solutions Architect
IT Supply Chain Execution

[cid:image003.png@01D78162.E7C4C710<mailto:image003.png@01D78162.E7C4C710>]

60 Orville Drive
Bohemia, NY 11716
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
E-mail : ASHORE@xxxxxxxxxxxxxxxxxxxx<mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx><mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx<mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx><mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx<mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx>%3cmailto:ASHORE@xxxxxxxxxxxxxxxxxxxx<mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx>>>

'If you're going through hell, keep going.'
Winston Churchill

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx><mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx>>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l<https://lists.midrange.com/mailman/listinfo/midrange-l><https://lists.midrange.com/mailman/listinfo/midrange-l<https://lists.midrange.com/mailman/listinfo/midrange-l>>
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx><mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l<https://archive.midrange.com/midrange-l><https://archive.midrange.com/midrange-l<https://archive.midrange.com/midrange-l>>.

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx><mailto:support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx>> for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com<https://amazon.midrange.com><https://amazon.midrange.com<https://amazon.midrange.com>>

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx><mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx>>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l<https://lists.midrange.com/mailman/listinfo/midrange-l><https://lists.midrange.com/mailman/listinfo/midrange-l<https://lists.midrange.com/mailman/listinfo/midrange-l>>
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx><mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l<https://archive.midrange.com/midrange-l><https://archive.midrange.com/midrange-l<https://archive.midrange.com/midrange-l>>.

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx><mailto:support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx>> for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com<https://amazon.midrange.com><https://amazon.midrange.com<https://amazon.midrange.com>>



[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com<https://www.medtronsoftware.com>


CONFIDENTIALITY NOTICE


This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.

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.