EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
  • 1.  EGL Move by Name : structured to basic with space-value (" ")

    Posted 07/06/15 10:06 AM

    Forum,

    It seems that i cannot move a blank value/space (" ") by name from structured to a normal basic record.

    You can find a code example in attachment.

     

    I'm using RBD 9.1 

     

    We need this since the database contains space-values.

    Niek_Vandael


  • 2.  Re: EGL Move by Name : structured to basic with space-value (" ")

    Posted 07/06/15 11:38 AM

    Hi Niek,

     

    The string type is a variable-length and blank/space is unvalued.
    I did your sample and i changed the aField char(1) and result was:

     

    Value of RecB.aField: - -
    Value of RecB.bField: -A-

     

    Regards,

    Hsieh

    Hsieh


  • 3.  Re: EGL Move by Name : structured to basic with space-value (" ")

    Posted 07/06/15 12:04 PM

    Niek,

     

    As Hsieh said, a "string" is always a variable length field whose length is defined by the number of non-blank characters in the field.  Therefore, by definition, when a "move" or "assignment" is done to a targer string field, the right most "blanks" are removed from the field.   So, in your case, the "string" is empty.

     

    If you are required to use a string (vs CHAR) to interface with the database, then you can use a limited length string.  A limited length string has a defined length such as STRING(1) in your example.   If you define these as string(1) (or some string(n)), then the string will contain a blank value and test true for blank.

     

    You can create SQL records to use limited length strings by using SQL Retrieve.

     

    Finally, while the writestdout might strip the blanks and the comparisons may say it is "not blank", I would actually think the insert would result in blank data (vs null) in the column up to the defined Maxlen. .  Have you confirmed the column in the database is not blank after an insert or update?

     

    Mark

    markevans


  • 4.  Re: EGL Move by Name : structured to basic with space-value (" ")

    Posted 07/07/15 02:01 AM

    Hi Mark, Hsieh,

    Thanks for the clarification.
     

    @Mark: No, i'm not using an SQL record, i'm using 2 basic records for mapping between structured and non-structured records.
    (Database transactions are executed at another application level)

     

    * string(1) does not seem to work, the output is still -- (without space).

    * char(1) works fine

    Niek_Vandael


  • 5.  Re: EGL Move by Name : structured to basic with space-value (" ")

    Posted 07/07/15 07:51 AM

    Niek,

    FYI....

    when you compare the string(1) to " " (blank), it will test true unlike just "string" which will be false.  

     

    The reason you don't "see" it when writing it out via Writestdout is that internally writestdout uses a string to hold the text you are writing out.  Therefore again by definition, any trailing blanks are removed when the concatenation happens.

     

    Mark

     

    markevans


  • 6.  Re: EGL Move by Name : structured to basic with space-value (" ")

    Posted 07/07/15 07:54 AM

    Mark, thanks for the information. I will keep that in mind when writing this code differently :)

    Niek_Vandael