Solved

Detecting Current Screen Size (*DS3/*DS4)

Posted on 2006-07-04
12
881 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

This article outlines why you need to choose a backup solution that protects your entire environment – including your VMware ESXi and Microsoft Hyper-V virtualization hosts – not just your virtual machines.
This problem is more common than not and I will show you some things to check to solve this problem.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

803 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