SNGCHCFLD & MLTCHCFLD Protection

This commit is contained in:
SJLennon
2025-03-29 12:48:28 -04:00
parent ba7ec2812f
commit 57ed98efa4
7 changed files with 157 additions and 46 deletions
+1 -46
View File
@@ -35,24 +35,6 @@
"SQLRPGLE"
]
},
{
"name": "Create C Program",
"command": "CRTBNDC PGM(&CURLIB/&NAME) SRCSTMF('&RELATIVEPATH') OPTION(*EVENTF) DBGVIEW(*SOURCE) TGTCCSID(*JOB)",
"deployFirst": true,
"environment": "ile",
"extensions": [
"C"
]
},
{
"name": "Create C Module",
"command": "CRTCMOD MODULE(&CURLIB/&NAME) SRCSTMF('&RELATIVEPATH') OPTION(*EVENTF) DBGVIEW(*SOURCE) TGTCCSID(*JOB)",
"deployFirst": true,
"environment": "ile",
"extensions": [
"C"
]
},
{
"extensions": [
"CLP",
@@ -91,38 +73,11 @@
},
{
"name": "Create DSPF",
"command": "CRTDSPF FILE(&CURLIB/&NAME) SRCFILE(&SRCFILE) RSTDSP(*YES) OPTION(*EVENTF)",
"command": "CRTDSPF FILE(&CURLIB/&NAME) SRCFILE(&SRCFILE) RSTDSP(*NO) OPTION(*EVENTF)",
"environment": "ile",
"deployFirst": true,
"extensions": [
"dspf"
]
},
{
"name": "Create Panel Group (CRTPNLGRP)",
"command": "?CRTPNLGRP PNLGRP(&CURLIB/&NAME) SRCFILE(&SRCFILE) OPTION(*EVENTF)",
"environment": "ile",
"deployFirst": true,
"extensions": [
"pnlgrp"
]
},
{
"extensions": [
"GLOBAL"
],
"name": "Create Service Program (CRTSRVPGM EXPORT(*ALL))",
"command": "CRTSRVPGM SRVPGM(&CURLIB/&NAME) EXPORT(*ALL) BNDSRVPGM(*NONE) BNDDIR(*NONE) ACTGRP(*CALLER)",
"environment": "ile"
},
{
"extensions": [
"BND",
"BINDER"
],
"deployFirst": true,
"name": "Create Service Program (CRTSRVPGM with source)",
"command": "CRTSRVPGM SRVPGM(&CURLIB/&NAME) SRCSTMF('&RELATIVEPATH') BNDSRVPGM(*NONE) BNDDIR(*NONE) ACTGRP(*CALLER)",
"environment": "ile"
}
]
+52
View File
@@ -0,0 +1,52 @@
A DSPSIZ(24 80 *DSP3)
A CHGINPDFT(HI UL)
A CA03(03 'Exit')
A CA12(12 'Cancel')
A R TESTR
A*%%TS SD 20250329 154927 LENNONS REL-V7R5M0 5770-WDS
A*
A A#SNG1 1Y 0H
A A#SNG2 1Y 0H
A A#SNG3 1Y 0H
A A#SNG1T 5A P
A A#SNG2T 5A P
A A#SNG3T 5A P
A A#MLT1 1Y 0H
A A#MLT3 1Y 0H
A A#MLT2 1Y 0H
A A#MLT1T 5A P
A A#MLT2T 5A P
A A#MLT3T 5A P
A 11 50'Status'
A 11 64'Ship'
A 12 3'Product:'
A PRODUCT 30A B 12 12DSPATR(UL)
A*
A 02 P1DESC 5A O 12 51
A N02 P1ANR 2Y 0B 12 51SNGCHCFLD(*RSTCSR *AUTOSLT *SLTIND -
A (*NUMROW 3))
A N01 CHCAVAIL((*COLOR TRQ) (*DSPATR HI))
A 01 CHCUNAVAIL((*COLOR WHT) (*DSPATR HI-
A ))
A CHOICE(1 &A#SNG1T)
A CHCCTL(1 &A#SNG1)
A CHOICE(2 &A#SNG2T)
A CHCCTL(2 &A#SNG2)
A CHOICE(3 &A#SNG3T)
A CHCCTL(3 &A#SNG3)
A*
A 02 P2DESC1 5A O 12 65
A 02 P2DESC2 5A O 13 65
A 02 P2DESC3 5A O 14 65
A N02 P2INT 2Y 0B 12 65MLTCHCFLD(*RSTCSR *SLTIND (*NUMROW -
A 3))
A N01 CHCAVAIL((*COLOR PNK) (*DSPATR HI))
A 01 CHCUNAVAIL((*COLOR WHT) (*DSPATR HI-
A ))
A CHOICE(1 &A#MLT1T)
A CHCCTL(1 &A#MLT1)
A CHOICE(2 &A#MLT2T)
A CHCCTL(2 &A#MLT2)
A CHOICE(3 &A#MLT3T)
A CHCCTL(3 &A#MLT3)
A 02 MSG 70A O 17 10
+73
View File
@@ -0,0 +1,73 @@
**free
Ctl-Opt option(*nodebugio) dftactgrp(*no) actgrp(*caller);
Dcl-F B2 WORKSTN;
dcl-c O_AVAIL 0;
DCL-C O_SELECTED 1;
DCL-C O_UNAVAIL 4;
DCL-C I_UNSELECTED 0;
DCL-C I_SELECTED 1;
dcl-s j int(10);
dcl-ds SingleDS ; // SNGCHCFLD CHCCTL fields
A#SNG1 ;
A#SNG2 ;
A#SNG3 ;
SingleArr like(A#SNG1) dim(3) pos(1);
end-ds;
dcl-ds SingleTextDS; // Text on the SNGCHCFLD fields
A#SNG1T;
A#SNG2T;
A#SNG3T;
SingleTextArr like(A#SNG1T) dim(3) pos(1);
end-ds;
dcl-ds MultDS; // MLTCHCFLD CHCCTL fields
A#MLT1;
A#MLT2;
A#MLT3;
MultArr like(A#MLT1) dim(3) pos(1);
end-ds;
dcl-ds MultTextDS; // Text for MLTCHCFLD fields
A#MLT1T;
A#MLT2T;
A#MLT3T;
MultTextArr like(A#MLT1T) dim(3) pos(1);
end-ds;
dcl-ds MultTextSel; // Text to re-display the MLTCHCFLD choices
P2DESC1;
P2DESC2;
P2DESC3;
MultTextSelArr like(P2DESC1) dim(3) pos(1);
end-ds;
// Populate the SNGCHCFLD & MLTCHCFLD display values
A#SNG1T = 'Sel 1';
A#SNG2T = 'Sel 2';
A#SNG3T = 'Sel 3';
A#MLT1T = 'Mlt 1';
A#MLT2T = 'Mlt 2';
A#MLT3T = 'Mlt 3';
SingleArr = O_AVAIL; // All SNGCHCFLD Fields available
MultArr = O_AVAIL; // All MLTCHCFLD Fields available
P1ANR = 1; // Set default for SNGCHCFLD
A#MLT1 = O_SELECTED; // Set Default for MLTCHCFLD
// Display for entry
dow (1=1);
*IN02 = *off;
exfmt TESTR;
// Build Confirmation fields
P1DESC = SingleTextArr(P1ANR);
for j = 1 to %elem(MultArr);
if MultArr(j) = I_SELECTED;
MultTextSelArr(j) = MultTextArr(j);
endif;
endfor;
// Confirmation Display
MSG = 'Enter to accept, F12 to Modify';
*in02 = *on;
exfmt TESTR;
if not (*IN12 = *ON);
leave;
endif;
enddo;
*inlr = *on;
return;
+31
View File
@@ -0,0 +1,31 @@
# Experimental Stuff
This is code that may come and go. It is usually minimal and may reflect my usual standards and approach.
## Protection of SNGCHCFLD & MLTCHCFLD Display File keywords
A user asked how to protect SNGCHCFLD and/or MLTCHCFLD fields on a display. As far as I can tell, he wanted to protect the fields on a confirmation screen, before accepting changes.
It seems there is no way to do that, because you cannot use an indicator on these fields.
This is a work around where the the choices are redisplayed as normal fields in place of the SNGCHCFLD & MLTCHCFLD fields.
## B2.DSPF
This is the display file. It is as minimal as possible to demonstrate the process and was cribbed initially for the original questioner's DDS.
The initial display looks like this:
![Initial](./Screen_1.png)
Make entries and choices, perhaps like this:
![Make entries](./Screen_2.png)
Press enter and see this confirmation screen:
![Confirmation](./Screen_3.png)
Press F12 and you are back to the original entry. Enter exits the program.
## B2.RPGLE
The driving RPGLE. The choice fields are in an array and can easily be changed with minimal effort.
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB