ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to clear the input screen field after enter the data

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

  • How to clear the input screen field after enter the data

    Hi All,

    when the user has keyed data into the field, I want to redisplay the screen with empty field and also must display the a massage at the bottom of the display saying "report print successfully".I tried to implement this using below codes, but messege display as wanted but with the same input data also display in the filed.




    Code:
    0001.00 FSDTAINQLF UF A E           K DISK                                                                  120628
    0002.00 FSDTAINQWTNCF   E             WORKSTN indds(indicators)                                             120628
    0002.01 FSDTAINQPRTO    E             PRINTER oflind(*in10)                                                 120628
    0002.02                                                                                                     120628
    0002.10                                                                                                     120628
    0003.00 Dindicators       ds                                                                                120623
    0004.00 DexitKey                          n   overlay(indicators:3)                                         120625
    0006.00 DgenerateKey                      n   overlay(indicators:6)                                         120625
    0006.01 DrecordFound                      n                                                                 120625
    0008.00 DinstNotFound                     n   overlay(indicators:52)                                        120625
    0008.01 DinstEmpty                        n   overlay(indicators:51)                                        120625
    0008.02 Dinst                             n   overlay(indicators:50)                                        120627
    0008.03                                                                                                     120628
    0008.06                                                                                                     120628
    0009.00 C     CSTKEY        KLIST                                                                           120623
    0010.00 C                   KFLD                    LNUSR3                                                  120627
    0010.01                                                                                                     120628
    0010.05                                                                                                     120628
    0011.00  /free                                                                                              120628
    0012.00       exfmt hdrscn;                                                                                 120625
    0013.00       // Loop until exit key is pressed                                                             120625
    0014.00       dow not exitKey;                                                                              120625
    0014.01               // Check if user input blank value                                                    120628
    0014.02       if LNUSR3 <> '';                                                                              120627
    0014.03                 // If user not input blank value then exicute sub route                             120628
    0014.04                 //Turn off error massages                                                           120628
    0014.05       instEmpty = *OFF;                                                                             120625
    0015.00       exsr GenerateSub;                                                                             120625
    0015.03       endif;                                                                                        120625
    0015.04                                                                                                     120628
    0015.05            // If user press exit key then exit the program                                          120628
    0015.06       if exitKey;                                                                                   120625
    0015.07       leave;                                                                                        120625
    0015.08       endif;                                                                                        120625
    0015.09                                                                                                     120628
    0015.10            // Display then main window for the input                                                120628
    0015.11       exfmt hdrscn;                                                                                 120625
    0018.01       // Turn off error messages                                                                    120628
    0018.02       instNotFound = *off;                                                                          120625
    0018.03       enddo;                                                                                        120625 
    0018.04                                                                                                     120628 
    0019.00       *inlr = *on;                                                                                  120625 
    0019.01       //                                                                                            120628 
    0019.02       //                                                                                            120628 
    0019.03       //                                                                                            120628 
    0020.11       //****************************************************************                            120625 
    0020.12       // SUBROUTINE -GenerateSub                                                                    120628 
    0021.00       // PURPOSE - Print the report and display complete msg                                        120628 
    0022.00       //****************************************************************                            120625 
    0022.01       //                                                                                            120628
    0022.02       //                                                                                            120628
    0022.03       //                                                                                            120628
    0023.00       begsr GenerateSub;                                                                            120628
    0023.01       // Lookup Institute Code                                                                      120625
    0024.00       chain CSTKEY LNP0031;                                                                         120628
    0025.00       if not %found(SDTAINQLF);                                                                     120628
    0025.01                                                                                                     120628
    0025.02       // Institute Code is not found in file, turn on error indicators                              120628
    0026.00       instNotFound = *on;                                                                           120625
    0027.00       leavesr;                                                                                      120625
    0030.09       endif;                                                                                        120626
    0030.10                                                                                                     120628
    0030.11          // If Code is valid input,then write header in the report                                  120628
    0030.12       write head;                                                                                   120627
    0030.13          // Set the lower limit for searching                                                       120628
    0030.14       setll cstkey LNP0031;                                                                         120627
    0030.15          // Read the first record                                                                   120628
    0030.16       reade CSTKEY LNP0031;                                                                         120628
    0030.17              // Check if the EOF                                                                    120628
    0030.18       dow not %eof(SDTAINQLF);                                                                      120628
    0030.19          // If report page over flow then write header next page                                    120628
    0030.20       if *in10;                                                                                     120628
    0030.21       write head;                                                                                   120627
    0030.22       *in10 = *off;                                                                                 120628
    0030.23       else;                                                                                         120627
    0030.24              // Write details in the report                                                         120628
    0030.25       endif;                                                                             120627
    0030.27       write DETAILS;                                                                                        120627
    0030.28              // Read next report                                                                    120628
    0030.29       reade CSTKEY LNP0031;                                                                         120628
    0030.32       enddo;                                                                                        120626
    0030.33             // Display the Complete Screen to user                                                  120628
    0030.34                                                                                                     120628
    0030.35       exfmt CSTINQ;                                                                                 120626
    0031.00       endsr; // end of subroutine GenerateSub;                                                      120625
    0032.00  /end-free                                                                                          120628

    Code:
    0000.10      A*%%TS  SD  20120625  224143  SDBL1450    REL-V6R1M0  5761-WDS                                      120625
    0000.20      A*%%EC                                                                                              120625
    0000.30      A                                      DSPSIZ(24 80 *DS3)                                           120625
    0000.40      A                                      REF(*LIBL/SDTAINQLF)                                         120628
    0000.50      A                                      CHGINPDFT(CS)                                                120625
    0000.60      A                                      CA03(03 'Exit')                                              120628
    0000.70      A                                      PRINT(*LIBL/QSYSPRT)                                         120625
    0000.80      A                                      INDARA                                                       120625
    0000.90      A          R HDRSCN                                                                                 120625
    0001.00      A*%%TS  SD  20120625  223602  SDBL1450    REL-V6R1M0  5761-WDS                                      120625
    0001.10      A                                      OVERLAY                                                      120625
    0001.20      A                                  2  4TIME                                                         120625
    0001.30      A                                  2 29'DATA INQUIRE MENU'                                          120625
    0001.40      A                                  2 70DATE                                                         120625
    0001.50      A                                      EDTCDE(Y)                                                    120625
    0001.60      A            LNUSR3    R     A  I  8 40REFFLD(LNUSR3)                                               120625
    0001.70      A                                      DSPATR(UL)                                                   120625
    0001.80      A                                      COLOR(PNK)                                                   120625
    0001.90      A                                      CHECK(ME)                                                    120625
    0002.00      A  52                                  ERRMSG('Institute Code is not in th-                         120628 
    0002.10      A                                      e File' 52)                                                  120628 
    0002.20      A N51                                  ERRMSG('Field Cannot Be Empty' 51)                           120628 
    0002.30      A                                  6 10'Enter Valid Institute Code'                                 120628 
    0002.40      A                                  8 17'Enter Institute Code:'                                      120628 
    0002.50      A                                 21  5'Press Enter to Generate Report'                             120628 
    0002.60      A                                 23  5'F3 - Exit'                                                  120628 
    0002.70      A          R CSTINQ                                                                                 120625 
    0002.80      A                                                                                                   120628 
    0002.90      A                                      OVERLAY                                                      120620 
    0003.00      A                                 24 5'Report Successfully Generated!'                              120628
    0003.10      A                                      COLOR(RED)                                                   120623

  • #2
    Re: How to clear the input screen field after enter the data

    You will need to clear the fields and re-display the format with your desired message.

    Comment


    • #3
      Re: How to clear the input screen field after enter the data

      Hi,

      That is the issue how can i clear those fields, what will be the codes that we can use for this

      Comment


      • #4
        Re: How to clear the input screen field after enter the data

        PHP Code:

        clear SDTAINQWTN

        I'm here to chew bubble gum and kick @#%@#%@#%.....and I'm all outta bubble gum !
        Yes I'm talking to you squirrel nuts.

        Comment


        • #5
          Re: How to clear the input screen field after enter the data

          Hi,

          clear SDTAINQWTN; is not working, it pop up with an error saying "Result-Field operand is not valid for the specified operation."

          Can you help?

          Comment


          • #6
            Re: How to clear the input screen field after enter the data

            I told you wrong can't clear the display have to clear record format(s)

            PHP Code:
             clear HDRSCN
            I'm here to chew bubble gum and kick @#%@#%@#%.....and I'm all outta bubble gum !
            Yes I'm talking to you squirrel nuts.

            Comment


            • #7
              Re: How to clear the input screen field after enter the data

              Hello,

              I manage to do that now screen is clear for new values, but there is another issue here, ie if i use the same input data after the screen clearing it append to the same report, but i want to print it separate report, so as this if i try 3 times with same input it will repeat the same data 3 times in the same report, Can you tel me why is this?

              Note: If i exit the program after generate one report and re stat the pgm and apply the same input, then the data appears in a separate report, So why is this?

              Code:
              0000.10      A*%%TS  SD  20120625  224143  SDBL1450    REL-V6R1M0  5761-WDS                                      120625
              0000.20      A*%%EC                                                                                              120625
              0000.30      A                                      DSPSIZ(24 80 *DS3)                                           120625
              0000.40      A                                      REF(*LIBL/SDTAINQLF)                                         120628
              0000.50      A                                      CHGINPDFT(CS)                                                120625
              0000.60      A                                      CA03(03 'Exit')                                              120628
              0000.70      A                                      PRINT(*LIBL/QSYSPRT)                                         120625
              0000.80      A                                      INDARA                                                       120625
              0000.90      A          R HDRSCN                                                                                 120625
              0001.00      A*%%TS  SD  20120625  223602  SDBL1450    REL-V6R1M0  5761-WDS                                      120625
              0001.10      A                                      OVERLAY                                                      120625
              0001.20      A                                  2  4TIME                                                         120625
              0001.30      A                                  2 29'DATA INQUIRE MENU'                                          120625
              0001.40      A                                  2 70DATE                                                         120625
              0001.50      A                                      EDTCDE(Y)                                                    120625
              0001.60      A            LNUSR3    R     A  I  8 40REFFLD(LNUSR3)                                               120625
              0001.70      A                                      DSPATR(UL)                                                   120625
              0001.80      A                                      COLOR(PNK)                                                   120625
              0001.90      A                                      CHECK(ME)                                                    120625
              0002.00      A  52                                  ERRMSG('Institute Code is not in th-                         120628 
              0002.10      A                                      e File' 52)                                                  120628 
              0002.20      A N51                                  ERRMSG('Field Cannot Be Empty' 51)                           120628 
              0002.30      A                                  6 10'Enter Valid Institute Code'                                 120628 
              0002.40      A                                  8 17'Enter Institute Code:'                                      120628 
              0002.50      A                                 21  5'Press Enter to Generate Report'                             120628 
              0002.60      A                                 23  5'F3 - Exit'                                                  120628 
              0002.70      A          R CSTINQ                    OVERLAY                                                      120702
              0003.00      A                                  2  4TIME                                                         120702
              0004.00      A                                  2 29'DATA INQUIRE MENU'                                          120702
              0005.00      A                                  2 70DATE                                                         120702
              0006.00      A                                      EDTCDE(Y)                                                    120702
              0007.00      A            LNUSR3    R     A  I  8 40REFFLD(LNUSR3)                                               120702
              0008.00      A                                      DSPATR(UL)                                                   120702
              0009.00      A                                      COLOR(PNK)                                                   120702
              0010.00      A                                  6 10'Enter Valid Institute Code'                                 120702
              0011.00      A                                  8 17'Enter Institute Code:'                                      120702
              0012.00      A                                 21  5'Press Enter to Generate Report'                             120702
              0015.00      A                                       COLOR(RED)                                                  120702 
              0016.00      A                                                                                                   120702
              Code:
              0001.00 FSDTAINQLF UF A E           K DISK                                                                  120628
              0002.00 FSDTAINQWTNCF   E             WORKSTN indds(indicators)                                             120628
              0002.01 FSDTAINQPRTO    E             PRINTER oflind(*in10)                                                 120628
              0002.02                                                                                                     120628
              0002.10                                                                                                     120628
              0003.00 Dindicators       ds                                                                                120623
              0004.00 DexitKey                          n   overlay(indicators:3)                                         120625
              0006.00 DgenerateKey                      n   overlay(indicators:6)                                         120625
              0006.01 DrecordFound                      n                                                                 120625
              0008.00 DinstNotFound                     n   overlay(indicators:52)                                        120625
              0008.01 DinstEmpty                        n   overlay(indicators:51)                                        120625
              0008.02 Dinst                             n   overlay(indicators:50)                                        120627
              0008.03                                                                                                     120628
              0008.06                                                                                                     120628
              0009.00 C     CSTKEY        KLIST                                                                           120623
              0010.00 C                   KFLD                    LNUSR3                                                  120627
              0010.01                                                                                                     120628
              0010.05                                                                                                     120628
              0011.00  /free                                                                                              120628
              0012.00       exfmt hdrscn;                                                                                 120625
              0013.00       // Loop until exit key is pressed                                                             120625
              0014.00       dow not exitKey;                                                                              120625
              0014.01               // Check if user input blank value                                                    120628
              0014.02       if LNUSR3 <> '';                                                                              120627
              0014.03                 // If user not input blank value then exicute sub route                             120628
              0014.04                 //Turn off error massages                                                           120628
              0014.05       instEmpty = *OFF;                                                                             120625
              0015.00       exsr GenerateSub;                                                                             120625
              0015.03       endif;                                                                                        120625
              0015.04                                                                                                     120628
              0015.05            // If user press exit key then exit the program                                          120628
              0015.06       if exitKey;                                                                                   120625
              0015.07       leave;                                                                                        120625
              0015.08       endif;                                                                                        120625
              0015.09                                                                                                     120628
              0015.10            // Display then main window for the input                                                120628
              0015.11       exfmt hdrscn;                                                                                 120625
              0018.01       // Turn off error messages                                                                    120628
              0018.02       instNotFound = *off;                                                                          120625
              0018.03       enddo;                                                                                        120625 
              0018.04                                                                                                     120628 
              0019.00       *inlr = *on;                                                                                  120625 
              0019.01       //                                                                                            120628 
              0019.02       //                                                                                            120628 
              0019.03       //                                                                                            120628 
              0020.11       //****************************************************************                            120625 
              0020.12       // SUBROUTINE -GenerateSub                                                                    120628 
              0021.00       // PURPOSE - Print the report and display complete msg                                        120628 
              0022.00       //****************************************************************                            120625 
              0022.01       //                                                                                            120628
              0022.02       //                                                                                            120628
              0022.03       //                                                                                            120628
              0023.00       begsr GenerateSub;                                                                            120628
              0023.01       // Lookup Institute Code                                                                      120625
              0024.00       chain CSTKEY LNP0031;                                                                         120628
              0025.00       if not %found(SDTAINQLF);                                                                     120628
              0025.01                                                                                                     120628
              0025.02       // Institute Code is not found in file, turn on error indicators                              120628
              0026.00       instNotFound = *on;                                                                           120625
              0027.00       leavesr;                                                                                      120625
              0030.09       endif;                                                                                        120626
              0030.10                                                                                                     120628
              0030.11          // If Code is valid input,then write header in the report                                  120628
              0030.12       write head;                                                                                   120627
              0030.13          // Set the lower limit for searching                                                       120628
              0030.14       setll cstkey LNP0031;                                                                         120627
              0030.15          // Read the first record                                                                   120628
              0030.16       reade CSTKEY LNP0031;                                                                         120628
              0030.17              // Check if the EOF                                                                    120628
              0030.18       dow not %eof(SDTAINQLF);                                                                      120628
              0030.19          // If report page over flow then write header next page                                    120628
              0030.20       if *in10;                                                                                     120628
              0030.21       write head;                                                                                   120627
              0030.22       *in10 = *off;                                                                                 120628
              0030.23       else;                                                                                         120627
              0030.24              // Write details in the report                                                         120628
              0030.27       endif;                                                                                        120627
              0030.25       write DETAILS;                                                                                120627
              0030.28              // Read next report                                                                    120628
              0030.29       reade CSTKEY LNP0031;                                                                         120628
              0030.32       enddo;                                                                                        120626
              0030.33             // Display the Complete Screen to user                                                  120628
              0030.34                                                                                                     120628
              0030.39       EXFMT CSTINQ;                                                                                 120702
              0030.40       clear HDRSCN;                                                                                 120702
              0030.41       clear cstinq;                                                                                 120702
              0031.00       endsr; // end of subroutine GenerateSub;                                                      120625
              0032.00  /end-free                                                                                          120628
              Can you just see what is the wrong with my coding

              Comment


              • #8
                Re: How to clear the input screen field after enter the data

                Add USROPN to printfile & in your print routine you need to place the open at the top and
                the close at the bottom.

                PHP Code:

                FSDTAINQPRTO    E             PRINTER oflind
                (*in10)     USROPM

                If not %open(SDTAINQPRTO);
                 
                open SDTAINQPRTO;
                endifl

                if %open(SDTAINQPRTO);
                 
                close SDTAINQPRTO;
                endif; 
                I'm here to chew bubble gum and kick @#%@#%@#%.....and I'm all outta bubble gum !
                Yes I'm talking to you squirrel nuts.

                Comment


                • #9
                  Re: How to clear the input screen field after enter the data

                  Thanks working great

                  Comment

                  Working...
                  X