Originally posted to comp.sys.ibm.as400.misc, with the subject An Immodest Proprosal

The Perfect Subfile Program

All I want for Christmas is the perfect subfile program! 

I am assuming the file over which the program is inquiring has a very 
large quantity of records (to be referred to as 'n'). 

I want to be able to Sort on any column. 
I want to be able to Position To based upon the sorted column. 
I want Exact Match and Wildcard match on *all* columns 
I want to be able to select between 1 and n records. 
  By select, I mean enter an option to be executed (e.g. inquire, show detail, delete, etc.)
I want the selected records to process in keyed order. 
I want, upon failure of a selection, to display a subfile page with 
  the record in error at the top, highlighted (sort of like WRKOBJ 
  works, if you try to delete a physical with dependent logicals) 
I want, when the selected option returns an EOJ, to return to the 
  originating menu (no matter how many intermediate drilldowns) 
I want, when the selected option returns as F12, to display the 
  subfile page containing the next option to execute, with all 
  selected options remaining. 
I want to be able to function key exit to an Add screen 
I want to be able to drill down to an Inquiry Screen 
I want to be able to drill down to a Maintenance Screen 
I want (if applicable) to drill down to a subfile program showing all 
  'to many' records corresponding with the selected 'one' 
I want a confirmation screen for deletes 
I want there to be *no* business logic in the Subfile program (all 
  business logic will be contained in dedicated Service Programs - one 
  for each file). 
I want the program to be generated from table information (not written 
  by hand) 
I want Function Key/Selection Exit security 
I want CRUD (Create/Review/Update/Delete) Security (record level) 
I want column security (CRUD) 
I want row security (CRUD) 
I want infinite levels of Grouping (e.g. Employee Chris belongs to 
  Group Houston, which belongs to Group Texas, which belongs to Group 
  USA, which belongs to Group Worldwide) with security assignable at 
  any level) 
I want to be able to override column/row descriptions 
I want the whole thing driven from a data dictionary 
I want to log: 
  Program Entry 
  Program Exit 
  Selection Options 
  Function Key Exits 
  Records Inquired 
  Records Changed (not the data [that's what journals are for], 
                  just who, when and what] 
  Records Added (ditto) 
  Records Deleted (ditto) 
  Access Paths used (for performance analysis) 
I want the ability to assign an Exit Program to each 
  'Logging Point' 
I want a menu system. 
I want a table file 
I want each file to have a 'prompt' screen (defined in 
  data-dictionary),   returning either 1 (one) or n records. 
I want all help to be contained in UIM Panels, to be generated 
  (not hand coded) 
I want an object repository, which will automate packaging of: 
  1. the whole thing as a licensed product 
  2. changes as PTFs 

I need a similar 'stack-based' subfile program. It would be used for 
things like displaying directories, or the nested group structure. 
Rather than showing all records for a file, it would show all 
files/directories within a directory, or all Groups/Users within 
a group. When you drilled down from directory1 to directory2, 
directory2 would be added to the stack, and all files/directories 
within it displayed, with the stack in the header. It would provide 
the ability to either start from 'root' or a specified point within 
the tree structure. 

I also need a data-entry (as opposed to 'drill-down') subfile program 
for entering transactions with multiple details. 

As an aside, I think the concept of only coding something once means 
that for each file on the system, there should be only 1 (one): 



These IOs should be encapsulated in a Service Program with the same 
name as the encapsulated file. 

This is a simplified version of the MVC pattern, where the Service 
Program is the Model, and the subfile program is the combined 
Phase II. 

I want to move the dedicated Service Programs to batch, where they 
can serve multiple interactive jobs. The batch programs will run as 
servers, with the subfile program a client, and all communications 
through sockets. A mediator will keep the client from knowing that 
the server is not monogamous. 
Phase III. 

I want to replace generated Subfile Programs with a single program, 
table-driven (using the same information as the code generator in 
phase I) and dynamically generating 5250 data streams. 
Phase IV. 

I want the Subfile program to run someplace other than  the AS/400. 
Options include a browser interface, using something like Ruby on 
Rails with AJAX (only with a modified ActiveRecord - I have issues
with ORM), or a C++ desk top application. I may replace the sockets 
interface with SOAP/XML (if I have way too much time; services 
intended for intranet use don't need as an elaborate an interface). 

I have finished the analysis (only 21 files) for phase I, and am 
beginning to code (using an "Agile" methodology). Estimated 
delivery date is in November (I'm just not sure which year). 

Valid HTML 3.2! Creative Commons License

BrilligWare/ chris@pando.org / revised June 2007