Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Detecting Current Screen Size (*DS3/*DS4)

Posted on 2006-07-04
12
Medium Priority
?
1,028 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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 

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 750 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

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

Dropbox has a relatively new feature called Smart Sync.  This feature allows Dropbox Professional (not plus) and Dropbox Business (if enabled) users to store information in Dropbox WITHOUT storing any files on their computer.
This blog will spread awareness about Dropbox. We have given the statements based upon our experience. Along with this, there is a section of some new plans that should be added in Dropbox this year. This will make the storage service enhanced from …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

564 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