Solved

Detecting Current Screen Size (*DS3/*DS4)

Posted on 2006-07-04
12
941 Views
Last Modified: 2008-01-09
I need to be able to automatically detect the screen size (*DS3/*DS4) from within an RPG400 pgm in order that I can select the appropriate screen file for a pop-up warning in a window. The pop-up pgm is a general purpose security checker that is called by all user pgms.

I could add an input parameter but this would mean modifying hundreds of calling pgms. I really do need to be able to detect the screen size being used by the calling pgm so that the pop-up pgm will be the only one to require a change.
0
Comment
Question by:bodger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 14

Expert Comment

by:daveslater
ID: 17037348
Hi
you can use the file informational data structure

D NUM_ROWS                           282 283I 0 * Number of rows
D NUM_COLS                            284 285I 0 * Number of cols



Dave
0
 
LVL 13

Expert Comment

by:_b_h
ID: 17037389
Did you try conditioning the pop-up screen with indicators?

00010A                                      DSPSIZ(27 132 *LARGE 24 80 *NORMAL)
00020A          R RECORDA
00040A            FIELDB        10  0   1120
00050A  *NORMAL                         1 49

This snippet from IBM positions FIELDB depending on the display size.

Barry
0
 

Author Comment

by:bodger
ID: 17037664
Thanks Dave . I must test your solution before commenting further. It looks like RPGLE so I will have to write an external routine (in RPGLE) for the popup pgm, which is RPG400. I have yet to ascertain whether what is returned in the FIDS is the screen capability or the display size set by the calling program.


0
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 

Author Comment

by:bodger
ID: 17037720
Thanks to you too, Barry. However, the DSPSIZ keyword seems to select the screen size according to the capability of the device rather than the size set by the calling pgm. I need two display files, one *DS3 and the other *DS4 and need to be able to select the appropriate file so that the display of the calling program is not cleared before the popup window is displayed.
0
 

Author Comment

by:bodger
ID: 17038843
I get the feeling it would have to be passed as a parameter from the calling display pgm. Thanks for answering. I guess you could split the points between you but I don't know how to do that.
0
 
LVL 13

Expert Comment

by:_b_h
ID: 17039477
Take a look at the Retrieve Display Mode (QsnRtvMod) API which returns the current display mode.  Check out this link:
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/apis/QsnRtvMod.htm


0
 
LVL 13

Accepted Solution

by:
_b_h earned 250 total points
ID: 17039658
Okay, I admit this one was driving me crazy. I tried out the API in a small pgm by calling it inside SEU. When I switch between 24x80 and 27x132, the value returned by the API changes as well, so it is returning the actual display size, not the capability of the device. Yeah!

Here is my test code:

PGM                                                                  
DCL   &DSPMODE     *CHAR    1                                        
DCL   &ENVHANDLE   *CHAR    4                                        
DCL   &ERRCODE     *CHAR    8                                        
             chgvar  &errcode   x'0000000000000000'                  
             chgvar  &envhandle x'00000000'                          
             CALLPRC  'QsnRtvMod' PARM(&DSPMODE &ENVHANDLE &ERRCODE)
             SNDPGMMSG &DSPMODE                                      
             RETURN                                                  
             ENDPGM                                  

Barry              
0
 

Author Comment

by:bodger
ID: 17039915
Thanks agains Barry but I don't seem to have any object called QSNRTVMOD anywhere on my system.
0
 
LVL 13

Expert Comment

by:_b_h
ID: 17040001
It should be there....the name is case sensitive....try copying and pasting the code above into a member of type CLLE  for a test. It works on our v4r3 system. If not, I'm sure we can figure it out.
0
 

Author Comment

by:bodger
ID: 17041547
Thanks Barry. I have to admit I didn't even know that CLLE existed; it's not mentioned in my V5R2 Info Center CD and I can find no meaningful reference in IBM's Boulder website . I will have to convert the CLLE pgm to a CMD so I can pass parameters in and then use QCMDEXC to call it from an RPG400 pgm. On the assumption that I will be able to do that, I will accept your solution.
0
 

Author Comment

by:bodger
ID: 17047429
Actually I have no need to convert to CMD, just to pass through the caller's parms to the target pgm, which will be selected according to the existing screen mode.

Thanks again.

Just out of interest, what and where exactly is QsnRtvMod? I gather that it is some kind of 'procedure' by virtue of the CALLPRC command. Where would I find a reference for such procs?
0
 
LVL 13

Expert Comment

by:_b_h
ID: 17049879
There are many Application programming interfaces (APIs). This particular one is made available as a procedure through service program QSNAPI. You can see it using:
DSPSRVPGM SRVPGM(QSNAPI) DETAIL(*PROCEXP)

To find more APIs, check the IBM Infocenter at:
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp
and search for "API finder"

Barry
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today’s effective marketing is about coming down to the customers’ level and engaging in a whole new way. A text message is one of the most effective and influential ways that you can engage your customers. Here are eight ways that you can utilize t…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question