Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to Restore Cursor Position on next EXFMT in loop

Posted on 2004-04-30
8
Medium Priority
?
745 Views
Last Modified: 2012-05-04
i got this new program that builds an sql statment. users can enter has many values for a field as they like by keying it in and pressing enter.  F8 is  used to submit the job.

as the user is keying in multiple values for a field, i would like for the cursor to return to that field on the next EXFMT, how can I do this?
0
Comment
Question by:roosterup
[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
8 Comments
 

Expert Comment

by:Faiz
ID: 10963355
Condition the field in the display file with an indicator for DSPATR(PC). Turn the indicator on before your EXFMT and the cursor will be positioned on that field.

0
 
LVL 14

Expert Comment

by:daveslater
ID: 10964200
Hi
The method I use is the using the key words
RTNCSRLOC(*MOUSE &Row &Col)
POSCSR(&Row &COL)
(These would be in the subfile control Format).

To position at the first input field set row to 0 in the RPG/Cobol etc..

Dave
0
 
LVL 27

Expert Comment

by:tliotta
ID: 10980855
roosterup:

First question is "How does your program know that the user wants to enter another value for that field rather than move to another field?"

Let's say you always want to leave the cursor on whatever field the user typed into last, unless <F8> is pressed and then you want to place the cursor back to the first field. If the users are done entering values for a field, they can <TAB> to the next field. Does that describe what you want?

Tom
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 1

Author Comment

by:roosterup
ID: 10980939
>>First question is "How does your program know that the user wants to enter another value for >>that field rather than move to another field?"

Pressing enter is how the program knows the user wants to enter another value. Tab should take you to the next field.


The user should be able to enter values into the same field by pressing enter without tabbing back to that field.  The user will tab to get to the next field.  

As each value is entered, the screen input field is cleared and the value is concatenated to a field that is on the same line as the input field. This is so the user can see all the values he will search for.
0
 
LVL 27

Expert Comment

by:tliotta
ID: 10981210
roosterup:

Previous replies are useful. Consider the following example of a couple DSPF fields:

00020A            FLDY           3   I  8 30CHANGE(68 'FLDY was entered')
00021A 68                                   DSPATR( PC )
00030A            FLDZ           3   I  9 30CHANGE(69 'FLDZ was entered')
00031A 69                                   DSPATR( PC )

If the user types into FLDY, change indicator 68 comes on. If 68 is on during the next outpt, FLDY is where the cursor should be positioned. If the user types into FLDZ, change indicator 69 comes on. If 69 is on during the next outpt, FLDZ is where the cursor should be positioned.

But what if the user types into FLDY, <TAB>s to FLDZ, and types in FLDZ, presses <Enter> and expects to type another value in FLDZ? Both 68 and 69 will be on. Where should the cursor go?

Obviously to FLDZ, but it will go to FLDY unless your program turns 68 off. This will be true for every field above FLDZ.

Not technically difficult, but requires attention to detail.

What VRM of OS/400 are you working with?

Tom
0
 
LVL 1

Author Comment

by:roosterup
ID: 10982547
i'm on v5r2.

so maybe i need to capture the cursor position and then restore it, that possible?
0
 
LVL 27

Expert Comment

by:tliotta
ID: 10989282
mayankgangrade:

With the record-level keyword RTNCSRLOC(&RCD &FLD &POS), you can get info about the cursor location when the user presses <Enter>. With the record-level keyword CSRLOC(LINNBR POSNBR), you can set the position where the cursor should be on an output operation.

However, when the user presses <Enter>, the cursor might not be in the field that you want to position the cursor in. The user might have typed into FLD1, <Tab> to Fld2, typed in FLD2, then moved back to FLD1 to correct a character. When <Enter> is pressed, the display file will report that the cursor is in FLD1.

You still need to track which fields had data entered into them. Your program logic will need to decide what to do next. The CSRLOC() keyword can be used on output if you don't want to use indicators for DSPATR(PC), but you'll need to keep track of the actual locations of your display fields.

Tom
0
 
LVL 27

Accepted Solution

by:
tliotta earned 200 total points
ID: 10989299
roosterup:

Apologies... "mayankgangrade" is the name from an item in another window. I copied it incorrectly into this item.

Tom
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

604 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