Programming Languages on Power

Power Programming Languages

IBM Power, including the AIX, IBM i, and Linux operating systems, support a wide range of programming languages, catering to both traditional enterprise applications and modern development needs.


#Power

 View Only
  • 1.  SQLRPGLE - CLOB

    Posted Tue November 15, 2022 03:18 PM
    I know defining a sqltype(clob:xx) field causes the RPG compiler to generate related fields with _data and _len.  If setting the clob in RPG, you'd want to set those 2 fields and then the clob field can be used in SQL statements.

    I recall seeing a error situation when I tried to directly access the clob field outside a SQL statement (regular RPG lines of code).  I looked into documentation but didn't see anything directly stating this.  I just ran a test and using the clob in RPG worked, but I'm nervous that something I experienced in the past could become a problem if I do this.  Maybe there was a fix, or maybe I'm "just getting lucky" in my test now, but I want to be certain of the technique that should be used.

    My question is: can I directly access this type of field outside a SQL statement, or should I always use the _data/_len fields in that situation?

    Thanks!

    ------------------------------
    Dave Weissman
    ------------------------------

    #SQL


  • 2.  RE: SQLRPGLE - CLOB

    Posted Tue November 15, 2022 04:42 PM

    The stand alone field is converted by the pre-compiler into a Data structure, i.e.

     

    //* DCL-S MyClob SQLTYPE(CLOB: 100000);

    DCL-DS MyClob;

       MyClob_Len  Uns(10);

       MyClob_Data  Char(100000) CCSID(*JOBRUNMIX);

    END-DS;

     

    In your RPG Program you can use MYCLOB like any other data structure and the subfield MYCLOB_LEN and MYCLOB_DATA like any other data structure subfields.

     

    Mit freundlichen Grüßen / Best regards

     

    Birgitta Hauser

    Modernization – Education – Consulting on IBM i

    IBM Champion seit 2020 IBM Champion seit 2020 IBM Champion 2021

     

    "Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown)

    "If you think education is expensive, try ignorance." (Derek Bok)

    "What is worse than training your staff and losing them? Not training them and keeping them!"

    „Train people well enough so they can leave, treat them well enough so they don't want to." (Richard Branson)

     

     






  • 3.  RE: SQLRPGLE - CLOB

    Posted Fri November 18, 2022 09:40 AM
    thank you for your reply and for clarifying

    ------------------------------
    Dave Weissman
    ------------------------------