ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Need refresher on %Scan versus %Checkr

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

  • Need refresher on %Scan versus %Checkr

    Good afternoon,

    I have to check a screen field that is only 13a, but the total length of the data that can be there is 35a.

    If there is a change made to the field, and the field's original length coming in was longer than 13, send a message.

    I will have data like 'DmsKwvGlRxxxxx ggggg ' in this field.

    At first I was just looking for a blank, but was told there could be blanks then letters in there as well. I was thinking %Checkr , looking for a blank and seeing what position that is found in.

    If position is greater than 14 works but what if the blank is at position 13 and there is more text after that.

    For some reason I am having a hard time seeing the clear way to do this.

    Any help would be appreciated. Thank you.

  • #2
    Re: Need refresher on %Scan versus %Checkr

    Code:
    workfld = datafield ;
    workfld = %SCANRPL(' ' : '' : workfld) ;   <---removes blanks
    len = %len(%trim(wrkfld)) ;
    Best of Luck
    GLS
    I think that's what you are looking for.
    The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

    Comment


    • #3
      Re: Need refresher on %Scan versus %Checkr

      Originally posted by GLS400 View Post
      Code:
      workfld = datafield ;
      workfld = %SCANRPL(' ' : '' : workfld) ;   <---removes blanks
      len = %len(%trim(wrkfld)) ;
      Best of Luck
      GLS
      I think that's what you are looking for.
      Hi, thanks for the reply, alas we don't use WDSC so the %ScanRpl is no worky in SEU. I will get it to work an older way.

      Thanks again.

      Comment


      • #4
        Re: Need refresher on %Scan versus %Checkr

        If you are at the proper OS level.....you can use the %scanrpl and save it (the source file) with the error.
        The compiler will work just fine.

        GLS
        The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

        Comment


        • #5
          Re: Need refresher on %Scan versus %Checkr

          Why not simply removing the trailing (or leading and trailing) Blanks and determining the length of the revised text?

          Code:
           
          If %Len(%Trim(YourField)) > 13;
             //Handle Error
          EndIf;
          Birgitta

          Comment


          • #6
            Re: Need refresher on %Scan versus %Checkr

            I think he needs to remove embedded blanks as well

            GLS
            The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

            Comment

            Working...
            X