Question

  Asked: Feb 12 2008   2:10 AM GMT
  Asked by: GHENDER


Multiple Sorts Without Using Multiple Function Keys


RPG, RPGLE, Subfile

When doing WRKACTJOB, you can put the cursor over the column you wish to sort and then press F16. I have a subfile program with multiple sorts and presently the user has to press different function keys to sort. Can anyone give me an example of the code to use so my program will act like that in WRKACTJOB? My users do not want to have to press the different function keys to sort.

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
0
Click to Vote:
  •   0
  •  0



The DDS keyword RTNCSRLOC has the option to return to your program the field (including subfile fields) that the cursor is in when a function key is pressed. You can test this field to determine what column your user wants to sort on.

One item to watch out for -- the subfile column headings in a subfile control record are often constants rather than fields. If the user asks for sorting when the cursor is in a constant then the field name returned is blank (which makes sense as the cursor isn't in field). You can then either prompt them to put the cursor in a "valid" place or test the actual location of the cursor yourself. Alternatively, you can make the column headings a field to simplify processing.
  • 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

Burtmis  |   Feb 12 2008  3:41PM GMT

I use SQLRPGLE to sort my subfiles. I give the users one command key to press and once there they can sort by one or more colums that I have set up. It probaly would not be any problem to use cursor location instead of a sort screen. It you are interested in the coding let me know.