ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Yet another subfile question

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

  • Yet another subfile question

    I have a subfile that I am doing a readc to and then error checking my data. I am moving a message to a message field. This is working and I see the error. When I correct the error and press enter my program is going back to the original data that was on the screen. For example. My program has 1234 in a field. I change it the first time in to 5678. When it does the error checking it finds 5678 is an invalid number and displays that on the screen. When I now go to change the 5678 to 5687 (correct number) it puts back the 1234 that was originally there. In debug I see the readc pick up the change from 1234 to 5678 but when I go correct it to 5687 the readc indicator is not coming on. Is there a trick to resetting something so that the indicator for the readc will come on or what do I need to do?

  • #2
    Re: Yet another subfile question

    When running thru the readc loop and using the update on the subfile....try Turning off then back on the indicator for the readc

    Hope this helps
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Yet another subfile question

      Okay. I got that working...now I have another question. How do I highlight the row and field that actually has an error in the subfile. In other words if my error is field A on line 5 that has an error and all others are okay how can I highlight line 5 to draw attention to that line? I know the highlight keyword...just don't know how to make it only highlight line 5 and not all the rest.

      Comment


      • #4
        Re: Yet another subfile question

        You dont want to highlight the whole line just the field in error..

        so assign indicators to each field for the reverse image
        Lets say start with *in60...then *in61 ...etc

        When you readc thru the subfile if you find an error at the second field then set on *in61 then update subfile

        after the update subfile make sure you eval *in61 off

        you can see some of that in the message subfile program on the site
        here :


        download the text files and look at the $validate subroutine as well as the associated DDS

        Jamie
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: Yet another subfile question

          I'm a little behind the times.... I've never used an update subfile...nor do I know how/when/why to use it? Can you explain a little?

          Traci

          Comment


          • #6
            Re: Yet another subfile question

            The update subfile we are discussing is just a standard update that you would use say against a logical file.


            Internal program changes to a row in a subfile made by your program will only be reflected to the end user if in your program -after you make the change - (setting on error indicator, position cusrsor) you update the subfile record

            I attached an entire program please take a look when you are able

            The $validate subroutine gets the total records loaded in subfile from the $loadsfl subroutine and uses this number to loop thru the entire subfile with the chain opcode...
            once it finds an error on the subfile line (field) it sets that indicator on for reverse image and position cursor.
            Once this is done it then does an update to the subfile record format name.
            then it setsoff the error indicators.

            Code:
                 fWKR31AD   cf   e             WORKSTN INFDS(INFDS)
                 f                                     SFILE(SUB01:RRN1)
                 f                                     SFILE(SUB02:RRN2)
                 f                                     SFILE(SUB03:RRN3)
                  *
                  *  Check for changes in subfile01 - route errors
                  *
                 c                   for       count   = 1 to Savrrn
                 c     count         chain     SUB01
                 c                   if        %Found
                  *
                 c                   select
                  *
                  * The from field
                  *
                 c                   when      S1OPT = 'F'
                 c                   if        SelFromRrn = *zeros
                 c                   eval      SelFromRrn =count
                 c                   eval      LoadFrom = S1LOAD
                 c                   eval      values +=1
                 c                   else
                 c                   eval      MSGID = 'WKR2704'
                 c                   eval      MSGDTA = *blanks
                 c                   exsr      $SNDMSG
                 c                   eval      ScreenError = 'Y'
                  *
                 c                   if        H1FROM = 'Y'
                 c                   eval      *In50 = *on
                 c                   eval      S1OPT = 'F'
                 c                   endif
                  *
                 c                   update    SUB01
                 c                   eval      *in60 = *off
                 c                   eval      *In50 = *off
                 c                   clear                   S1OPT
                 c                   endif
            Attached Files
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment

            Working...
            X