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



Joel,

When you have a local and global field (all file fields are global) with the
same name, they are in fact two different fields.  And within the
subprocedure the local field will 'hide' the global one which means you
cannot access the global field within the subprocedure.

Scott Mildenberger

> -----Original Message-----
> From: Joel Fritz [mailto:JFritz@sharperimage.com]
> Sent: Wednesday, March 27, 2002 2:54 PM
> To: MIDRANGE-L@midrange. com (E-mail)
> Subject: visibility of file fields
>
>
> This isn't something that is a big problem for me, but it was
> puzzling.  I
> have a service program with a bunch of subprocedures that
> look things up in
> files.  I wanted to use a data structure in one of the
> subprocedures to
> concatenate a couple of file fields for easy coding of
> comparisons.  It
> doesn't work.  The compiler flags the field names in the data
> structure
> (which use the names of the file fields) as undefined.  I'm
> assuming that
> it's a local variable deal, because the cross reference shows
> all uses of
> the field names related to the fields in the data structure
> rather than the
> file.  Besides that, if I give the fields in the data
> structure data types
> and lengths, the program will compile, but not use the file fields.
>
> In retrospect it makes sense, although it's making me a
> little confused
> about local and global variables.  This seems to mean that if
> you use the
> name of a global variable as a data structure subfield in a
> subprocedure,
> the compiler sees it as a local variable.  OTOH, if the name
> doesn't appear
> on a D spec, you can use it as a global.  If the data
> structure were defined
> as a global variable, it would work--I tried it.
>
> Here's a very schematic look a the code:
>
>  h nomain
>  Ffile1     if   e           k disk
>
>
>   P subprocedure    B                   EXPORT
>   D subprocedure    PI             5u 0
>   D parm1                         25A   CONST
>
>   D datastruct      ds
>   D  file1fld1
>   D  file1fld2
>   ................
> _______________________________________________
> This is the Midrange Systems Technical Discussion
> (MIDRANGE-L) mailing list
> To post a message email: MIDRANGE-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
> or email: MIDRANGE-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
>


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.