Menu

Multi-line ACCEPT field divided with white-space

Anonymous
2023-03-12
2023-03-13
  • Anonymous

    Anonymous - 2023-03-12

    Hello, I've been building a GnuCOBOL project that uses the SCREEN element. I got multi-line ACCEPT fields working, but I haven't yet figured how to divide the input with white-space, so that the text doesn't cut off in the middle of a word. How could this be achieved? Thanks to anyone who can answer.

     
  • Simon Sobisch

    Simon Sobisch - 2023-03-12

    I'm, not 100% sure what this is about. Most commonly if you want multiple fields getting ACCEPT"at once" you'd use SCREEN SECTION - which allows you free positioning of the fields.

    In any case showing how you've got working what you've got working and where the difference is to what you want to achieve now would highly help in understanding what you want to do.

     
  • Anonymous

    Anonymous - 2023-03-13

    Thank you for answering. These are the ACCEPT and SCREEN parts I'm working on. I think I might have posted several times, because I got an error page so I thought it didn't come through, sorry about that.

    Everything kind of works, except that I can't figure out how to split the user input that spans multiple lines in the screen according to white-space. Right now the text just cuts off at any point when the AUTO field is full, but I want to be able to move the text to the next line according to white-space.

    So that any word that is not complete when the line is full moves to the next line, and the user can still backspace into the previous line.

       WORKING-STORAGE SECTION.
       01 ws-cont.
      *>     05 FILLER VALUE IS X"0A".
           05 line-1 PIC X(56).
      *>     05 FILLER VALUE IS X"0A".
           05 line-2 PIC X(78).
      *>     05 FILLER VALUE IS X"0A".
           05 line-3 PIC X(78).
      *>     05 FILLER VALUE IS X"0A".
    
       SCREEN SECTION.
       01 clear-scr BLANK SCREEN BACKGROUND-COLOR 0 FOREGROUND-COLOR 2.
    
       01 top-input-2 BACKGROUND-COLOR 0 FOREGROUND-COLOR 2 
           AUTO PROMPT CHARACTER IS " " .
           05 s-input-txt-2 PIC X(20) VALUE "Test" LINE 1 COL 2.
           05 FILLER USING line-1 COL 24 LINE 1.
           05 FILLER USING line-2 COL 2 LINE 2.
           05 FILLER USING line-3 COL 2 LINE 3.
    
      *> Here's the accept statement in the procudure division:
    
       Accept-cont.
       DISPLAY clear-scr
       ACCEPT top-input-2.
    
     
  • Vincent (Bryan) Coen

    Two problems as far as I can see :

    1. You are using line terminations (x"0A") can and will cause issues.
    2. You are using FILLER so the only field used for the ACEPT is s-input-txt

    So by my reckoning is the first line o/p and for input the rest ignored - I have not tried your code.
    Try giving names in place of the filers in top-input-2 and unless your have a very good reason get rid of the "0A" values.

     

Anonymous
Anonymous

Add attachments
Cancel