RobertMack
31-03-23, 15:30
Musste einfach nachfragen...
"What would this combination of DSPATR with a user-defined format or edit code look like? Can I have an example?"
Yes, you can use the DSPATR attribute in combination with a user-defined format or an edit code to display a field value with asterisks instead of blanks. Here's an example:
Suppose you have a display file that contains a field named FLD1. You want to display the value of FLD1 with asterisks instead of blanks when using DSPATR(ND).
Using a User-Defined Format:
You can define a user-defined format that converts all characters to asterisks. Here's an example:
A R MYSCREEN
A DSPATR(ND)
A FLD1 10A DSPATR(ND) DSPATR(*UCASE) FORMAT(FLD1AST)
A ALARM
A OVERLAY
A ERASE
A CLEAR
A EXFMT MYSCREEN
A FLD1AST UF A
A OVRPRTF OVRFLD(FLD1AST *PRTDTA)
A N25 EVAL FLD1AST = %SST(FLD1:1:10)
A N30 EVAL FLD1AST = %TRNFMT(*BLANK:'*':FLD1AST)
A N35 ENDIF
In this example, the user-defined format FLD1AST is defined with the UF keyword. It takes the value of the FLD1 field and converts all characters to asterisks. The EVAL operation at line N30 uses the %TRNFMT built-in function to replace all blanks in the FLD1AST value with asterisks.
When you specify DSPATR(ND) for the FLD1 field, the value of the field will be suppressed and replaced with the value generated by the user-defined format, which is the FLD1AST field with asterisks.
Using an Edit Code:
You can define an edit code that replaces all blanks with asterisks. Here's an example:
A R MYSCREEN
A DSPATR(ND)
A FLD1 10A DSPATR(ND) DSPATR(*UCASE) EDTWRD('*' X)
A ALARM
A OVERLAY
A ERASE
A CLEAR
A EXFMT MYSCREEN
In this example, the EDTWRD keyword is used to define an edit code that replaces all blanks with asterisks. When you specify DSPATR(ND) for the FLD1 field and EDTWRD('*' X) for the EDTWRD keyword, the value of the field will be suppressed and replaced with asterisks.
"What would this combination of DSPATR with a user-defined format or edit code look like? Can I have an example?"
Yes, you can use the DSPATR attribute in combination with a user-defined format or an edit code to display a field value with asterisks instead of blanks. Here's an example:
Suppose you have a display file that contains a field named FLD1. You want to display the value of FLD1 with asterisks instead of blanks when using DSPATR(ND).
Using a User-Defined Format:
You can define a user-defined format that converts all characters to asterisks. Here's an example:
A R MYSCREEN
A DSPATR(ND)
A FLD1 10A DSPATR(ND) DSPATR(*UCASE) FORMAT(FLD1AST)
A ALARM
A OVERLAY
A ERASE
A CLEAR
A EXFMT MYSCREEN
A FLD1AST UF A
A OVRPRTF OVRFLD(FLD1AST *PRTDTA)
A N25 EVAL FLD1AST = %SST(FLD1:1:10)
A N30 EVAL FLD1AST = %TRNFMT(*BLANK:'*':FLD1AST)
A N35 ENDIF
In this example, the user-defined format FLD1AST is defined with the UF keyword. It takes the value of the FLD1 field and converts all characters to asterisks. The EVAL operation at line N30 uses the %TRNFMT built-in function to replace all blanks in the FLD1AST value with asterisks.
When you specify DSPATR(ND) for the FLD1 field, the value of the field will be suppressed and replaced with the value generated by the user-defined format, which is the FLD1AST field with asterisks.
Using an Edit Code:
You can define an edit code that replaces all blanks with asterisks. Here's an example:
A R MYSCREEN
A DSPATR(ND)
A FLD1 10A DSPATR(ND) DSPATR(*UCASE) EDTWRD('*' X)
A ALARM
A OVERLAY
A ERASE
A CLEAR
A EXFMT MYSCREEN
In this example, the EDTWRD keyword is used to define an edit code that replaces all blanks with asterisks. When you specify DSPATR(ND) for the FLD1 field and EDTWRD('*' X) for the EDTWRD keyword, the value of the field will be suppressed and replaced with asterisks.