IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Process selected rows in the scrollable portion


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sagayapriya_v
Warnings : 1

New User


Joined: 29 May 2007
Posts: 4
Location: Chennai

PostPosted: Tue May 19, 2009 3:54 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue May 19, 2009 4:22 pm
Reply with quote

Please post your code for processing the selected rows, and also the source of the panel.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue May 19, 2009 4:57 pm
Reply with quote

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
View user's profile Send private message
sagayapriya_v
Warnings : 1

New User


Joined: 29 May 2007
Posts: 4
Location: Chennai

PostPosted: Tue May 19, 2009 5:11 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue May 19, 2009 8:03 pm
Reply with quote

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
View user's profile Send private message
sagayapriya_v
Warnings : 1

New User


Joined: 29 May 2007
Posts: 4
Location: Chennai

PostPosted: Thu May 21, 2009 8:57 am
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 21, 2009 11:31 am
Reply with quote

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
View user's profile Send private message
sagayapriya_v
Warnings : 1

New User


Joined: 29 May 2007
Posts: 4
Location: Chennai

PostPosted: Thu May 21, 2009 5:41 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 21, 2009 5:59 pm
Reply with quote

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 icon_lol.gif
Back to top
View user's profile Send private message
neerajpeddu

New User


Joined: 03 Feb 2006
Posts: 25
Location: Calgary, AB

PostPosted: Fri Jun 12, 2009 6:14 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Fri Jun 12, 2009 10:11 pm
Reply with quote

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
View user's profile Send private message
neerajpeddu

New User


Joined: 03 Feb 2006
Posts: 25
Location: Calgary, AB

PostPosted: Fri Jun 12, 2009 10:33 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts How to compare two rows of same table DB2 11
Search our Forums:

Back to Top