Document Information
__________________________________________________________________
Document Title
Adding a User Input Field to QDSIGNON
Document Description
Question: Can user-defined input fields be added to the sign-on screen for use in user programs?
Answer: The following information shows how to add one user input field to the sign-on screen by carving it out of the UBUFFER field and then uses the new input field in the user's initial program.
Below is a sample DDS for a sign-on screen that has one additional input field called OVERRIDE. The UBUFFER field normally has a size of 128, but since we want to define the OVERRIDE field with a size of 3, we must subtract from the UBUFFER field to keep the total size of the sign-on display file the same size. More user fields could be added by continuing to subtract their size from the UBUFFER field - therefore the total number of characters that can be used to define user input fields on the sign-on screen is 128. Also below is a sample CL program that can be used as a user's initial program to check if '911' has been entered in the new field on the sign-on screen -- if so, the program issues the CHGJOB command to change the run priority to '1'. See the Work Management manual for more information regarding the sign-on screen and the CHGJOB command.
Note: These instructions assume that all objects are created in library QGPL and that all source for DDS, and CL are members in source physical file SIGNON1 in library QGPL. 1 Create the SIGNON1 source physical file. On the OS/400 command line, type the following:
CRTSRCPF FILE(QGPL/SIGNON1) TEXT('New signon')
2 Use PDM (or SEU) to add the source members to file SIGNON1 in library QGPL. The members to be added include the following:
MYSIGNON Type: DSPF
MYINIT Type: CLP
The source listings for the members follow these instructions.
3 Compile the new sign-on display. On the OS/400 command line, type the following:
CRTDSPF FILE(QGPL/MYSIGNON) SRCFILE(QGPL/SIGNON1) MAXDEV(256)
4 Compile the MYINIT CL program. On the OS/400 command line, type the following:
CRTCLPGM PGM(QGPL/MYINIT) SRCFILE(QGPL/SIGNON1)
5 Add the new initial program to your user profile. On the OS/400 command line, type the following:
CHGUSRPRF USRPRF(your profile name here) INLPGM(QGPL/MYINIT)
6 You are now ready to test the new sign-on display. If you have a subsystem that is used by only a few workstations, you could test it there. Otherwise, it is recommended to create a test subsystem with only one or two workstations defined in the workstation entries to test new sign-on displays.
Caution: Do not use QCTL, QBASE, or QINTER for your first test.
To have a subsystem named TESTSBS use the new sign-on, on the OS/400 command line type the following:
CHGSBSD SBSD(TESTSBS) SGNDSPF(QGPL/MYSIGNON)
7 Once you have started the test subsystem, you should now see the new OVERRIDE field on the signon screen for the workstation(s) allocated by TESTSBS. Type your user ID, password and put 911 in the OVERRIDE field and press enter. Now if you use the DSPJOB command and take option 3 to display Job Run Attributes, you should see your job's run priority is now '1' instead of '20'.
The following listing shows DDS for a modified sign-on screen that displays an extra input field called OVERRIDE.
Member: MYSIGNON
Type: DSPF
.....AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions+++++++++++++++++++++++++++
A DSPSIZ(24 80 *DS3)
A R SIGNON
A CLEAR
A BLINK
A 1 23' Sign On '
A DSPATR(HI)
A 2 48'System . . . . . :'
A COLOR(TRQ)
A SYSNAME 8A O 2 70COLOR(TRQ)
A 3 48'Subsystem . . . . :'
A COLOR(PNK)
A SBSNAME 10A O 3 70COLOR(PNK)
A 4 48'Display . . . . . :'
A COLOR(PNK)
A DEVNAME 10A O 4 70COLOR(PNK)
A 2 3'User . . . . . . . :'
A COLOR(YLW)
A USERID 10A B 2 27COLOR(YLW)
A 01 3 3'Password . . . . . :'
A COLOR(YLW)
A 01 PASSWRD 10A I 3 27DSPATR(ND)
A 4 3'Program/procedure . :'
A COLOR(PNK)
A PROGRAM 10A B 4 27CHECK(LC)
A COLOR(PNK)
A 5 3'Menu . . . . . . . :'
A COLOR(PNK)
A MENU 10A B 5 27CHECK(LC)
A COLOR(PNK)
A 6 3'Current library . . :'
A COLOR(PNK)
A CURLIB 10A B 6 27CHECK(LC)
A COLOR(PNK)
A 02 QSNERROR 80A O 24 1DSPATR(HI)
A COPYRIGHT 40A O 24 40DSPATR(HI)
A 6 48'OVERRIDE . . . . . :'
A COLOR(RED)
A OVERRIDE 3A B 6 70CHECK(LC)
A COLOR(RED)
A UBUFFER 125A H
****************** End of data *************************************************
The following listing shows CL for an initial program to change the job's run priority if it finds '911' was entered in the new OVERRIDE field on the sign display.
Member: MYINIT
Type: CLP
*************** Beginning of data **********************************************
PGM
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(260) /* MESSAGE DATA */
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) /* MESSAGE ID */
DCL VAR(&USERDTA) TYPE(*CHAR) LEN(12

/* */
/* RECEIVE THE CPF1124 MESSAGE TO OBTAIN THE USER PORTION OF THE */
/* SIGN-ON DISPLAY. NOTE THAT THE MESSAGE IS NOT REMOVED SO THAT */
/* IT WILL BE AVAILABLE TO THE JOB LOG. THE MESSAGE ID IS ALSO */
/* RETRIEVED TO ENSURE THAT THE MESSAGE IS CPF1124. */
/* */
RCVMSG PGMQ(*EXT) RMV(*NO) MSGDTA(&MSGDTA) MSGID(&MSGID)
IF COND(&MSGID *EQ 'CPF1124') THEN(CHGVAR VAR(&USERDTA) +
VALUE(%SST(&MSGDTA 133 3)))
/* */
/* IF THE FIRST 3 CHARACTERS OF THE USER DATA (OVERRIDE FIELD) ARE 911*/
/* THEN CHANGE JOB PRIORITY */
/* */
IF COND(&USERDTA *EQ '911') THEN(CHGJOB RUNPTY(1))
ENDPGM
****************** End of data *************************************************
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/