AS/400 Error handling for multiple selection in subfile

85 pts.
Tags:
AS/400
AS/400 Subfiles
I want to throw error message, when user selects multiple options in a subfile field with '1' as  valid selection. In this for all records in the subfile, I need to select only one record at time, but not multiple records. Suggest any DDS keyword/function which will validate only one selection, but it should throw error message when multiple selections are entered.

Answer Wiki

Thanks. We'll let you know when a new response is added.

SFLSNGCHC (Subfile Single Choice Selection List) keyword for display files

Use this record-level keyword to define a subfile as a single-choice-selection list. A single-choice-selection list is a scrollable group of items from which the user can select one item.

The format of this keyword is:
SFLSNGCHC[([*NORSTCSR | *RSTCSR] [*NOSLTIND | *SLTIND]
[*NOAUTOSLT | *AUTOSLT | *AUTOSLTENH])]

Parameters are optional and can be entered in any order.

The *RSTCSR parameter specifies whether the arrow keys should be allowed to move the selection cursor outside of the field. *RSTCSR specifies that the arrow keys will not cause the selection cursor to move outside of the selection list field. *NORSTCSR specifies that the arrow keys will cause the selection cursor to leave the field. If the SFLSNGCHC subfile control record is defined in a pulldown, the default is *RSTCSR. Otherwise, the default is *NORSTCSR.

The *SLTIND parameter specifies whether selection indicators are used when this selection list is displayed on a graphical display. *SLTIND specifies that the radio buttons should be used on graphical color displays as selection indicator. *NOSLTIND specifies that no selection indicator should be used on a graphical color display and only a selection cursor can be used to make a selection. The default is *NOSLTIND.

The *AUTOSLT parameter indicates if the ENTER key should automatically select the choice currently being indicated by the selection cursor. *NOAUTOSLT indicates that the user must select the choice. *AUTOSLTENH indicates that auto-select is only in effect if the device is connected to an enhanced controller. If the SFLSNGCHC subfile control record is defined in a pulldown, the default is*AUTOSLT. Otherwise, the default is *NOAUTOSLT.

A subfile containing the SFLSNGCHC keyword must:
  • Contain only one output field
  • Cannot contain input capable fields
  • Can contain hidden fields

This optional keyword is valid only for the subfile control record format.

The following subfile control record keywords cannot be specified on a record with the SFLSNGCHC keyword:

SFLDROP
SFLFOLD
SFLMLTCHC

 

The CHCAVAIL, CHCSLT and CHCUNAVAIL keywords can be used to indicate the color of the items within the selection list, when the list is displayed on a color display station. The CHCAVAIL keyword indicates the color of the items within the list which are available for selection. The CHCSLT keyword indicates the color of the selected item. The CHCUNAVAIL keyword indicates the items on the list which are not available for selection. These keywords can be used in a subfile control record only if SFLSNGCHC or SFLMLTCHC keywords are also used.

Option indicators are not valid for this keyword.

Example 1

The following example shows how to specify the SFLSNGCHC keyword:

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
     A
     A          R SFLRCD                    SFL
     A            CTLFLD         1Y 0H      SFLCHCCTL
     A            F1            10A  O  6 10
     A          R SFLCTLRCD                 SFLCTL(SFLRCD)
     A                                      SFLSNGCHC
     A                                      SFLPAG(5) SFLSIZ(&SFLSIZ);
     A                                      SFLDSP SFLDSPCTL
     A                                      ROLLUP(10)
     A   10                                 SFLEND(*SCRBAR)
     A            F3             5S 0H      SFLSCROLL
     A            F2             4S 0H      SFLRCDNBR(CURSOR *TOP)
     A            SFLSIZ         5S 0P
     A                                 1 30'Panel Title'
     A                                 4  5'Select One Item:'

In this example, when using a graphical display station attached to a controller that supports an enhanced interface for nonprogrammable workstations, a single-choice list looks like this:

A<br />
figure of the example specification displayed on a graphical display station.

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • CharlieBrowne
    You have at least 2 options.
    1. When you are looping through doing a READC to the SFL., only process one record and ignore the rest, or do the error after you have processed the first record and get a 2nd READC with a '1'
    2. Loop through the whole SFL with READC. When you get the 1st valid '1', add 1 to a counter and save the SFLRECNUM. If you get any other '1's, you can display your error message. If not more READC records, use the SFLRECNUM you saved to chain to the SFL to get the record you want to process.
    41,370 pointsBadges:
    report
  • poojaary
    Hai charlie thax for the reply, but i need to do that validation part with in the display file itself using some keyword/function, but i dont have to handle it programatically.Please tell me whether it is possible or not. thanx in advance
    85 pointsBadges:
    report
  • CharlieBrowne
    There is no way to handle this situation with only a keyword in the DSPF.
    You have to do something in the RPG program. If you code what I described as option 2, it would not create a performance issue, it would be easy to code, and it would do exactly what you want for a DSPF keyword,
    41,370 pointsBadges:
    report
  • Splat
    You can validate the selection with the VALUES keyword.  There is no way to ensure the selection of only one record without programming.
    6,855 pointsBadges:
    report
  • poojaary
    Ooo h is it thank you Charlie and Splat for your replies
    85 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following