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



> From: Jean Reksodiputro
> 
> - A main program opens a file (FILE_A) as UPDATE
> (allow ADDITION).
> - A sub-procedure within the main program will define
> a DS based on FILE_A, assign some values and WRITE to
> FILE_A
> - The result is A BLANK Record written to FILE_A
> - If I move the 'E DS' definition of FILE_A out to the
> main program, it worked.
> 
> Can somebody help me explain this. Does it have to do
> with LOCAL variables declared in the sub-procedure?

Yes, that's exactly the problem, Jean.  When you define an F-spec, it
immediately creates all those fields as global fields, and this is where
the I/O operations such as CHAIN put the data.

If you define an EDS in you subprocedure, all the fields for that data
structure are defined locally to the procedure, and so don't get
populated by the I/O operations.

There are several ways around it, depending on your OS version.  V5R2 (I
believe) allows you to chain directly into a data structure.  For
previous release, another option is to move the data structure outside
of the procedure, as you have already found.

Another technique that I use is to create a based EDS globally and then
change the basing pointer to point to my local data structure.  In order
to avoid conflicts, you'll need to use a qualified data structure, or
use the PREFIX option.

Joe



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.