Menu

guicobol question on some code

Anonymous
2020-10-16
2020-10-21
  • Anonymous

    Anonymous - 2020-10-16

    HI all-

    I am running this and it gives a strange output. Also, I don't know how to get at the value of a text box from another procedure similar to a call with linkage in the code below. Is anyone out there using this that can give me a pointer? Thanks roboloki

    ::cobol
            IDENTIFICATION DIVISION.
            PROGRAM-ID.    demo.
            ENVIRONMENT DIVISION.
            DATA DIVISION.
            WORKING-STORAGE SECTION.
            01 alabel               usage pointer.
            01 abutton              usage pointer.
            01 atext                usage pointer.
    
            PROCEDURE DIVISION.
    
    
            invoke SUPER "addform" returning SELF.
            move  "GuiCOBOL TEST " to "caption" of self
            invoke self "addlabel" using " def" returning alabel.
            invoke self "addbutton" using "hij" returing abutton.
    
            invoke self "addtext" using "abc" RETURNING atext.
              move "123" to "text" of atext.
          * line above doesn't seem to work
          * it returns tex when I run the program and that doesn't seem right to me
          * invoke atext "keydown" using "exitForm".
            call "exitForm" using atext.
            move "blue" to "textcolor" of alabel.
            move "yellow" to "backcolor" of alabel.
            move "arial" to "font" of alabel.
            move "300%" to "fontsize" of alabel.
            invoke  self "show".
    
            invoke SELF "run"
            stop run.
            end program demo.
    
            identification division.
            program-id. exitForm.
            data division.
            working-storage section.
                01 out-length usage binary-long.
                01 middleman pic x(10) based.
                01 replacement pic x(10).
            linkage section.
                01 mytext usage pointer.
            procedure division using mytext.
            set out-length to 3.
            set address of middleman to mytext.
            move middleman(1:out-length) to replacement.
            display replacement.
    
                  exit program.
    

    the program displays text which doesn't seem right - thanks

     

    Last edit: Simon Sobisch 2020-10-16
    • Simon Sobisch

      Simon Sobisch - 2020-10-16

      Can you please check if it is possible for you to register/login? That removes the additional moderation work a human would otherwise have to do and also provides instant posts and optional notifications.

       
  • alien with special powers

    Hi Simon-

    Yes, I went in and upated account settings at Sourceforge.

    I am very excited to study COBOL. I was off on a tangent studying U++ , tigervnc, SSH, gpg, etc.

    I hope you and Brian are having a cool weekend.

    I will keep a low profile this weekend.
    thanks
    roboloki

     
  • Federico Priolo

    Federico Priolo - 2020-10-17

    Maybe you should declare the atext external
    01 atext usage pointer external.

    and the obtain the value

    move "text" of atext to stringa.
    display "here the value:" stringa.

    where the stringa is declared in your exitForm procedure
    into the working storage section.

    Federico

     
  • alien with special powers

    Hi Federico-

    Sorry about tthe delay in getting back to you. I did not feel well this past week. I am back though.

    It is a very good tip you gave me!

    thanks,
    roboloki

     
  • Anonymous

    Anonymous - 2020-10-20

    This code has not been through a compiler because the 3rd invoke line has a typo, I gave up reading the code at that point.

    You say something doesn't seem right, what did you expect instead?

     
  • alien with special powers

    Hi-

    Federico knew right away what I was expecting. See his comment about using usage pointer external.

    thanks.

     

Anonymous
Anonymous

Add attachments
Cancel