ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Bulk File Translate O.o Field by Field

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

  • #16
    Re: Bulk File Translate O.o Field by Field

    Originally posted by GLS
    WOW Philippe you really know how to spoil a party.

    It's been 2 hours since your comment ...... I think you scared peacealida away

    GLS

    @Gary : Thanks to my previous post we know now that peacealida has to export the data from DB2 to Oracle and this enabled us to move forward
    Last edited by Mercury; July 8, 2011, 03:58 AM. Reason: forgot to quote...
    Philippe

    Comment


    • #17
      Re: Bulk File Translate O.o Field by Field

      No
      What I am doing is, FROM EPICIDE PHYSICAL FILE convert to ASCII Physcial FILE and copy to IFS...
      because of compliance issue. I don't really know why too...

      But I hav about 100 files to covnet and each contains about 60-80 fields.
      Any good idea on how to handle?
      cherrs to every1 who helped

      Comment


      • #18
        Re: Bulk File Translate O.o Field by Field

        The following should work:-
        Code:
        CPYTOIMPF FROMFILE(*LIBL/TESTPF) TOSTMF('/testfolder/testfile.csv') MBROPT(*REPLACE) STMFCCSID(*PCASCII) RCDDLM(*CRLF)
        This command will create a csv file (as mentioned). But I believe you can create other types of files in a similar fashion.
        Last edited by vikramx; July 8, 2011, 02:38 AM.

        Comment


        • #19
          Re: Bulk File Translate O.o Field by Field

          This is the current solution, but it cause problem for chinese word.
          so we have to use 'QDCXLATE' to process.
          But I dun want to write 100s of programs to solve this matter..

          Comment


          • #20
            Re: Bulk File Translate O.o Field by Field

            In which case, the other solution is:-
            1.) Create the CSV in EBCDIC itself
            2.) Write a program to read each character of the CSV and convert it to ASCII using ur QDCXLATE function.

            Comment


            • #21
              Re: Bulk File Translate O.o Field by Field

              I can't there are quite a lot limitation on my program.
              I have to convet from EBCDIC-FILE1 to ASCII-FILE1
              For 100 Files, but need to process field by filed by calling QDCXLATE.

              Comment


              • #22
                Re: Bulk File Translate O.o Field by Field

                Other than writing 100 different programs (1 each to tackle the structure/layout of each of the 100 files), I do not see much of a way. Reading an EBCDIC csv file wouldve ensured that u need only 1 program but if this cant be done, I am not sure how you can achieve this.

                Comment


                • #23
                  Re: Bulk File Translate O.o Field by Field

                  You could use the SQL DESCRIBE statement along with the SQL Descriptor Area (SQLDA) to dynamically get field names, types and lengths. It's a bit tricky to apprehend but not that much and we can help anyway if interested.
                  Philippe

                  Comment


                  • #24
                    Re: Bulk File Translate O.o Field by Field

                    I have used DSPFFD to create a table with field name and attribute.
                    Now the bottle neck the how to call QDCXLATE by passing each field of the file

                    Comment


                    • #25
                      Re: Bulk File Translate O.o Field by Field

                      There is no easy way to indirectly address database fields from RPG ... You have to internally describe and override the input and output files and to assemble programatically the data structure of the output format using the information of dspffd.

                      If there is no packed numerical field (which I doubt to be convertable to ascii) in the tables then you can try to translate the complete record (internally described as one long field) to ascii and then write it to the target table ...

                      No example source available atm, sorry but I think this could be one solution for your problem.
                      Last edited by sms_mitschs; July 11, 2011, 08:05 AM.
                      Sven

                      The best way to prove your knowledge is to share it ...

                      Comment


                      • #26
                        Re: Bulk File Translate O.o Field by Field

                        About the only way I can think of to do this in a single program with your restrictions is to use the database apis to extract each field from the file, and use dynamic SQL to build the files while calling a translate function against each field.
                        Michael Catalani
                        IS Director, eCommerce & Web Development
                        Acceptance Insurance Corporation
                        www.AcceptanceInsurance.com
                        www.ProvatoSys.com

                        Comment

                        Working...
                        X