Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Screen Display (Interactive) 1

Status
Not open for further replies.

progolf069

Programmer
Jun 13, 2001
37
0
0
US
Greetings Happy New Year!

Here is an easy one for some of the more advanced COBOL programmers. I am wanting to display a multi-page list of data (from a table already built) There is 100 records in the table. I need to be able to display all 100 records on the screen, and allow the user to select one of the records so that they can make changes to that record. The record consists of 2 fields: a Code Number and a Description field. I can handle the code to update the table, and the files that the table builds from, I just need help display the table on the screen, accross multiple pages (screens).

At the bottom of this thread I will show you the source that I have up to this point in time. Below is a sample screen of how I want the text displayed versus how I do not want the text displayed.


How I do NOT want the screen to appear:
Code:
qcode                  QUALITY CODES              01/02/2002

      CODE: [1234]       DESC: [XXXXXXXXXXXXXXXXXXXX]
     # DESC           # DESC           # DESC
     1 XXXXXXXXXX     2 XXXXXXXXXX     3 XXXXXXXXXX 
     4 XXXXXXXXXX     5 XXXXXXXXXX     6 XXXXXXXXXX
     7 XXXXXXXXXX     8 XXXXXXXXXX     9 XXXXXXXXXX
    10 XXXXXXXXXX    11 XXXXXXXXXX    12 XXXXXXXXXX
    13 XXXXXXXXXX    14 XXXXXXXXXX    15 XXXXXXXXXX
    16 XXXXXXXXXX    17 XXXXXXXXXX    18 XXXXXXXXXX
    19 XXXXXXXXXX    20 XXXXXXXXXX    21 XXXXXXXXXX
    22 XXXXXXXXXX    23 XXXXXXXXXX    24 XXXXXXXXXX
    25 XXXXXXXXXX    26 XXXXXXXXXX    27 XXXXXXXXXX
    28 XXXXXXXXXX    29 XXXXXXXXXX    30 XXXXXXXXXX
    31 XXXXXXXXXX    32 XXXXXXXXXX    33 XXXXXXXXXX
    34 XXXXXXXXXX    35 XXXXXXXXXX    36 XXXXXXXXXX
    37 XXXXXXXXXX    38 XXXXXXXXXX    39 XXXXXXXXXX 
    40 XXXXXXXXXX    41 XXXXXXXXXX    42 XXXXXXXXXX
    43 XXXXXXXXXX    44 XXXXXXXXXX    44 XXXXXXXXXX
    45 XXXXXXXXXX    46 XXXXXXXXXX    47 XXXXXXXXXX
    48 XXXXXXXXXX    49 XXXXXXXXXX    50 XXXXXXXXXX
    51 XXXXXXXXXX    52 XXXXXXXXXX    53 XXXXXXXXXX

 ACTION: [X]  (N)ext Page  (P)rev Page  (M)odify/Add  (Q)uit

How I DO want the screen to appear:
Code:
qcode                  QUALITY CODES              01/02/2002

      CODE: [1234]       DESC: [XXXXXXXXXXXXXXXXXXXX]
     # DESC           # DESC           # DESC
     1 XXXXXXXXXX    19 XXXXXXXXXX    37 XXXXXXXXXX 
     2 XXXXXXXXXX    20 XXXXXXXXXX    38 XXXXXXXXXX
     3 XXXXXXXXXX    21 XXXXXXXXXX    39 XXXXXXXXXX
     4 XXXXXXXXXX    22 XXXXXXXXXX    40 XXXXXXXXXX
     5 XXXXXXXXXX    23 XXXXXXXXXX    41 XXXXXXXXXX
     6 XXXXXXXXXX    24 XXXXXXXXXX    42 XXXXXXXXXX
     7 XXXXXXXXXX    25 XXXXXXXXXX    43 XXXXXXXXXX
     8 XXXXXXXXXX    26 XXXXXXXXXX    44 XXXXXXXXXX
     9 XXXXXXXXXX    27 XXXXXXXXXX    45 XXXXXXXXXX
    10 XXXXXXXXXX    28 XXXXXXXXXX    46 XXXXXXXXXX
    11 XXXXXXXXXX    29 XXXXXXXXXX    47 XXXXXXXXXX
    12 XXXXXXXXXX    30 XXXXXXXXXX    48 XXXXXXXXXX
    13 XXXXXXXXXX    31 XXXXXXXXXX    49 XXXXXXXXXX 
    14 XXXXXXXXXX    32 XXXXXXXXXX    50 XXXXXXXXXX
    15 XXXXXXXXXX    33 XXXXXXXXXX    51 XXXXXXXXXX
    16 XXXXXXXXXX    34 XXXXXXXXXX    52 XXXXXXXXXX
    17 XXXXXXXXXX    35 XXXXXXXXXX    53 XXXXXXXXXX
    18 XXXXXXXXXX    36 XXXXXXXXXX    54 XXXXXXXXXX

 ACTION: [X]  (N)ext Page  (P)rev Page  (M)odify/Add  (Q)uit

As you can see, I want the numbers to read up and down the columns and not accross the screen. I am looking for an easy solution to this problem, if you have any idea, feel to reply! An early THANK YOU goes to you for your reply!

Ian Wickline

Here is my current source as promised:

