Rispondi o aggiungi un tuo commento

Attivare un PrintScreen da RPG

Inserito il 21/02/2005


Richiesta:
E' possibile attivare un PrintScreen da RPG come se fosse stato premuto l'apposito tasto del programma di emulazione ?
La cosa mi servirebbe per alcune procedure di debug e controllo errore.




Riposta_1:
Eccoti un piccolo programmino RPG chiamato dal un apposito CLP e due Display File da compilare e richiamare per simulare un print-screen di una qualsiasi schermata 80x24:



--- DSPF: PRTD1
     A          R FMT1                      KEEP
     A            ZBUF        9999   H


--- DSPF: PRTD2
     A          R FMT1                      USRDFN KEEP
     A          R DUMMY
     A            DUMMY       9999   H


--- CL-program PRTC:
             PGM
             OVRDSPF    FILE(PRTD1) TOFILE(PRTD2) LVLCHK(*NO)
             CALL       PRT
             ENDPGM


--- RPGLE-program PRT:
     FPRTD1     CF   E             WORKSTN INFDS(WWINFO)
     FQPRINT    O    F  378        PRINTER OFLIND(*INOF)
     D*
     D D               S              1    DIM(9999)     DISPLAY-DATA
     D*
     D LIN             S              1    DIM(80)   DISPLAY-LINIE
     D*
     D PLI             S              1    DIM(378)  PRINT-LINIE
     D PUL             S              1    DIM(378)  PRINT-UL
     D PHI             S              1    DIM(378)  PRINT-HI
     D*
     D WWINFO          DS
     D  WBUFLN               283    286B 0
     D*
     D WWBIN           DS
     D  WBIN1                  1      2B 0 INZ(0)
     D*
     D XFUNC           DS          9999
     D WWUL            DS
     D   UL                    1     80
     D                                     DIM(80)  DSPATR(UL)
     D WWHI            DS
     D   HI                    1     80
     D                                     DIM(80)  DSPATR(HI)
     D*
     D ZLIN            DS           378
     C*
     C* - SAVE-IMMIEDIATE: (X'02):
     C     X'04'         CAT       X'02'         XFUNC
     C                   Z-ADD     2             XLEN              5 0
     C                   EXSR      SNDRCV
     C*
     C* - READ-IMMIEDIATE: (X'72):
     C     X'04'         CAT       X'72'         XFUNC
     C                   Z-ADD     2             XLEN              5 0
     C                   EXSR      SNDRCV
     C     X'00'         CAT       D(1)          WWBIN
     C                   Z-ADD     WBIN1         XLIN              3 0
     C     X'00'         CAT       D(2)          WWBIN
     C                   Z-ADD     WBIN1         XKOL              3 0
     C*
     C* - READ-SCREEN(X'62):
     C     X'04'         CAT       X'62'         XFUNC
     C                   Z-ADD     2             XLEN              5 0
     C                   EXSR      SNDRCV
     C*
     C* - Print page:
     C                   EXSR      PRTPAG
     C                   SETON                                        LR
     C                   RETURN
     C/EJECT
     C     PRTPAG        BEGSR
     C*
     C* - Print line 1-25:
     C     1             DO        1921          XLSP              5 0
     C*
     C                   MOVEA     D(XLSP)       LIN
     C                   EXSR      PRTATR
     C*
     C* - Print line:
     C                   MOVEA     LIN           PLI(1)
     C                   MOVEA     UL            PUL(1)
     C                   MOVEA     HI            PHI(1)
     C     WWUL          COMP      *BLANK                             2121 
     C     WWHI          COMP      *BLANK                             2222
     C     *IN21         IFEQ      '1'
     C     *IN22         OREQ      '1'
     C                   SETON                                        20
     C                   ELSE
     C                   SETOFF                                       20
     C                   END
     C                   EXCEPT    PRINT
     C*
     C                   END       080
     C*
     C                   ENDSR
     C/EJECT
     C     PRTATR        BEGSR
     C*
     C                   MOVE      *BLANK        UL
     C                   MOVE      *BLANK        HI
     C*
     C     1             DO        080           XP                3 0
     C*
     C* - DSPATR:
     C     LIN(XP)       IFLT      *BLANK
     C     LIN(XP)       ANDNE     X'00'
     C                   MOVE      LIN(XP)       QATR              1
     C                   MOVE      *BLANK        LIN(XP)
     C                   MOVE      *BLANK        XUL               1
     C                   MOVE      *BLANK        XHI               1
     C*
     C* - DSPATR(CS) = UL:
     C                   TESTB     '3'           QATR                     99 = ON
     C   99              MOVE      'X'           XUL
     C*
     C* - DSPATR(UL) = UL:
     C                   TESTB     '5'           QATR                     99 = ON
     C   99              MOVE      'X'           XUL
     C*
     C* - DSPATR(HI) = HI:
     C                   TESTB     '6'           QATR                     99 = ON
     C   99              MOVE      'X'           XHI
     C*
     C* - DSPATR(RI) = UL+HI:
     C                   TESTB     '7'           QATR                     99 = ON
     C     *IN99         IFEQ      '1'
     C                   MOVE      'X'           XUL
     C                   MOVE      'X'           XHI
     C                   END
     C*
     C                   ELSE
     C*
     C* - Replace X'00' + data in DSPATR(ND) field with blank:
     C     LIN(XP)       IFEQ      X'00'           X'00 = BLANK
     C     QATR          OREQ      X'27'          DSPATR(ND)
     C                   MOVE      *BLANK        LIN(XP)
     C                   END
     C*
     C* - Data:
     C     XUL           IFEQ      'X'
     C                   MOVE      '_'           UL(XP)
     C                   END
     C     XHI           IFEQ      'X'
     C                   MOVE      LIN(XP)       HI(XP)
     C                   END
     C*
     C                   END
     C*
     C                   END
     C*
     C                   ENDSR
     C/EJECT
     C     SNDRCV        BEGSR
     C*
     C* - BYTE 0-1: OUTPUT-DATA-STREAM-LENGTH:
     C                   Z-ADD     XLEN          WBIN1
     C                   MOVEL     WWBIN         D(1)
     C                   MOVE      WWBIN         D(2)
     C*
     C* - BYTE 2-3: MAX-INPUT-DATA-LENGTH: (D'9999):
     C                   Z-ADD     9999          WBIN1
     C                   MOVEL     WWBIN         D(3)
     C                   MOVE      WWBIN         D(4)
     C*
     C* - BYTE 4: REQUESTED-FUNCTION: SEND/RECEIVE(X'73):
     C                   MOVE      X'73'         D(5)
     C*
     C* - OUTPUT-DATA-STREAM: ESC(X'04), FUNCTION:
     C                   MOVEA     XFUNC         D(6)
     C*
     C                   MOVEA     D(1)          ZBUF
     C                   EXFMT     FMT1
     C                   MOVEA     ZBUF          D(1)
     C*
     C                   ENDSR
     OQPRINT    E   N20      PRINT       1
     O                       PLI
     OQPRINT    E    20      PRINT       1
     OQPRINT    E    21      PRINT       0
     O                       PUL
     OQPRINT    E    22      PRINT       0
     O                       PHI
     OQPRINT    E    20      PRINT       0
     O                       PLI
     OQPRINT    E            BLANK       1
     OQPRINT    E            PRTZLN      1
     O                       ZLIN


Best Regards
Henrik

Risposte / commenti


25-01-2012 Estrazione testo schermata AS400

Io avrei bisogni di fare la stessa cosa ma da una macro.
Ho utilizzato il comando:
autECLSession.autECLPS.SendKeys "[printhost]"
ma questo mi genera puoi una stampa sulla coda di stampa dell'AS400. Come posso evitare la stampa?
Grazie

Rispondi o aggiungi un tuo commento
FAQ400
Faq400.com©2014 Telnext S.r.l. - CCIAA, C.F. e P.IVA 00918770140 - Cap.Soc. Euro 10.000,00 i.v. - Tutti i diritti riservati
Pubblicità su Faq400 | Note legali| Privacy policy | Realizzato da Telnext