IBMi (AS400) fans only ‘ How to check the display size on 5250 screen. *DS3 80 columns or *DS4 132 columns




#IBMiSample



In this example CHKDS4.RPGLE detects the screen setting.

As an example I propose a CLP that calls PGM1 if the setting of 80 columns is detected, or calls PGM2 if the setting of 132 columns is detected.


             PGM                                         
                                                         
             DCL        VAR(&ROW) TYPE(*CHAR) LEN(5)     
             DCL        VAR(&COL) TYPE(*CHAR) LEN(5)     
                                                         
             CALL       PGM(CHKDS4) PARM(&ROW &COL)      
                                                         
            /* DISPLAY  80 COLUMNS */                    
            IF         COND(&COL *EQ '00080') THEN(CALL +
                         PGM(PGM1))                      
                                                         
            /* DISPLAY 132 COLUMNS */                    
            IF         COND(&COL *EQ '00132') THEN(CALL +
                         PGM(PGM2))                      
                                                         
             ENDPGM                                      






This is the display which simply writes X to row 2 column 2
whether the display is set to 80 columns or 132 columns.


CHKDS4.DSPF


     A                                      DSPSIZ(27 132 *DS4 +
     A                                             24 80 *DS3)  
     A          R SCREEN                                        
     A                                  2  2'X'                 
     A                                                          













This is the RPGFREE program that check the infds ScreenSize values position 152 and 154.

CHKDS4.RPGLE


**free                                               
//********************************                   
//chk ScreenSize 80/132 colonne  *                   
//********************************                   
dcl-f CHKDS4V workstn infds(ScreenSize) ;            
                                                     
dcl-ds ScreenSize qualified ;                        
  Rows int(5) pos(152) ;                             
  Columns int(5) pos(154) ;                          
end-ds ;                                             
                                                     
dcl-pi CHKDS4;                                       
  p_Rows char(5);                                    
  p_Columns char(5);                                 
end-pi;                       
                
  p_Rows    = %editc(ScreenSize.Rows   :'X');        
  p_Columns = %editc(ScreenSize.Columns:'X');        
*inlr = *on ;                                        





I appreciate all the comments made on this blog.


Comments

  1. alternate way to determine the device display size without opening a dspf.
    pardon the spacing...


    DCL &supp *CHAR 1
    CALLPRC PRC('QsnQryModSup') PARM(('4') (&SUPP) (*OMIT) (*OMIT))
    if cond(&supp = '0') then(do) /* only 24x80 screen support */



    * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    * Procedure to check if a given screen mode is valid. The
    * first argument, Mode, can be '3' for 24x80 or '4' for 27x132.
    P ChkScrMode B Export

    D ChkScrMode PI N
    D Mode 1A Const

    D IsValid S 1A

    D QryMode PR ExtProc( 'QsnQryModSup' )
    D DspMode 1A Const
    D IsValid N
    D Handle 10I 0 Options( *Omit )
    D ErrorDS Options( *Omit: *Varsize )
    D Like( ApiErrorDS )

    C Callp QryMode( Mode: IsValid: *Omit: *Omit )
    C Return IsValid
    P ChkScrMode E

    ReplyDelete

Post a Comment

Popular posts from this blog

IBMi (AS400) fans only ‘ Memories (IBM Coding Forms)

IBMi (AS400) fans only ' SQLCODE values: Dear readers, unleash your suggestions!