SNGCHCFLD/MLTCHCFLD DSPF Keywords

This commit is contained in:
SJLennon 2025-02-18 16:47:31 -05:00
parent 767f049453
commit 5281c895f1
8 changed files with 99 additions and 0 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"markdown.validate.enabled": true
}

View File

@ -123,3 +123,6 @@ Developer Utilities.
RC - Display File Record count
## SNGCHCFLD/MLTCHCFLD DSPF Keywords
A demo program to show how to protect such fields.

31
SNGCHCFLD/Booth.DSPF Normal file
View File

@ -0,0 +1,31 @@
DSPSIZ(24 80 *DS3)
ERRSFL
MSGLOC(24)
CA03(03 'Exit')
R FMT01
A F1 2Y 0B 3 03SNGCHCFLD
A CHOICE(1 'Choice 1 ')
A CHOICE(2 '>Choice 2 ')
A CHOICE(3 'Choice 3 ')
A CHOICE(4 'Choice 4 ')
A CHOICE(5 'Choice 5 ')
A 01 CHOICE(6 'Choice 6 ')
A CHOICE(7 'Choice 7 ')
A CHCCTL(1 &CHGCTL1)
A CHCCTL(2 &CHGCTL2)
A CHCCTL(3 &CHGCTL3)
A CHCCTL(4 &CHGCTL4)
A CHCCTL(5 &CHGCTL5)
A CHCCTL(6 &CHGCTL6)
A CHCCTL(7 &CHGCTL7)
A CHCUNAVAIL((*COLOR WHT))
A CHGCTL1 1Y 0H
A CHGCTL2 1Y 0H
A CHGCTL3 1Y 0H
A CHGCTL4 1Y 0H
A CHGCTL5 1Y 0H
A CHGCTL6 1Y 0H
A CHGCTL7 1Y 0H
A F2 30A O 11 03COLOR(WHT)
A F3 30A O 12 03COLOR(WHT)
23 3'F3=Exit' COLOR(BLU)

28
SNGCHCFLD/Booth.RPGLE Normal file
View File

@ -0,0 +1,28 @@
**free
Ctl-Opt option(*nodebugio) dftactgrp(*no) actgrp(*caller);
Dcl-F BOOTH WORKSTN;
F1=7; // Prime Choice 7 as first default
dow *inkc = *off; // Loop until F3
*in01 = not(*in01); // Flip Choice 6 off and on
// Set choice control values
CHGCTL1 = 0; // Available
CHGCTL2 = 1; // On output means "Selected"???
CHGCTL3 = 2; // Unavailable except if help is available
CHGCTL4 = 3; // Unavailable but can place cursor
CHGCTL5 = 4; // Never available
CHGCTL6 = 0; // Available
CHGCTL7 = 0; // Available
// Show the current default
if F1 = 0;
F3 = 'There is no default Choice';
else;
F3 = 'Default Choice is ' + %char(F1);
endif;
// Display screen
exfmt FMT01;
//Show chosen choice
F2 = 'Last Choice was ' + %char(F1);
enddo;
*inlr = *on;
return;

BIN
SNGCHCFLD/Images/booth1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
SNGCHCFLD/Images/booth2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
SNGCHCFLD/Images/booth3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

34
SNGCHCFLD/README.MD Normal file
View File

@ -0,0 +1,34 @@
## SNGCHCFLD/MLTCHCFLD DSPF Keywords
The question asked was "How can I use the keywords SNGCHCFLD/MLTCHCFLD in protected mode?"
I had never used these pseudo graphical 5250 features, so all I could initially do was point to the IBM documentation for [SNGCHCFLD (Single-Choice Selection Field)](https://www.ibm.com/docs/en/i/7.5?topic=dkedfp4t8-sngchcfld-single-choice-selection-field-keyword-display-files) and
[MLTCHCFLD (Multiple-Choice Selection Field)](https://www.ibm.com/docs/en/i/7.5?topic=dkedfp4t8-mltchcfld-multiple-choice-selection-field-keyword-display-files) keywords.
Another user pointed to the [CHCCTL](https://www.ibm.com/docs/en/i/7.5?topic=80-chcctl-choice-control-keyword-display-files) documentation.
I remembered that the late Booth Martin had extensive DSPF examples at his [website](https://martinvt.pocnet.net/index.html).
Based on what Booth had done, I created this program to demonstrate what could be done to hide and protect single choice selections fields.
When program BOOTH is called, the display looks like this, with Choice 7 already selected by default:
![alt text](./Images/booth1.png)
Select a choice with your mouse of using the down and up arrow keys and the space bar.
Selecting Choice 2 and pressing enter show this:
![alt text](./Images/booth2.png)
Every other time you press enter Choice 6 appears or disappears, by flipping *IN01.
If you clear the default selection and make no selection, then zero is returned for that choice:
![alt text](./Images/booth3.png)
### Booth.DSPF
The display file.
### Booth.RPGLE
A *minimal* program to drive the display file, deliberatly kept short.