View previous topic :: View next topic
|
Author |
Message |
sagayapriya_v Warnings : 1 New User
Joined: 29 May 2007 Posts: 4 Location: Chennai
|
|
|
|
My requirement is
1.Displays rows in the ISPF panel from the table using TBDISPL command.
2.Allows user to select any number of rows displayed in the panel. When the user presses 'enter' key, the selected rows should be processed.
3.Allows user to scroll up/down to select rows in the next pages.
I am able to 'scroll' or 'process selected rows' separately.
The problem is when I select a row in the first page and also if scrolls down to next page to select another row, I am unable to process.
Could you tell me how to process selected rows when user scrolls? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Please post your code for processing the selected rows, and also the source of the panel. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
This is definitely one of the more complex processes to code for in a table display. If I recall, I believe that the return-code of the TBDISPL service is different when one row is selected vs. multiple rows. I think you need to keep the TBDISPL service in a loop until the return-code returns to being zero. Of course, you also have to consider if you want to add TBSKIP services so that the use is returned to the point of the TBDISPL service where they last entered a row command. |
|
Back to top |
|
|
sagayapriya_v Warnings : 1 New User
Joined: 29 May 2007 Posts: 4 Location: Chennai
|
|
|
|
Displays the table
"TBDISPL TAB3 PANEL (SCREEN3)"
When the user presses Enter after selecting the rows,process proceeds as follows:
Code: |
DO
IF ZTDSELS > 0 THEN DO
DO ZTDSELS
I = 1
IF WORDPOS(TOPT,"S") > 0 THEN DO
INDD = STRIP(TDD)
PARSE VAR INDD . '.' INPDD
ARR.I = INPDD
I = I + 1
END
IF ZTDSELS = 1 THEN
ZTDSELS = 0
ELSE
"TBDISPL TAB3"
END |
PANEL CODE:
/OPT DATASET NAME FILE TYPE DATE +
/--- ------------ --------- ------ +
)MODEL ROWS(SCAN)
+_Z `TDD `TFT `TDAT
)INIT
.ZVARS = '(TOPT)'
&AMT = PAGE
) |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
There are various ways to process tables. Some people go for the immediate process route and others for a route slightly longer but much more user friendly, and safer. I favour the user friendly and safety route.
In the example below I have included the action variable, O, in my table which along with a little bit of code allows the user to remove any selected rows before they are processed, by putting U in the action variable which then resets it to blank. Notice that another character must be used to stop the user from accidentally removing a row from the later process.
The method below allows full use of PF7 or PF8 which allows the user to review and change their selections before finally using PF3 to exit the table display and continue the process.
The table is then read in the next phase of the program and then processes the rows that have been selected and verified by the user. These rows all have S in the action variable. Easy eh ?
Code: |
"ISPEXEC TBDISPL Table_name PANEL(Panel_name)"
IF RC <> 8 THEN DO
DO FOREVER
DO WHILE ZTDSELS > 0
UPPER O
IF O = 'S' THEN DO
"ISPEXEC TBPUT Table_name"
END
ELSE IF O = 'U' THEN DO
O = ' '
"ISPEXEC TBPUT Table_name"
END
"ISPEXEC TBDISPL Table_name"
END
"ISPEXEC TBDISPL Table_name"
IF RC = 8 THEN LEAVE
END
END
|
|
|
Back to top |
|
|
sagayapriya_v Warnings : 1 New User
Joined: 29 May 2007 Posts: 4 Location: Chennai
|
|
|
|
In the example given above, the variable O is checked for 'U'.
I assume variable O is the variable checked if any row has been selected by the user.
But why it has been compared with 'U'?
Please clarify. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Because - as stated above - the user must enter S to select a row from the table for further processing.
If the user then wants to remove a row from further processing it is better if they enter a specified character to remove the row, rather than just a blank, to avoid erroneous removals.
It is just that in this case S is for SELECT and U is for UNSELECT.
Quote: |
In the example below I have included the action variable, O, in my table which along with a little bit of code allows the user to remove any selected rows before they are processed, by putting U in the action variable which then resets it to blank. Notice that another character must be used to stop the user from accidentally removing a row from the later process.
The method below allows full use of PF7 or PF8 which allows the user to review and change their selections before finally using PF3 to exit the table display and continue the process.
|
|
|
Back to top |
|
|
sagayapriya_v Warnings : 1 New User
Joined: 29 May 2007 Posts: 4 Location: Chennai
|
|
|
|
The above works fine in my code.
But in the above code,once the user makes the selection,only if the user presses PF03 key the the RC = 8 and hence it exits from the loop.
But my requirement is Once the user makes the selection and presses ENTER key i should process further instead of PF03 key
Could you tell me how to proceed? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Quote: |
But my requirement is |
For that I will read "My preference is.
Rather than maintaining an entry in the table, do your processing.
But what hapens if you user makes an error and selects the wrong row ?
I don't know what other processing you want to do, but I have always found it better to allow for dumb users |
|
Back to top |
|
|
neerajpeddu
New User
Joined: 03 Feb 2006 Posts: 25 Location: Calgary, AB
|
|
|
|
Hello there,
I have a very similar situation. I have tried the code here and for some reason when I have multiple selections, I am getting the value from the first selection for all the selected values. For example from the following screen shot, I have 3 selectable lines and I say Y,N,N respectively. The values are all saved in an array and all the records in an array have the selection from the first field only. All I am trying to do is to build a jcl that will submit a job to change the file format from one to another in the selected jcl's. Y will allow the change while N will not make any changes to the JCL. Following are some screen shots.
CONFIRM NEW CUSTOMER CHANGE JCL CURRENT
CHANGES JCL NUMBER FORMAT TO JCL
(Y/N) (*) (CPA/96B) FORMAT
------- --- -------- ---------- -------
y 3333 ABC DEF
n * 4444 ABC EFG
n * 5555 ABC HIJ
The Rexx code I used is:
The variable name for the above input is "CNF"
K = 0
IF TBLRC > 4 THEN LEAVE
ELSE DO
DO WHILE ZTDSELS > 0
UPPER CNF
IF CNF = 'Y' | ,
CNF = 'N' THEN DO
K = K + 1
OPFIELDS.K = CNF||IPFIELDS.K
END
IF K >= J THEN LEAVE
END
END
Can you please let me know what I am doing wrong. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
You did not copy the examples faithfully. Within the ZTDSELS loop, you need to:
1. process one line
2. issue TBDISPL with only table name to get the next row |
|
Back to top |
|
|
neerajpeddu
New User
Joined: 03 Feb 2006 Posts: 25 Location: Calgary, AB
|
|
|
|
Thank you very much Pedro. That is what is missing. Following is the code that is now working for me. Thank you once again.
Code: |
IF TBLRC > 4 THEN LEAVE
ELSE DO
DO WHILE ZTDSELS > 0
SAY 'ZTDSELS =' ZTDSELS
UPPER CNF
IF CNF = 'Y' | ,
CNF = 'N' THEN DO
K = K + 1
OPFIELDS.K = CNF||IPFIELDS.K
END
"ISPEXEC TBDISPL "TMPTBL
IF K >= J THEN LEAVE
END
END |
|
|
Back to top |
|
|
|