Solved

Detecting Current Screen Size (*DS3/*DS4)

Posted on 2006-07-04
12
859 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
  • 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
 

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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now