sponsored links

Collapse

Announcement

Collapse
No announcement yet.

capture keypress "Enter" in display file

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • capture keypress "Enter" in display file

    Hi,
    I'm able to capture the F3 using the CF03 in my Cobol program. But how about the "Enter" key?

  • #2
    The keyword that probably best meets your needs is probably VLDCMDKEY. This post (https://archive.midrange.com/rpg400-.../msg00005.html) does a good job of explaining the options - although the coding techniques are a little "old" by today's standards. For example today I would expect to see INDDS used to associate the *IN indicators with real indicator names:
    Code:
     Select;  
      When Help_01;
         // do help processing
      When Exit_03;
        // do exit processing
      When Refresh_05;
       // etc. etc.
    EndSl

    Comment


    • #3
      For COBOL, you can try using the CONTROL-AREA extension. There is an example in Chapter 9 of the ILE cobol Reference Guide. It should be similar to this:

      Code:
      select DSPFILE                              
             assign       to workstation-DSPFILE-si
             organization is transaction          
             access mode  is dynamic              
             relative key is recnum               
             file status  is DSPFILE-file-status   
             control-area is ws-control.         
      
      01 ws-control.
          05 function-key           PIC X(02)
          05 device-name           PIC X(10)
          05 record-format         PIC X(10)
      
      
      read DSPFILE                  
        indicators are ws-control
      Here are the keys listed in the manual:

      Code:
      Where:
      function-key
      Is a 2-digit number inserted in the field by the workstation interface that
      identifies the function key the operator pressed to initiate the transaction.
      
      Nbr        Meaning
      00          Enter key
      01-24     Function keys 1 through 24
      90          Roll up / Page down key
      91          Roll down / Page up key
      92          Print key
      93          Help key
      94          Clear key
      95          Home key
      99          Undefined
      Disclaimer: I don't personally use this technique...

      Comment


      • #4
        I really appreciate your quick response. But actually, I'm not sure if I follow you correctly because I'm expecting it a little different. Since I can capture the F3 key using CF03, I was thinking there's also something like CFxx for Enter key?

        The code you posted is not a COBOL code is it?

        Code:
        DSPF:
        A PRINT
        A CF03(03)
        A HELP
        A INDARA
        
        COBOL:
        01 INDIC-AREA.
        05 IN03 PIC 1 INDIC 03.
        88 ENDP VALUE B'1'.
        88 NOT-ENDP VALUE B'0'.
        .
        .
        .
        IF NOT-ENDP
           some cobol statements.

        Comment


        • #5
          Hi Terry,
          Thanks for your suggestion. I get it now.

          Hi JonBoy,
          Thank you also for your help.

          Comment


          • #6
            Originally posted by testingasfourhundred View Post
            I really appreciate your quick response. But actually, I'm not sure if I follow you correctly because I'm expecting it a little different. Since I can capture the F3 key using CF03, I was thinking there's also something like CFxx for Enter key?

            The code you posted is not a COBOL code is it?
            No - it is RPG - sorry I missed the "COBOL" part of your question and didn't notice that it was on the COBOL list because it came to me as an email.

            However - the principles are the same including associating indicators to the Enter key via VLDCMDKEY,

            But Terry has given you a nice example that should work for you.

            Comment


            • #7
              Yeah, when I saw Terry's post, I couldn't help to smile as I finally understand that control-area.
              I'm not familiar with RPG but I also want to learn that.

              Comment


              • #8
                Originally posted by testingasfourhundred View Post
                Yeah, when I saw Terry's post, I couldn't help to smile as I finally understand that control-area.
                I'm not familiar with RPG but I also want to learn that.
                So you're learning COBOL and want to learn RPG as well? Interesting choices for 2017.

                Comment


                • #9
                  It's good that your learning the proverbial "dead" language: COBOL ;-) Master it and you might be making *very* good money in few years

                  BTW, my preferred method is to utilize the IO area via an ACCEPT statement - its much more versatile, IMO.

                  Comment

                  sponsored links

                  Collapse

                  Working...
                  X