Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

TechTip: SQL2CSV and SQL2XML

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

  • TechTip: SQL2CSV and SQL2XML

    Ah har... you found the error. When I copied the command definition one of the parameters was missing. So NAMING took the value from 'Action on error'(*CONTINUE) and that's where CON came from. Thanks Giuseppe Trevor

  • #2
    TechTip: SQL2CSV and SQL2XML

    I've tried and it works perfectly. You can wait until next week for 2 new "pure java" versions: one includes the parameter for unicode encoding, the other uses another api that natively encodes in UTF. When I find some time I will port this feature to the RPG version too. Giuseppe.

    Comment


    • #3
      TechTip: SQL2CSV and SQL2XML

      Thanks for the useful utility! Just in these days, I have to export a table greater than 2,000,000 rows and to prevent an error in writing the user space, I modified the source: //SpcSize = objd_size; to maintain the original value. So it seems to work. Is there a better way to solve this problem? Regards, Benvenuto

      Comment


      • #4
        TechTip: SQL2CSV and SQL2XML

        The program SQL2CSVR creates a usrspc near the max size allowed of 15MB and retrieves the actual size. Then it starts writing into it. When the space is quite full, it calls the SQL2IFS that writes it to ifs and than SQL2CSVR restart writing into the space. When the space becomes full again - or when done - data into the usrspc are appended to the existing ifs that can be larger than 15MB.

        Comment


        • #5
          TechTip: SQL2CSV and SQL2XML

          Hi There, I'm stuck with the compilation portion, after selecting as stated in the pgm listing "dftactgrp(*no) actgrp('XML') bnddir('QC2LE') debug" but it say missing QC2LE and XML... Regards, Sham

          Comment


          • #6
            TechTip: SQL2CSV and SQL2XML

            Hi Guiseppe! I have found that wrong content is produced in subsequent numeric fields when a numeric field is null. I have changed the code a little, so that the cn variable is incremented if a column is null but would otherwise have been edited (and cn thus incremented as part of that code). This minor code change seems to have the desired effect... Thanks again for the tool...
            Code

            Comment


            • #7
              TechTip: SQL2CSV and SQL2XML

              ** This thread discusses the article: TechTip: SQL2CSV and SQL2XML **
              ** This thread discusses the Content article: TechTip: SQL2CSV and SQL2XML **
              0

              Comment


              • #8
                TechTip: SQL2CSV and SQL2XML

                ** This thread discusses the article: TechTip: SQL2CSV and SQL2XML **
                Excellent tools! One caveat though, SQL2XML does not handel alfa fields with a value beginning with blank positions well: if flnree contains value "0010", XML is: 0010 if flnree contains value " 10", XML is: which is wrong. Regards, Jan

                Comment


                • #9
                  TechTip: SQL2CSV and SQL2XML

                  ** This thread discusses the article: TechTip: SQL2CSV and SQL2XML **
                  Jan, try to change statement: 0562.00 od = %len(%trim(%subst(XML:1:SQLLEN))); with: 0562.00 od = %len(%trimr(%subst(XML:1:SQLLEN))); Note that displayng with IE trims left the field but if you see the document it has the trailing blanks.

                  Comment


                  • #10
                    TechTip: SQL2CSV and SQL2XML

                    ** This thread discusses the article: TechTip: SQL2CSV and SQL2XML **
                    The problem is solved Giuseppe. Jan

                    Comment


                    • #11
                      TechTip: SQL2CSV and SQL2XML

                      ** This thread discusses the article: TechTip: SQL2CSV and SQL2XML **
                      Great tools, signore! I am using this on a system in the US, and it insists on creating my IFS stream files with CCSID = 37 (even though the contents are in ASCII). I have tried changing codepage and ccsid values in SQL2IFS, but I continue to get 37 for CCSID. Do you have any suggestions? Paul

                      Comment


                      • #12
                        TechTip: SQL2CSV and SQL2XML

                        ** This thread discusses the article: TechTip: SQL2CSV and SQL2XML **
                        Paul, actually I forgot to set the codepage. please change SQL2IFS as follows: 0239.00 d codepage S 10U 0 Inz(?????) <-- Put your codepage here 0297.00 if pMODE = '*REPLACE'; 0298.00 oflag = O_CREATE + O_WRONLY + O_TRUNC + O_CODEPAGE; Make sure the file does not exist when you try to create it. (if it exists you can delete it with 'unlink' before creating it) Giuseppe.

                        Comment


                        • #13
                          TechTip: SQL2CSV and SQL2XML

                          ** This thread discusses the article: TechTip: SQL2CSV and SQL2XML **
                          I had tried changing codepage, but didn't change the oflag value. That works just fine! Grazie mille! Paul

                          Comment


                          • #14
                            TechTip: SQL2CSV and SQL2XML

                            ** This thread discusses the article: TechTip: SQL2CSV and SQL2XML **
                            Nice tool! I have one reservation, though. It doesn't seem to handle floating point fields. It seems that these fields are being treated as character fields. Is this correct? Best regards, Kaj

                            Comment


                            • #15
                              TechTip: SQL2CSV and SQL2XML

                              ** This thread discusses the article: TechTip: SQL2CSV and SQL2XML **
                              Kaj, you can cast your float field into a decimal with the desired precision when you code the sql statement like: "select decimal(amtfloat, 10, 2) as amtfloat from table" or try inserting the code below
                              Code

                              Comment

                              Working...
                              X