Code:
       IDENTIFICATION DIVISION.
       PROGRAM-ID. MAILING-LIST.
       AUTHOR. IAN P WICKLINE.
       INSTALLATION. K'S MERCHANDISE.
       DATE-WRITTEN. DEC 31 2001.
      ******************************************************************
      *                                                                *
      *                                                                *
      *                                                                *
      ******************************************************************

       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           copy '/prog/copy/qualcode.sel'.
           SELECT OUTPUT-FILE
               ASSIGN TO '/prog/ian/output.txt'
           ORGANIZATION IS LINE SEQUENTIAL.

       DATA DIVISION.
       FILE SECTION.
       copy '/prog/copy/qualcode.fd'.
       FD  OUTPUT-FILE.
       01  OUTPUT-REC.
           05  OUTPUT-NUM                  PIC 9(04).
           05  OUTPUT-DESC                 PIC X(30).

       WORKING-STORAGE SECTION.
       01  SYSTEM-DATE.
           05  SYS-DATE                    PIC 9(08).
       01  ARE-THERE-MORE-RECORDS          PIC XXX VALUE 'YES'.
       01  SUB                             PIC 999 VALUE ZEROS.
       01  MASTER-TABLE.
           05  CODE-TABLE OCCURS 100 TIMES.
               10  CODE-NUM                    PIC 9(04).
               10  CODE-DESC                   PIC X(30).
       01  SCREEN-INPUT-FIELDS.
           05  WS-CODE                     PIC 9999.
           05  WS-DESC                     PIC X(30).

       SCREEN SECTION.

       01  TITLE-SCREEN.
           05 BLANK SCREEN.
           05 LINE 01 COL 01       VALUE "qcode".
           05         COL 32       VALUE "QUALITY CODES".
           05         COL 71       PIC 99/99/ FROM SYS-DATE.
           05         COL 77       PIC 9999PPPP FROM SYS-DATE.

       01  PROMPT-USER-SCREEN.
           05 LINE 03 COL 12       VALUE "Code: [".
           05 SCR-CODE             PIC Z(04) USING WS-CODE.
           05                      VALUE "]".
           05         COL 30       VALUE "Desc: [".
           05 SCR-DESC             PIC X(30) USING WS-DESC.
           05                      VALUE "]".

       01  HEADING-SCREEN.
           05 LINE 04 COL 02       VALUE "#".
           05         COL 04       VALUE "DESC".
           05         COL 30       VALUE "#".
           05         COL 32       VALUE "DESC".
           05         COL 58       VALUE "#".
           05         COL 60       VALUE "DESC".

       01  ACTION-MENU.
           05 LINE 24 COL 02       VALUE "ACTION: [".
           05 SCR-CHOICE           PIC X USING WS-ACTION.
           05                      VALUE "]    ".
           05                      VALUE "(N)ext Page    ".
           05                      VALUE "(P)revious Page    ".
           05                      VALUE "(M)odify/Add    ".
           05                      VALUE "(Q)uit".

       PROCEDURE DIVISION.
       100-MAIN-MODULE.
           MOVE FUNCTION CURRENT-DATE TO SYSTEM-DATE
           OPEN INPUT qualcode
                OUTPUT OUTPUT-FILE
           INITIALIZE MASTER-TABLE.
           PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO '
               READ qualcode
                   AT END
                       MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
                   NOT AT END
                       PERFORM 200-PROCESS-RTN
                   END-READ
           END-PERFORM
           PERFORM VARYING SUB FROM 1 BY 1 UNTIL SUB >= 100
               PERFORM 500-WRITE-MASTER-FILE
           END-PERFORM
           CLOSE qualcode
                 OUTPUT-FILE
           STOP RUN.

       200-PROCESS-RTN.
           PERFORM 300-LOAD-MASTER-TABLE.

       300-LOAD-MASTER-TABLE.
           MOVE QC-DESC TO CODE-DESC(QC-NBR).

       500-WRITE-MASTER-FILE.
           IF CODE-DESC(SUB) NOT = SPACES
               MOVE SUB TO output-num
               MOVE CODE-DESC(SUB) TO output-desc
               WRITE OUTPUT-REC
           END-IF.
 
Hi PG,

I'm not a PC COBOL maven, but you may want to try something like this:

Create a table in WS; when you fill it move it to your screen definition and display it.

Code:
01  screen-tbl.
    05  screen-line occurs 18.
        10  screen-col-set occurs 3.
            15  scr-qc-nbr     pic x(???).
            15  scr-qc-dsc     pic x(???). 

You can fill the screen tbl something like this:

Apparently, after you load the master tbl, you want to fill a screen and display it. So you'll start at the "bottom" of the master table and, one at a time, move the data to the screen table. This means you need a master tbl index (or subscript) and 2 screen table indexes (1 for the line; 1 for qual code cols). Managing the master tbl idx is easy enough. The other 2 require some thought.

If you divide the master idx by the # of dtl lines in the screen (in your case 18), the remainder is the sceen line # and the quotient (giving) + 1 is the screen col #.  So you can code something like this:

perform until midx > 54
   divide midx by 18 giving cidx remainder lidx
   move code-num(midx) to scr-qc-nbr(lidx cidx + 1)  
   move code-dsc(midx) to scr-qc-dsc(lidx cidx + 1)        
end-perform

move screen-tbl     to your detail screen

I think this will work. This is off the top of my head, so don’t take my word for it. Open ques are:
What about 55 -100? You may want to use 2 - 54 entry tbls for the master. Paging fwd bwd? Etc.

HTH, Jack


 
Thanks for the "brain" support. Every-once and awhile, you just need somebody else to give you that little boost. Thanks for the thread!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top