Results 1 to 9 of 9

Thread: validate field value against character set

  1. #1
    Code400 Newbie
    Join Date
    Oct 2007
    Location
    Northeast, PA
    Posts
    32
    Rep Power
    543

    Question 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. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Posts
    1,000,000
     

  3. #2
    Harbinger of Doom tomholden's Avatar
    Join Date
    Dec 2007
    Location
    Lebanon, Tennessee, United States
    Posts
    4,324
    Rep Power
    8639

    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

  4. #3
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,416
    Rep Power
    12604

    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

  5. #4
    Code400 Newbie
    Join Date
    Oct 2007
    Location
    Northeast, PA
    Posts
    32
    Rep Power
    543

    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.

  6. #5
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,416
    Rep Power
    12604

    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

  7. #6
    Analyst GLS400's Avatar
    Join Date
    May 2006
    Location
    connecticut
    Posts
    1,900
    Rep Power
    5796

    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

  8. #7
    Harbinger of Doom tomholden's Avatar
    Join Date
    Dec 2007
    Location
    Lebanon, Tennessee, United States
    Posts
    4,324
    Rep Power
    8639

    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

  9. #8
    Code400 Newbie
    Join Date
    Oct 2007
    Location
    Northeast, PA
    Posts
    32
    Rep Power
    543

    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

  10. #9
    Programmer Analyst
    Join Date
    May 2008
    Location
    Belgium
    Posts
    395
    Rep Power
    2580

    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.

  11. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Posts
    1,000,000
     

Facebook Comments


Similar Threads

  1. Regarding Journaling
    By Sandeep D in forum RPG/RPGLE
    Replies: 3
    Last Post: November 16th, 2009, 07:37 AM
  2. CHECK(RB) on a character field not working
    By hockeygrl in forum DDS
    Replies: 3
    Last Post: May 18th, 2006, 01:02 PM
  3. Conv 23 Character field to 23 numeric field
    By Surya in forum RPG/RPGLE
    Replies: 4
    Last Post: February 3rd, 2006, 02:08 PM
  4. Replies: 8
    Last Post: June 17th, 2005, 02:44 PM
  5. Null Values and SQL Fetch
    By pjk in forum SQL
    Replies: 1
    Last Post: February 22nd, 2005, 11:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •