Scott,
Thanks for clearing that up for me. I knew I was "taking my life in my hands" when I got in a discussion between you and Jon. Never a good look.
I admit that data structures, along with SQL, are things that I do not use as often or as well as I could/should. Which is kind of puzzling since, going back to my S/3 days, I have long been a proponent of better data structures. I even still have a copy of Jon's handout on DSs from our Common days. (Jon is probably cringing since that was V5R4 level.)
Jerry C. Adams
IBM i Programmer/Analyst
--
NMM&D
615-585-2175
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Monday, August 12, 2024 3:12 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: Extfile and ExtDesc
Jerry,
What Jon is referring to (as I interpreted it) is that in fixed format
RPG you can do the following:
D myDS E DS ExtName(XXXX)
In this case, XXXX is interpreted by the RPG compiler as the name of the
file to get the external definitions for, and is not case-sensitive.
Whereas in free-format, you have to do the following:
dcl-ds myDS ext extfile('XXXX') end-ds;
The quotes are required because without the quotes CUSTMAS would be
interpreted as a named constant. And the quotes make it case-sensitive.
But, I believe Jon mistakenly applied it to ExtFile and ExtDesc, which
never allowed it to be interpreted as the filename without the quotes.
You are actually saying the same thing that I am, except that you are
approaching it from the perspective of using a variable for the filename
-- the opposite perspective that the OP used, and opposite of what Jon
was referring to when he said it now requires quotes.
FMYFILE IF E DISK ExtFile(XXX) <-- XXX is treated
as a variable name.
or
dcl-f MYFILE disk extfile(XXX);
In both cases it is interpreted as a VARIABLE, it's never interpreted as
the file name. It will get the name from the contents of the variable,
which is exactly what you're saying. And that's sort of my point --
ExtFile and ExtDesc have always required quotes, otherwise it is treated
as a variable name.
If you want it to be treated as a literal, which is what the OP was
doing, then it needs to be quoted and will be case-sensitive.
FMYFILE IF E DISK ExtFile('XXX') <-- XXX is treated
as a case-sensitive file name
On 8/10/24 5:19 AM, Jerry Adams wrote:
I have never used quotes (single or double) around ExtFile, rather
ExtFile(MyFile) and, then defined MyFile in D-specs as 10A. Thinking about
it this early in the morning, the reason I do that is because most of my
files are legacy S/34/36 files with a group id, such as A.MYFILE and
B.MYFILE. So once I know which company the program is running over, I can
build in my initialization routine, such as MyFile = group + '.MYFILE' and
only then OPEN MYFIE.
In other words, if the F-Spec name is the same as the file/table on disk, I
do not use ExtFile; why would I?
Jerry C. Adams
IBM i Programmer/Analyst
Umpires should be natural Republicans - dead to 'human feelings'. - George
Will
--
NMM&D
615-585-2175
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of
Scott Klement
Sent: Saturday, August 10, 2024 12:27 AM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: Extfile and ExtDesc
ExtFile and ExtDesc have always required quotes and always been
case-sensitive.
You are thinking of ExtName that once allowed unquoted names.
On 8/7/24 3:29 PM, Jon Paris wrote:
Just as a general FYI ...
When RPG changed to accept named constants for file names etc. it became a
requirement to place literal names in quotes. That also means of course that
they must also be in upper case.
Jon P
As an Amazon Associate we earn from qualifying purchases.