Copy TXT to DB2

25 pts.
Tags:
AS/400
CPYFRMIMPF
DB2
I have a text file that has special characters such as ! ' and the do not translate correctly to the DB2 table/ File. I am using the CPYFRMIMPF as follows:
CPYFRMIMPF +
FROMSTMF('/qntc/fp2554/Temp$/MISJSE/0000000+
436_MISJSE.txt') TOFILE(QTEMP/REPORT165P) +
MBROPT(*REPLACE) RCDDLM(*CRLF) +
STRDLM(*NONE) RMVBLANK(*NONE) FLDDLM('é')
MONMSG     MSGID(CPF2817)

Answer Wiki

Thanks. We'll let you know when a new response is added.
You can always check for the hex value. Define it as a constant like this,
It replaces the char with a blank.
D IComma           C                   Const(X’6B’)
OChar                  C                   Const(X’40’)
then
EVAL      CONVRT = %xlate(IComma: Ochar: MYFIELD)

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • BigKat
    I was going to say specify a translation table with the characters in it, but that option is on CPYFRMSTMF which doesn't let you specify the field delimiter. :(
    9,000 pointsBadges:
    report
  • ToddN2000
    Does the process work but you are not getting your expected results? Do you get an error when running the command? What language / char set is being used?
    89,385 pointsBadges:
    report
  • Peteakers
    If you can create the to_file first on the iSeries first, this will insure that the file has the correct ccsid, then put your records into this file using the cpyfrmimpf command. Something like this might work. 
    CPYFRMIMPF FROMSTMF('//dir/file') TOFILE(QTEMP/EXISTINGFL) MBROPT(*REPLAC
    E)      
    65 pointsBadges:
    report
  • Jengel157

    I am programming in RPGILE.  The trick is that I am opening Notepad and allowing users to paste documentation they used an AI product Big Hand to dictate to. It is looking better after I wrote a pgm to xlate

    fReport165PUP   e           k disk                              
    **                                                              
    d COMMA           c                         CONST('!')          
    d NCOMMA          c                         CONST('|')          
    C                   eval      STRING2 = *BLANKS                 
    C     COMMA:NCOMMA  Xlate     FIELD1        String2         378 
    C                   Eval      Field1 = STRING2                  
    C                   update    Report165r                        
                                                                    

    Got one bug in that the ' came over as ’.  And that looks really weird when looking at it in Hex via DBU.

    Problem is how do I add ’ to the program for translation.





    25 pointsBadges:
    report
  • Peteakers
    Have you tried this.

    Quote           c                   const('''')
    65 pointsBadges:
    report
  • Jengel157

    Will try in a week on vacation


    25 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: