Display Manager | Selection of table row problem



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

Display Manager | Selection of table row problem

Postby morthart » Fri Jan 22, 2016 3:33 pm

Hi,

in preperation for a case study next week I'm trying to program basic functions for use on a table. The table itself is basic and only created for this exercise.
It has (Keyfield) SERIAL (Namefield) NAME LNAME.
The display and the panel are working and produce the following output:



Now, the _ field should be used to input a letter to add, update or delete certain lines (one line at a time). For testing purposes, it is currently just 'x' that should initiate a second panel. The problems start here, so I'll provide you with the code that I have:

000100 /* REXX */
000110 address ispexec
000301 "TBOPEN TESTTBL NOWRITE"
000304 ZTDMARK = ' |----------------------------------------------|'
000305 "TBDISPL TESTTBL PANEL(VCT@TABL) POSITION(TESTP)"
000307 "TBCLOSE TESTTBL"
000400 exit

The REXX code to open my first panel. It will open my TESTTBL, change the BOTTOM OF DATA mark, display all the lines and write the position of the last selected row into TESTP, then close the table.

)ATTR
# TYPE(INPUT) color(turq) hilite(uscore)
§ TYPE(OUTPUT) color(turq)
)BODY EXPAND ({})
+{-} BROWSE COURSES {-}+
+==>#ZCMD+
+ | Course Nr. | Worktitle | English Title |
+ |--------------|-------------|-----------------|
)MODEL
#Z+| §SERIAL +| §NAME +| §LNAME +| +
)INIT
.ZVARS = INPUT
&INPUT = ' '
.cursor = INPUT
)PROC
ver(&INPUT,list x,' ')
&zsel = trans(&INPUT 'x','cmd(VCT@TAB2)',
' ',' ',
*,'?')
)END

This will create the panel and a scrollable area for my rows. Now, the panel will not change to VCT@TAB2, even if I type in 'x'. I think the problem is that e will somehow concatenate all the INPUTs that he has, so there is never only 1 'x' seen by the trans(). The PTEST will be the last selected row though, so if I type in 'x' somewhere, he will save the correct line position.
Now, this could be pretty easily solved using REXX and just checking each, then hardcoded variable, for the first occurance of 'x'. The problem is that I can't do that because my length is not solid.

My second problem lies within my VCT@TAB2 panel, as he will not display the selected row.

REXX

address ispexec
"VGET TESTP SHARED"
"TBOPEN TESTTBL WRITE"
"TBGET TESTTBL POSITION(TESTP)"
"DISPLAY PANEL(VCT@tab2)"
"TBCLOSE TESTTBL"
exit

This gets my TESTP, the position of the row last selected, opens my table in write mode (because, at a later stage of the project, I want to be able to change the data displayed), he gets the row from TESTP and displays my panel. Now, if I call the panel individually, it will display the structure of the table, but not the data of the row fetched. The panel itself is pretty simple:

)ATTR
# TYPE(INPUT) color(turq) hilite(uscore)
§ TYPE(INPUT) color(turq)
)BODY EXPAND ({})
+{-} Details {-}+
+==>#ZCMD+
+ | Course Nr. | Worktitle | English Title |
+ |--------------|-------------|-----------------|
+ | §SERIAL +| §NAME +| §LNAME +| +
)INIT
.cursor = ZCMD
)END

As I do not have a )MODEL statement, i can't use TBDISPL. The question would be if I need some sort of other display method for the one row I fetched, or if my whole attempt is wrong.

Thank you very much,

Florian
morthart
 
Posts: 2
Joined: Fri Jan 22, 2016 2:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Display Manager | Selection of table row problem

Postby morthart » Fri Jan 22, 2016 3:56 pm

As I forgot the actual output picture of the first panel and don't find the edit function, here it is:
Image

Edit: The workaround would obviously be having 2 fields, one for desired action (A,U,D) and one for row number. This would solve the problem of having to check a dynamicly created field (sorry if this is not the correct terminus, I don't know how to reference to it correctly) for values, but would instead jump easily on a simple check of two variables. It would also not teach me anything ;)
morthart
 
Posts: 2
Joined: Fri Jan 22, 2016 2:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Display Manager | Selection of table row problem

Postby Pedro » Fri Jan 22, 2016 10:08 pm

I would do it differently. Rather than using &zsel in the )PROC section, I would check the row action commands from the first rexx program. In the Dialog Developer's Guide, read about ZTDSELS variable. You need a loop in the rexx program to process multiple line commands.

Rather than using a separate rexx program to process the line command, issue the DISPLAY service directly from the first rexx program.

Something like this:
Do while (drc<8)                                                       
  "TBDISPL TABLENAM      PANEL("panname") ROWID(ROW)"       
  if rc < 8 then do                         
    If ztdsels >= 1 Then              /* LINES UPDATED >= 1 ?        */
      Do    while ztdsels >= 1        /* RESOLVE ALL USER SELECTS    */
        If lcmd = 'S' Then                                             
             "DISPLAY PANEL(VCT@tab2)"
        If ztdsels > 1    Then         /* IF STILL MORE LINES SELECTED*/
           "TBDISPL TABLENAM"          /*SELECT NEXT LINE     */       
          Else                         /* NO MORE LINES SELECTED      */
            ztdsels = 0                /* SET # SELECTED TO ZERO      */
      End  /*ztdsels */                                                       
  End /* rc<8 */
End /* do while */
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post