When I train people to who are new to 2E, but have been RPG developers for sometime, one question I’m asked about is how to perform subfile drop/fold within 2E. This is actually pretty simple to do, just follow the following steps.

First let’s work with a screen in which we want some fields on the second line of the subfile. In my case this is going to be the record stamp fields. Normally you would see the following when you go into a simple display file function.

Screen Shot 10-14-15 at 10.02 AM

OK so now let’s put our cursor on the Create User field and press F9 to move all those audit stamp fields to the next line.

Screen Shot 10-14-15 at 10.07 AM

OK so what I have done in the above screen shot is move the stamp fields to the second line, and I have cleaned up the column headings and positions. Now if I want the subfile to be drop/fold enabled I need to do the following,

First press Shift + F5, F17 to go into the Display Screen Formats display.

Screen Shot 10-14-15 at 10.09 AM

From here use option Z over the Subfile control format.

Screen Shot 10-14-15 at 10.10 AM

You’ll notice that in the upper section of the screen there is a new option called Command key for SFLFOLD..:. Here you would specifiy which command key you want to either fold or drop the subfile. In my example I’m going to use F23 or Shift + F11.

NOTE! If you do not have multiple lines on your subfile this option will now show on the display!

OK once you have saved that you can gen and compile the function. The subfile will be initially folded and you can use the F23 command key to drop.

However, Normally we want the subfile initially dropped, and then we can fold using the F23 command key. To do this we need to insert a line of code into our action diagram. See below.

Screen Shot 10-14-15 at 10.15 AM

In the user post Initialize program I’ve added a line of code to set *Subfile mode at the Program context to a condition of *Truncated. This will cause the subfile to be initially dropped, and then when I use my F23 key it will then fold. That’s all you need to do.


Happy Dropping and Folding!