Basically, it allows you to view another users screen. It brings up a list of users who are signed on and you select the job you want. It then displays their screen exactly as they see it. It uses a message queue break handling program and data queues to do this. When the user signs on, his job creates a message queue in QRPLOBJ. The message queue name incorporates the job number so it is always unique and can be easily determined. The message queue is set in break mode with the break handling program set to the screen scraper program. When you request to view the screen, a message is sent to that message queue. The break handling/screen scraper program is fired off which gets the current screen and sends it back to your job in a data queue, where it is displayed. The user is not aware this is happening. To get a list of users who are signed on. I simply get a list of message queues in QRPLOBJ. In the version that I use, I have added additional functions to the break handling program so that I can, for example, dump the contents of the QTEMP library, or sign off the job. Once the break handling program takes control, the sky's the limit. ---------- I have my original problem fixed,( I didn't now you had to first call scrn004cl first) But when I go to view the users screen it waits 60 seconds then it just shows a blank screen. ------------ I didn't know that the files had to be in the users liblist -------- We have it working under 440. We had to move the Dataq objects from QRPLOBJ to another library as QRPLOBJ isn't cleared the way it was in previous releases. We just made a USRSCN library clear it in our QSTRUP. We have the luxury of IPLing every night. I believe that was the only issue to get it working. *********************************************************************** * Readme * *********************************************************************** * Midrange Computing Programs Associated With Article * * * * Published in the March, 1996 Issue * *********************************************************************** * Transfer to AS/400 Instructions * *********************************************************************** This data file contains the source members for the Midrange Computing article you requested. In order to use these programs, you should have the corresponding text from the magazine. Once this file is on your AS/400, the following steps need to be performed to get each source member to a state from which you can compile them. 1) Copy this data file to a source physical file as a single member using the CPYF command being sure to use the FMTOPT value of *CVTSRC and the SRCOPT values of *SEQNBR and *DATE. Here is an example of a CPYF command that would work for downloaded file B088905: CPYF FROMFILE(B088905) TOFILE(your library/your source file) + MBROPT(*ADD) FMTOPT(*CVTSRC) SRCOPT(*SEQNBR *DATE) 2) Read the section below labeled "Members in File" to determine the members and their type that will have to be created by SEU. You will create each member in the list and include the corresponding section of this file that contains the member. Determining the beginning and end of a member is done by searching for the beginning statements: *********************************************************************** * Begin member - XXXXXXXXXX, Type - XXXXXXXXXX * *********************************************************************** and ending statements: *********************************************************************** * End member - XXXXXXXXXX * *********************************************************************** Include all statements between these two statements in your created member. 3) Compile each member. Use PDM or the appropriate CRTxxxxxxx command. 4) Delete the data file originally downloaded and the source member created in step one. ************************ IMPORTANT NOTICE ***************************** The programs you have downloaded were originally published in a previous issue of Midrange Computing. We do not recommend using any programs without the text from the original article. Installation and use of these programs without the associated text is done so entirely at your own risk. Back issues of Midrange Computing are available in hard copy or soft copy (via the Mentor library). The Mentor product contains all back issues, ready for your online search, reading and copying. You can order back issues or the Mentor library by calling 1-800-477-5665. Mentor will contain articles up through the issue published the month prior to your order. *********************************************************************** * --- Members --- * * Source Member Name Source Member Type * *********************************************************************** * DSPUSRSC CMD * * SCN001CL CLP * * SCN001DF DSP * * SCN001RG RPG * * SCN002CL CLP * * SCN003CL CLP * * SCN004CL CLP * * SCN005DF DSP * * SCN005CL CLP * * SCN006DF DSP * *********************************************************************** * Begin Member - DSPUSRSC, Type - CMD * *********************************************************************** /*==================================================================*/ /* To compile: */ /* */ /* CRTCMD CMD(XXX/DSPUSRSCN) PGM(XXX/SCN001CL) + */ /* SRCFILE(XXX/QCMDSRC) */ /* */ /*==================================================================*/ DSPUSRSCN: CMD PROMPT('Display User Screen') *********************************************************************** * End Member - DSPUSRSC * *********************************************************************** *********************************************************************** * Begin Member - SCN001CL, Type - CLP * *********************************************************************** /*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/SCN001CL) SRCFILE(XXX/QCLSRC) */ /* */ /*==================================================================*/ SCN001CL: PGM DCL VAR(&NBR) TYPE(*CHAR) LEN(6) DCL VAR(&DTAQ) TYPE(*CHAR) LEN(10) MONMSG MSGID(CPF0000) /* Create data queue using current job number for screen transfers */ RTVJOBA NBR(&NBR) CHGVAR VAR(&DTAQ) VALUE('DSPD' *CAT &NBR) CRTDTAQ DTAQ(QRPLOBJ/&DTAQ) MAXLEN(1922) AUT(*ALL) OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/QADSPOBJ) CALL PGM(SCN001RG) PARM(&DTAQ) DLTDTAQ DTAQ(QRPLOBJ/&DTAQ) ENDPGM: ENDPGM *********************************************************************** * End Member - SCN001CL * *********************************************************************** *********************************************************************** * Begin Member - SCN001DF, Type - DSP * *********************************************************************** A*=============================================================== A* To compile: A* A* CRTDSPF FILE(XXX/SCN001DF) SRCFILE(XXX/QDDSSRC) A* A*=============================================================== A*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 A DSPSIZ(24 80 *DS3) A CA03 A CA05 A PRINT * List of jobs A R SCN001S1 SFL A S1OPT 1 B 6 3VALUES(' ' '5') A S1JOB 10 O 6 7 A S1USER 10 O 6 19 A S1JOBN 6 O 6 31 A* A R SCN001C1 SFLCTL(SCN001S1) A SFLSIZ(0018) A SFLPAG(0017) A 21 SFLCLR A SFLDSPCTL A 22 SFLDSP A OVERLAY A 1 31'Display User Screen' A DSPATR(HI) A 2 2'Type option, press Enter.' A COLOR(BLU) A 3 3'5=Display screen' A COLOR(BLU) A 5 2'Opt' A DSPATR(HI) A 5 7'Job name ' A DSPATR(HI) A 5 19'User ' A DSPATR(HI) A 5 31'Job # ' A DSPATR(HI) * Footer A R SCN001F1 A 23 2'F3=Exit F5=Refresh' A COLOR(BLU) * Format for displaying user's screen A R SCN001R1 A CSRLOC(ROW COLUMN) A ROW 3 0H A COLUMN 3 0H A SCNDTA 1919 1 2 * Format for displaying job infor on line 24 A R SCN001F2 OVERLAY CLRL(1) A INFO 78 24 2DSPATR(HI) *********************************************************************** * End Member - SCN001DF * *********************************************************************** *********************************************************************** * Begin Member - SCN001RG, Type - RPG * *********************************************************************** *=============================================================== * To compile: * * CRTRPGPGM PGM(XXX/SCN001RG) SRCFILE(XXX/QRPGSRC) * *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 FSCN001DFCF E WORKSTN F S1RRN KSFILE SCN001S1 FQADSPOBJIF E DISK UC E SDTA 1919 1 ISCNDTA DS 1919 IDQDATA DS I 21920 SDTA I 19211921 BINROW I 19221922 BINCOL IODOBTX DS I 1 10 JOBNAM I 11 20 USERID I 21 26 JOBNUM I DS I B 1 20BINVAL I 2 2 BINCHR I 'Job displayed:' C BTXT I 'F3=Exit F5=Refresh -C ETXT I ' Enter=Continue' I 'No qualified interac-C NJMSG I 'tive jobs found.' * C *ENTRY PLIST C PARM DQNAME 10 * Load list of active jobs C EXSR LOAD * Continue until F3 is pressed C *INKC DOUEQ*ON C WRITESCN001F1 C WRITESCN001F2 C EXFMTSCN001C1 C *INKC CASEQ*ON EOJ C *INKE CASEQ*ON LOAD C CAS PROCRQ C ENDCS * C MOVEL*BLANKS INFO C ENDDO ***************************************************************** * Load subfile with list of active jobs C LOAD BEGSR * C MOVE *ON *IN21 C MOVE *OFF *IN22 C WRITESCN001C1 C MOVE *OFF *IN21 C MOVE *ZEROS S1RRN 30 * * Load file with list C CALL 'SCN002CL' C PARM '0' NORCDS 1 C NORCDS IFEQ *OFF C OPEN QADSPOBJ * * Read list and load subfile C *IN90 DOUEQ*ON C READ QADSPOBJ 90 C *IN90 IFNE *ON C MOVE *ON *IN22 C MOVELJOBNAM S1JOB C MOVELUSERID S1USER C MOVELJOBNUM S1JOBN C ADD 1 S1RRN C WRITESCN001S1 C ENDIF C ENDDO * C CLOSEQADSPOBJ C ELSE C MOVELNJMSG INFO C ENDIF C ENDSR ***************************************************************** C PROCRQ BEGSR * Process requests C *IN90 DOUEQ*ON C READCSCN001S1 90 * C *IN90 IFNE *ON * Option 5 = display screen C S1OPT IFEQ '5' C NORCDS ANDEQ*OFF C EXSR DSPSCN C MOVE *BLANK S1OPT C UPDATSCN001S1 C ENDIF C ENDIF C ENDDO * C ENDSR ***************************************************************** * Display user screen C DSPSCN BEGSR * Continue as long as F5 is pressed C *INKE DOUNE*ON * Retrieve the screen C CALL 'SCN003CL' C PARM S1JOBN C PARM DQNAME C PARM *BLANKS DQDATA * * Format data for output C MOVEASDTA SCNDTA * * The text field contains the job information C MOVELBTXT INFO P C INFO CAT S1JOBN:1 INFO C INFO CAT '/':0 INFO C INFO CAT S1USER:0 INFO C INFO CAT '/':0 INFO C INFO CAT S1JOB:0 INFO C INFO CAT ETXT:1 INFO * * Convert row and column from binary C MOVE *ZEROS BINVAL C MOVE BINROW BINCHR C Z-ADDBINVAL ROW C MOVE BINCOL BINCHR C Z-ADDBINVAL COLUMN * * Display the screen C WRITESCN001R1 C EXFMTSCN001F2 * F3 = Exit C *INKC IFEQ *ON C EXSR EOJ C ENDIF C ENDDO C ENDSR ***************************************************************** C EOJ BEGSR C MOVE *ON *INLR C RETRN C ENDSR *********************************************************************** * End Member - SCN001RG * *********************************************************************** *********************************************************************** * Begin Member - SCN002CL, Type - CLP * *********************************************************************** /*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/SCN002CL) SRCFILE(XXX/QCLSRC) */ /* */ /*==================================================================*/ SCN002CL: PGM PARM(&NORCDS) DCL VAR(&NORCDS) TYPE(*CHAR) LEN(1) /* Remove jobs which are inactive (active jobs will lock the MSGQ */ DLTMSGQ MSGQ(QRPLOBJ/DSPM*) MONMSG MSGID(CPF0000) /* Create list of DSPM* MSGQs in QTEMP library */ DSPOBJD OBJ(QRPLOBJ/DSPM*) OBJTYPE(*MSGQ) + OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPOBJ) + OUTMBR(*FIRST *REPLACE) MONMSG MSGID(CPF2123) EXEC(CHGVAR VAR(&NORCDS) + VALUE('1')) ENDPGM: ENDPGM *********************************************************************** * End Member - SCN002CL * *********************************************************************** *********************************************************************** * Begin Member - SCN003CL, Type - CLP * *********************************************************************** /*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/SCN003CL) SRCFILE(XXX/QCLSRC) */ /* */ /*==================================================================*/ SCN003CL: PGM PARM(&JOBNBR &DTAQ &DQDATA) DCL VAR(&JOBNBR) TYPE(*CHAR) LEN(6) DCL VAR(&DQDATA) TYPE(*CHAR) LEN(1922) DCL VAR(&DTAQ) TYPE(*CHAR) LEN(10) DCL VAR(&DQSIZE) TYPE(*DEC) LEN(5 0) DCL VAR(&DQWAIT) TYPE(*DEC) LEN(5 0) VALUE(60) DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10) /* Send message to job to get screen */ CHGVAR VAR(&MSGQ) VALUE('DSPM' *CAT &JOBNBR) SNDMSG MSG(&DTAQ) TOMSGQ(QRPLOBJ/&MSGQ) /* Wait (up to a minute) for the response */ CALL PGM(QRCVDTAQ) PARM(&DTAQ 'QRPLOBJ' &DQSIZE + &DQDATA &DQWAIT) ENDPGM: ENDPGM *********************************************************************** * End Member - SCN003CL * *********************************************************************** *********************************************************************** * Begin Member - SCN004CL, Type - CLP * *********************************************************************** /*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/SCN004CL) SRCFILE(XXX/QCLSRC) */ /* */ /*==================================================================*/ SCN004CL: PGM DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10) DCL VAR(&NBR) TYPE(*CHAR) LEN(6) DCL VAR(&TEXT) TYPE(*CHAR) LEN(50) DCL VAR(&USER) TYPE(*CHAR) LEN(10) DCL VAR(&JOB) TYPE(*CHAR) LEN(10) /* Unique message queue name is 'DSPM' plus job number */ RTVJOBA JOB(&JOB) USER(&USER) NBR(&NBR) CHGVAR VAR(&MSGQ) VALUE('DSPM' *CAT &NBR) /* Put job info in text field */ CHGVAR VAR(&TEXT) VALUE(&JOB *CAT &USER *CAT &NBR) /* Create message queue in QRPLOBJ */ CRTMSGQ MSGQ(QRPLOBJ/&MSGQ) TEXT(&TEXT) AUT(*ALL) /* Set break handling program */ CHGMSGQ MSGQ(QRPLOBJ/&MSGQ) DLVRY(*BREAK) PGM(SCN005CL) ENDPGM: ENDPGM *********************************************************************** * End Member - SCN004CL * *********************************************************************** *********************************************************************** * Begin Member - SCN005DF, Type - DSP * *********************************************************************** *=============================================================== * To compile: * * CRTDSPF FILE(XXX/SCN005DF) SRCFILE(XXX/QDDSSRC) * *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ** Dummy display file for compiling SCN005CL A R SCN005R1 A R1DATA1 1782 B 1 2 A R1DATA2 1782 B 1 2 *********************************************************************** * End Member - SCN005DF * *********************************************************************** *********************************************************************** * Begin Member - SCN005CL, Type - CLP * *********************************************************************** /*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/SCN005CL) SRCFILE(XXX/QCLSRC) */ /* */ /*==================================================================*/ SCN005CL: PGM PARM(&MSGQ &MSGQLIB &MSGREF) DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10) DCL VAR(&MSGQLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGREF) TYPE(*CHAR) LEN(4) DCL VAR(&DTAQ) TYPE(*CHAR) LEN(10) DCL VAR(&DQSIZE) TYPE(*DEC) LEN(5 0) VALUE(1922) DCL VAR(&SCREENDATA) TYPE(*CHAR) LEN(1920) DCL VAR(&DQDATA) TYPE(*CHAR) LEN(1922) DCLF FILE(SCN005DF) /* Receive and remove the data queue name from the message queue */ RCVMSG MSGQ(&MSGQLIB/&MSGQ) RMV(*YES) MSG(&DTAQ) /* If this is a group job the data queue may not exist any more */ CHKOBJ OBJ(QRPLOBJ/&DTAQ) OBJTYPE(*DTAQ) MONMSG MSGID(CPF9801) EXEC(RETURN) /* Retrieve current screen using a UDDS command */ OVRDSPF FILE(SCN005DF) TOFILE(SCN006DF) LVLCHK(*NO) CHGVAR VAR(&R1DATA1) VALUE(X'00021518730462') SNDRCVF RCDFMT(SCN005R1) CHGVAR VAR(&SCREENDATA) VALUE(&R1DATA1 *CAT + &R1DATA2) /* Retrieve cursor location using a UDDS command */ CHGVAR VAR(&R1DATA1) VALUE(X'00021518730472') SNDRCVF RCDFMT(SCN005R1) CHGVAR VAR(&DQDATA) VALUE(&SCREENDATA *CAT &R1DATA1) /* Send the screen to the data queue */ CALL PGM(QSNDDTAQ) PARM(&DTAQ 'QRPLOBJ' &DQSIZE + &DQDATA) ENDPGM: ENDPGM *********************************************************************** * End Member - SCN005CL * *********************************************************************** *********************************************************************** * Begin Member - SCN006DF, Type - DSP * *********************************************************************** *=============================================================== * To compile: * * CRTDSPF FILE(XXX/SCN006DF) SRCFILE(XXX/QDDSSRC) * *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ** Display file for reading current screen * * User defined data streams A R SCN005R1 USRDFN * * Dummy format so buffer size will be correct in file A R SCN005R2 A FILLER1 1782 B 1 2 A FILLER2 1782 B 1 2 *********************************************************************** * End Member - SCN006DF * ***********************************************************************