AS400 RPG36 Cursor location on a Screen


I have been tasked with adding pop-up search windows to an OLD RPG36 program. (I can not convert or rewrite.  Believe me I tried to sell these.)  No DDS - 36 screen as well.  Can anyone tell be how to determine the cursor location when the function key is press?  Yes, new search and windows will be written in RPGLE.

Thank you!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gary PattersonVP Technology / Senior Consultant Commented:
Never did much S36 display file programming.  I'd guess you can get it from the File Information Data Structure.
Somewhere in this EE topic area is a program that I wrote for another question, but I can't find it now. The program is a replacement for the S/36 SUBRCP subroutine that is (apparently) called in actual S/36 systems. The earlier question was successfully answered according to its OP, so I can offer the source again for this question:

pgm    ( +
         &pRow        +
         &pColumn     +

   dcl   &pRow        *char    4
   dcl   &pColumn     *char    4

   dcl   &DecVal      *dec  (  4 0 )

   dcl   &Row         *char    4
   dcl   &Column      *char    4
   dcl   &hLoLvlEnv   *char    4
   dcl   &ErrCod      *char    8
   dcl   &RtnVal      *char    4

   callprc 'QsnGetCsrAdr'   ( +
                              &Row         +
                              &Column      +
                              x'00000000'  +
                              x'00000000'  +
                            ) +
                      rtnval( +
                              %bin( &RtnVal ) +

   chgvar         &DecVal        %bin( &Row )
   chgvar         &pRow                &DecVal
   chgvar         &DecVal        %bin( &Column )
   chgvar         &pColumn             &DecVal



Open in new window

S/36 documentation (apparently) describes how SUBRCP is used within S/36 programs. I don't have good info for that part unfortunately, but it wouldn't surprise me if Gary did.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gary PattersonVP Technology / Senior Consultant Commented:
All I know about SUBRCP is that it is a third-party subroutine for RPG II:

Tom's solution using DSM API QsnGetCsrAdr is elegant.  Nice solution.
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

lynn_harrisAuthor Commented:
Thank You both for your responses. I'm sorry it took me so long to get back. I went dark (haha) for the long weekend.

I will give this a try today.

Thank you!
@Gary, I wasn't aware it was 3rd-party; but it's clearly not a big problem in the AS/400-series. The PARM() interface was given by the earlier OP, IIRC. I assumed it was from some system docs, but I guess it doesn't really matter if it's all external anyway.

lynn_harrisAuthor Commented:

First, if I should post this as a separate question please let me know and I will do so. Thanks.

I finally got a change to try the program Tom posted. I'm unable to get it to compile. I've compile listing. No Errors, but no compile.

Total         0-9  10-19  20-29  30-39  40-49  50-59  60-69  70-79  80-89  90-99                                
    0           0      0      0      0      0      0      0      0      0      0                                
Program CLCURRTN not created in library LWCH. Maximum error severity 00.                                        
                              * * * * *   E N D   O F   M E S S A G E   S U M M A R Y   * * * * *              
                                * * * * *   E N D   O F   C O M P I L A T I O N   * * * * *                    

At first I was getting  * CPD0726 10  Variable declared but not referred to.  &      
                                   * CPD0791 00  No labels used in program.  I removed the variables and put a dummy label at the bottom. (I did some looking any it appears there is a PTF related to the label error.)

Any suggestion would be greatly appreciated.
Gary PattersonVP Technology / Senior Consultant Commented:
Look at the job log.  You'll probably see that you had a error at the binding step, and an unresolved reference for the symbol "QsnGetCsrAdr".

DSM APIs are in service program QSNAPI, and you'll need to include that when you compile.  IBM supplies a binding directory with this service program listed (binding dir is also named QSNAPI).   I recommend adding an h-spec:

h bnddir(QSNAPI) dftactgrp(*no) actgrp(QILE_ortheActivationGroupOfYourChoice)

- Gary
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
IBM System i

From novice to tech pro — start learning today.