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



Change the ccsid of the file and see what you get. I would try 819 and
1252 first. See if one of those makes the file readable.




Kevin Bucknum
Senior Programmer Analyst
MEDDATA/MEDTRON
Tel: 985-893-2550

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Marvin Radding
Sent: Wednesday, September 12, 2018 2:03 PM
To: 'RPG programming on the IBM i / System i'
Subject: RE: What Does 'Descriptor not Valid' mean in an open
statement.

Bradley,

Yes the descriptor error was bogus because I did not know that a zero
value
for a file handle was valid.

I tried your suggestion for the open but it was still reading garbage.
This is
very confusing.

Thanks,

Marvin
No trees were killed in the sending of this message, but a large
number of
electrons were terribly inconvenienced, traumatized, triggered, and
crying
for their safe spaces.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Bradley Stone
Sent: Wednesday, September 12, 2018 11:42 AM
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Subject: Re: What Does 'Descriptor not Valid' mean in an open
statement.

Marvin,

Java has nothing to do with file descriptors in RPG.

Reading garbage is an entirely different problem than you had before.
So I
guess I can assume that fixing the IF statement solved your first
problem.
Which was really just a misunderstanding that a descriptor can be zero
(I saw
that problem right away because I did the same thing years ago!)

Now, your NEXT problem is the data reading in is "garbage". In fact,
what
that means is the data isn't translating from the files CCSID to your
jobs
CCSID. Not sure why an IFS file would have a CCSID of 37, though.
If you
plan on using it for anything outside of RPG, I'd change that.

Try opening the file with this instead: (I dug this out from some
notes
somewhere... the example in the sites below may be better) filehandle
=
open(filepath:O_RDONLY + O_TEXTDATA + O_CCSID:0:0);

There also is a TON of info on this at Scott Klement's site (
https://www.scottklement.com/presentations/RPG%20and%20the%20IFS.p
df for
instance) as well as RPGPGM.com:
http://www.rpgpgm.com/2016/01/read-ifs-file-using-rpg.html

That should get you underway.



On Wed, Sep 12, 2018 at 1:23 PM Marvin Radding <
marvin.radding@xxxxxxxxxxxxxxxxxxxxx> wrote:

Bradley,

Maybe this will help solve the problem. I found that the descriptor
is
a Java term and there must be 3 of them open for the default I/O
that
Java has. When I found this I included a single call that uses a
java
routine from Scott's HSSF interface and the open was successful. But
now there is another problem. It is reading garbage. It is supposed
to
be an ascii file. When I use WRKLNK, I can put a 5 on the file and
it
displays no problem. But when the program uses read, the line looks
like garbage. The Job's CCSID is 37 and the files attributes say
that
it is CCSID 37. I have no idea what is going on. I made the change
you suggested but the read is still garbage.

Between the descriptor error and this garbage read, I hope someone
can
come up with an explanation of what is happening.

Thanks,

Marvin
No trees were killed in the sending of this message, but a large
number of electrons were terribly inconvenienced, traumatized,
triggered, and crying for their safe spaces.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Bradley Stone
Sent: Wednesday, September 12, 2018 11:00 AM
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Subject: Re: What Does 'Descriptor not Valid' mean in an open
statement.

Here's what I believe is the problem:

if filehandle <= *zero;

filehandle can be, and probably is zero (since it's the first
descriptor you're probably using to open a file). This should be:

if filehandle < *zero;

or

if filehandle < 0;


Bradley V. Stone
www.bvstools.com
MAILTOOL Benefit #6 <https://www.bvstools.com/mailtool.html>: Easily
send group emails with Distribution Lists

On Wed, Sep 12, 2018 at 11:24 AM Marvin Radding <
marvin.radding@xxxxxxxxxxxxxxxxxxxxx> wrote:

Bradley,

Here is the error message:

open file:

/massmutual/rateinc_in/results/lifecare_rate_rnwl_agnt_file_push_201
80
815100
041.dat Descriptor not valid.

And here is the code:

p open_file b
d open_file pi n
d path 254a
d filepath s 256a
d filehandle s 10i 0 inz
filepath = %trim(path) + x'00';
filehandle = open(filepath:O_RDONLY + O_TEXTDATA);
if filehandle <= *zero;
die('open file: ' + %trim(path) + ' ' +
%str(strerror(errno)));
return *on;
else;
return *off;
endif;
return *on;
p open_file e
/eject

Thanks,

Marvin
No trees were killed in the sending of this message, but a large
number of electrons were terribly inconvenienced, traumatized,
triggered, and crying for their safe spaces.


--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To
subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
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).
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To
subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

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.