Solved

How to Restore Cursor Position on next EXFMT in loop

Posted on 2004-04-30
8
731 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article was initially published on Monitis Blog, you can read it here . When it comes to deciding which approach to website performance monitoring is best for your business, unfortunately, like so many options in life . . . it depends. In t…
This article discusses how to implement server side field validation and display customized error messages to the client.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 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