Solved

How to Restore Cursor Position on next EXFMT in loop

Posted on 2004-04-30
8
728 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
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php iseries 3 229
Calling an iSeries system API (QWDRSBSD) from C# 4 492
iSeries PERL Scripts 7 171
RAID 1 - Problem with Data 8 89
IT certifications are a concrete representation of continual learning on the part of the candidate.  Continual learning is necessary for the long term success of an IT professional, but are IT certifications the right path for you?
Giving access to ESXi shell console is always an issue for IT departments to other Teams, or Projects. We need to find a way so that teams can use ESXTOP for their POCs, or tests without giving them the access to ESXi host shell console with a root …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

856 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