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



Scott,

The 'two  vars' solution worked.
Not really that ugly.
Doesn't seem like it should be that difficult, though.

Thanks for your help.

Tim Kredlo

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Friday, October 10, 2003 11:54 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Variable file names



Unfortunately, files are always "global" in scope.  Therefore, you
cannot use a variable that's local to a subprocedure in your F-spec.

It should work if you define "Filename" to be global instead of local to
the procedure.   (i.e. define it in the D-specs above the main
procedure)
But, of course that'll defeat the purpose of the parameter to the
subprocedure.

You might think about having two vars...  "global_File" and "parm_File"
and then just before the OPEN of the file, set global_File = parm_File.
Ugly, I know, but it's about the best you can do unless you want to use
the ILE C runtime to access your file.

On Fri, 10 Oct 2003, Tim Kredlo wrote:

> Please help.
>
> I am creating (attempting to, anyway) a sub-procedure that receives a 
> file name as a parameter. This file will be chained to in the 
> sub-procedure. The file names are not known until the calling program 
> is being run, as they are based on a date in records processed by the 
> calling program. All the file names that are passed refer to files 
> that are 'archives' of the same externally DDS described file 
> (PPXC00).
>
> The manual says:
> 1....2....3....
> 4. This keyword is not used to find an externally-described file at 
> compile time. What exactly does that (#4) mean anyway?
> If it means what I inferred (that it is NOT going to go look for a
> definition) why does it blow up?
> (The archive example I saw was just a code snippet, but it had the
file
> externally described.)
>
> Is there a way to code this and have these files be externally 
> described?
> **********************************************************************
> **
> ***********
> This does not compile:
>  FPPXC00    IF   E           K Disk    ExtFile(FileName)
>
>  F                                                 UsrOpn
>
> /Free
> /Copy EXPRDPGM/QRPGSRC,PROTSP           (contains PR for
sub-procedure)
>
> /End-Free
(field
> 'FileName' defined here also   )
>
> D AdjCst          PI            10S 4
> D Prt#                               Like(PtPrt#)
> D CYMD                          8S 0
> D FileName                     20A
>
> Some calcs here....
>
> Compile error:
> *RNF7030 FILENAME          **UNDEF**               9           ("9" is
> the PPXC00 F-spec)
>
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.