sponsored links

Collapse

Announcement

Collapse
No announcement yet.

validate field value against character set

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

  • validate field value against character set

    Hello All,

    Is there an API that will compare a field value against the RPG CHARACTER SET? Just wondering as I'm looking to ensure no special characters are loaded to a comment field, only want valid RPG CHARACTER SET data.
    Note...invalid data causes subfile to error out 'Permanent I/O error occurred in file PGM123 (C G D F).'

    Thanks,

    Pagen

  • #2
    Re: validate field value against character set

    special characters are valid...there is no RPG CHARACTER SET. your error is most likely due to something else. if you look in your job log was do the messages prior to that error tell you?
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: validate field value against character set

      i think hes loading it from outerspace
      and sometime the data looks like this
      Code:
      @„ÉuöOŠGG„ÀuøV¾Ä-[‹Ãf¥‹ÈŠ@„Òuù‹]ø‹û+Á‹ñOŠOG„Éuø‹ÈÁéó¥‹Èƒáó¤‹
      my personal favorite that if you define a constant in your RPG you can display
      on a screen ( i call it the bullet hole)
      Code:
      ¤
      d Eof             S              1    inz('¤')
      anyway........ use a constant at top of program with valid entries
      then do a check against the incoming data.

      Code:
      d string          c                   CONST('ABCDEFGHIJKLMNOPQRSTUVWXYZ - 
      d                                            01234567890:')               
      
      if        %Check(string : dsSF.opendate ) = 0     // 
      endif
      if you find something guess you could substr it out and %replace
      it with frog DNA like the HULK or Jurassic Park.
      (or maybe just a plain old "@")

      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


      • #4
        Re: validate field value against character set

        The joblog states...
        'Data sent to device XXXXXXX not valid. Negative response code is
        10050111.
        Permanent I/O error occurred in file XXXXXD.
        Permanent I/O error occurred in file XXXXXD (C G D F).


        The error is due to a user copying a line of data from a spreadsheet and pasting that data into a maintenance screen field. Example, the user types 'This is a test...', once the data is pasted into the AS400 field, the '...' data is translated to a hex value which causes the above error. I replaced the hex value with a blank and was able to access the program without an error.

        Comment


        • #5
          Re: validate field value against character set

          thats what I was saying
          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


          • #6
            Re: validate field value against character set

            Hi pagenbeast:

            I had the same issue a while back:
            http://code400.com/forum/showthread.php?t=6527

            I would start by scanning the "pasted" field looking for characters less than x'40' and greater than x'F9' and replaceing with ' ' or @

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

            Comment


            • #7
              Re: validate field value against character set

              ok so it's an EBCDIC conversion error ... that sounds more like it...
              I'm not anti-social, I just don't like people -Tommy Holden

              Comment


              • #8
                Re: validate field value against character set

                Thanks All for the responses. Sorry if not more clear on first post.

                GLS...thanks for the help also. I used the %SCAN, looking for each element of my field being < X'40' or > X'F9' and this found the incorrect data.

                Thanks again.

                Pagen

                Comment


                • #9
                  Re: validate field value against character set

                  Even still, several hex codes that are valid EBCDIC characters may be considered
                  " invalid data " for a database file and may need to be removed from the data.

                  Code:
                  D IChar           C                   Const(                                
                  D                                     X'000102030405060708090A0B0C0D0E0F+   
                  D                                       101112131415161718191A1B1C1D1E1F+   
                  D                                       202122232425262728292A2B2C2D2E2F+   
                  D                                       303132333435363738393A3B3C3D3E3F+   
                  D                                       404142434445464748494A4B4C4D4E4F+   
                  D                                       505152535455565758595A5B5C5D5E5F+   
                  D                                       606162636465666768696A6B6C6D6E6F+   
                  D                                       707172737475767778797A7B7C7D7E7F+   
                  D                                       808182838485868788898A8B8C8D8E8F+   
                  D                                       909192939495969798999A9B9C9D9E9F+   
                  D                                       A0A1A2A3A4A5A6A7A8A9AAABACADAEAF+   
                  D                                       B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF+   
                  D                                       C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF+   
                  D                                       D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF+   
                  D                                       E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF+   
                  D                                       F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF')
                  Code:
                  D OChar           C                   Const(                               
                  D                                     X'40404040404040404040404040404040+  
                  D                                       40404040404040404040404040404040+  
                  D                                       40404040404040404040404040404040+  
                  D                                       40404040404040404040404040404040+  
                  D                                       404040404040404040404A4B4C4D4E4F+  
                  D                                       504040404040404040405A5B5C5D5E5F+  
                  D                                       606140404040404040406A6B6C6D6E6F+  
                  D                                       404040404040404040797A7B7C7D7E7F+  
                  D                                       40818283848586878889404040404040+  
                  D                                       40919293949596979899404040404040+  
                  D                                       40A1A2A3A4A5A6A7A8A9404040404040+  
                  D                                       40404040404040404040404040404040+  
                  D                                       C0C1C2C3C4C5C6C7C8C9404040404040+  
                  D                                       D0D1D2D3D4D5D6D7D8D9404040404040+  
                  D                                       E040E2E3E4E5E6E7E8E9404040404040+  
                  D                                       F0F1F2F3F4F5F6F7F8F9404040404040')
                  Code:
                  C     IChar:OChar   Xlate     DATA          DATA
                  It is shooting out 'valid' ebcdic characters, just not the ones that we would hope to find in character or numeric fields.

                  Comment

                  sponsored links

                  Collapse

                  Working...
                  X