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


  • Subject: Subfile as internally described?
  • From: Jim Langston <jimlangston@xxxxxxxxxxxxxxxx>
  • Date: Thu, 19 Apr 2001 10:06:24 -0700
  • Organization: Pacer International

(I may have already posted this, but had the wrong return address, so don't
think it got posted).

I am modifying an existing RPG III program to include a subfile in the display
file (thanks for all the help with modifying the display file).  The display 
file
works fine in testing, now I need to implement it in the RPG program.

I converted the RPG III to RPG IV with no problem, recompiled, and all works
well as existing (no subfile yet).  Then I took a look at changing the program
logic to include the subfile in the display and groaned.

Apparently, this was originally a RPG II program that was converted to RPG III
and no one ever bothered to use external file declarations, so all the files are
program defined.

I then looked at what would be involved with making the display file externally
defined and hit a snag:

FSTR002FM  CF   F 1920        WORKSTN INFDS(DSINF)
 
D KEYS            DS                       
D  ...
D  SDIV                  22     23         
D  ...
D  SDIV2                 41     42         

D                 DS                          
D  ...
D  SDIV3                  7      8            

ISTR002FM  NS  01    1 C1                          
I                                  2    3  SDIV    
I                                  2    3  SDIV1   
I                                  2    3  SDIV2    
I                                  2    3  SDIV3   
I ...

(Ellipsis indicate snipped uninvolved code)

As you can see, some of the fields in the display file are defined
numerous time (just SDIV redefinitions are shown here to illustrate).
The division number is defined 4 times!  Looking at the code it becomes
fairly obvious why they did this, you can not redefine a field in a
data structure into another data structure.  Rather than move the values
into the fields, they just redefined it.  

It would seem to clean up this mess and make the display file externally
described I am going to have to move the values in SDIV1, SDIV2 and SDIV3
just before the keys are used, which will probably induce bugs one way or
another, which I definitely don't want to do.

My other option is to figure out how to use subfiles as internally defined
to the program, which is also something I don't want to do (I always use
external declared files whenever I can).

Can someone think of a way around this snafu?

Thanks in advance,

Jim Langston
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.