Question

  Asked: Jan 22 2008   4:36 PM GMT
  Asked by: Floyd02


Clearing a subfile screen


Subfile

I have a load-all subfile that offers the user an Fkey to only display records that contain a predetermined value in a specific field.

Here's the problem; If the user presses the Fkey and there are no records that contain the value required to select the record for display, I present the user with a message stating there were no records found but they are still looking at the records initially displayed, loaded before they pressed the Fkey.

How do I clear the screen so the user does not see these initial records that now give them a conflicting situation - a message stating there are no records and a screen full of old records?

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
+1
Click to Vote:
  •   1
  •  0



Without knowing the sequence of IO operations you're using it's difficult to give a precise answer.

One approach would be to write a record format (perhaps the subfile control record but not the subfile itself) that is not using the OVERLAY keyword. Not having OVERLAY would cause the display image to be tossed. Another would be to rewrite the subfile control record and subfile after using SFLINZ. Or using SFLCLR and writing a 'end of list' subfile entry. There are really quite a few ways to get rid of that data -- it just depends on what you want to end up with on the display device.

Bruce Vining
http://www.brucevining.com/
  • AddThis Social Bookmark Button

Browse more Questions and Answers on AS/400.

Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Floyd02  |   Jan 23 2008  2:24PM GMT

Sorry, I should have added that my subfile is in a window with record selection including update and delete.

Could I use a duplicate subfile control record without the overlay keyword since the main one does have the keyword in effect?

 

Floyd02  |   Jan 23 2008  3:14PM GMT

I conditioned the Overlay keyword on the SFL control record to be off when there are no records to display. Now, my message stating there are no records displays above an empty SFL. The only problem now is the function key record is no longer displayed. This is better than what I had but I would like to see the Fkey record somehow.

 

Birddon  |   Jan 23 2008  3:24PM GMT

You can use the ERASE keywords conditioned on when you don’t display the subfile.
Think of it as SFLCLR working in the virtual file and ERASE working on the screen in memory.

 

Sloopy  |   Jan 23 2008  3:45PM GMT

The method I use is to create a format which overlays the subfile:

A R <a href="mailto:D@NDT1">D@NDT1</a> TEXT('No data in subfile')
A OVERLAY PUTOVR
A 10 30' '

Then, in the code:

C Write <a href="mailto:D@FOOT">D@FOOT</a> Footer
C Write <a href="mailto:D@MSGCTL">D@MSGCTL</a> Messages
C N14 Write <a href="mailto:D@NDT1">D@NDT1</a> No Subfile
C Exfmt <a href="mailto:D@SF1C">D@SF1C</a> Sfl Control screen

If 14 is OFF, there are (now) no records in the subfile, and the “no data” format overlays the subfile, which clears it off the screen.

Regards!

 

Sloopy  |   Jan 23 2008  3:49PM GMT

Wow, this text editor is savage!

Er…. the code sample in my previous post has been mauled by the editor. It appears that the “@” symbol is taken to be an email address. Please look at it like this (”at” symbol replaced by #) :

C Write D#FOOT Footer
C Write D#MSGCTL Messages
C N14 Write D#NDT1 No Subfile
C Exfmt Sfl Control screen

I hope that is clearer.

 

Floyd02  |   May 30 2008  1:58PM GMT

Birddon,
I don’t know if your monitoring this thread any more due to it’s age but I used your idea on another SFL where I had a SFLMSG being displayed on line 18 of a 24 line display, above the FKey’s and below the last line of the SFL.
Using the other methods described in this thread caused me to lose the SFLMSG and the FKey’s. Your method of conditioning the ERASE keyword with the off indicator for the SFLDSP keyword worked perfectly, exactly what I was looking for - Thanks again.