Solved

How to Restore Cursor Position on next EXFMT in loop

Posted on 2004-04-30
8
719 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AS400 Printer emulation Print to PDF 5 835
Access Remote iSeries IFS 6 278
Create AS400 Logical File 5 70
Comments on the use of ftp server/client on OS/400 AS/400 4 96
Often, people trade privacy and security for convenience. However in today's concrete jungle, this is an extremely foolish decision considering the vast amount of technologies being used against consumer interest. First off, I won't waste any time e…
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now