Menu

Accepting data from screen section

Jim French
2025-07-14
2025-07-15
  • Jim French

    Jim French - 2025-07-14

    I'm new to the whole concept of a screen section in gnucobol and I'm playing around with a couple of examples I've found on the web to see if I can use the screen section to display data on the screen (works fine) and then receive data keyed in by the user into my program for processing. At this point I have the display working fine, but I'm having problems receiving data back from it. Attached is my test code and a snap shot of my results. Any help would be appreciated! Thank you!

     
  • Vincent (Bryan) Coen

    Providing a copy of the source program might help a lot more than the snapshot of the screen image.

     
    • Jim French

      Jim French - 2025-07-14

      So sorry - I did upload it, but the screen shot must have overlayed it? Thank you!

       
  • Vincent (Bryan) Coen

    Few you have missed : -

    1. Add foreground-color xxx background-color yyy where xxx and yyy is the color required having a 'COPY "screenio.cpy" in WS area at SS 01 level data-name so it looks something like :
    01  Display-01                  background-color cob-color-black
                                                                                                               erase eos.
         03  using Prog-Full-Title  pic x(35) line  1 col  1 foreground-color COB-COLOR-WHITE highlight.
         03  using WS-Copyright     pic x(60) line  2 col  1 foreground-color COB-COLOR-YELLOW HIGHLIGHT.
         03  using WS-Display-Head  pic x(56) line  4 col  1 foreground-color COB-COLOR-GREEN.
    

    In my example I have difffering foreground colors but if it is the same for all include it at the 01 level.

    1. In WS add ws-dummy pic x value space.
    2. Change PD code for :
         ACCEPT SAMPLE-SCREEN.
         DISPLAY  "Hit return to End" at 0501.
         accept ws-dummy at 0518.
         stop run.
      

    The accept will display the screen as at the 01 level then request the data shown as USING.

     
  • Jim French

    Jim French - 2025-07-14

    Thank you. That helps a lot. I have the user inputted data from the screen working now (in black and white) but when I add the 01 for the colors my editor gives me syntax errors on both the 01 and 03 levels ("unexpected identifier" and "unexpected using"). It seems to work fine without that defined in WS. Also, can you tell me what COPY "screenio.cpy" is and what it does? Thanks again. I really appreciate your help.

     
  • László Erdős

    László Erdős - 2025-07-14

    Hi,

    the COPY file "screenio.cpy" is under your GnuCOBOL installation in the copy directory.
    At me C:\GC32M-BDB-x64\copy\screenio.cpy. It includes some predefined values.

    BR
    László

     
    • Anonymous

      Anonymous - 2025-07-14

      That makes sense - thank you!

       
  • Vincent (Bryan) Coen

    Try these changes - attached.

     
    • Anonymous

      Anonymous - 2025-07-14

      Thank you. The sample.cob you uploaded seems to be the same one I uploaded. Line for line I didn't see any difference. Did I miss something? Thank you!

       
      • Vincent (Bryan) Coen

        Look closer - there are differences in SS and PD.

         
        • Anonymous

          Anonymous - 2025-07-14

          Nice - thank you! Works great! I really appreciate your patience and help!

           
  • Vincent (Bryan) Coen

    screenio.cpy includes all of the definotions for the colors used in GnuCobol.

    Suggest you download and read the Programmers Guide.
    You can access it and the others at :

    https://gnucobol.sourceforge.io/guides.html

     
  • Vincent (Bryan) Coen

    Please ensure you log in to SF every time as it can be some time before some one will who is a moderator can see your post and accept it.

     
    • Anonymous

      Anonymous - 2025-07-15

      Thank you!

       

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.