Issue with character spacing when retrieving from DB2 database RRS feed

  • Question

  • User-303073526 posted


    I have a question in regards to the character alignment  when we are retrieving data from AS400.

    We want the alignment in the Characters to be spaced in a similar  fashion across the string variable but we are finding that we cannot control this and the text is out of alignment.   

    We have a notes screen on the AS400 that was created in DDS (10 lines and 70 chars across) and when one of our users enter notes on the screen they are aligned, however, when we read data into .Net using DB2Connection  we find the characters are not aligned as expected.                       

     Is there anyway we can control this behavior through DB2connection?   

    Are there any options we can use? or can we control this programmatically  in the .net / C# code or when we use SQL to cast the data into our  program?

    We have looked online and cannot see anything obvious to us?        As400 view

    I am not able to successfully attach the example screen shots to explain the scenario.




    Friday, July 29, 2016 1:26 PM

All replies

  • User-359936451 posted

    Not sure what you are trying to do format wise in .NET, but you should be able to fully control placement in the .NET environment. What language are  you using? Have you tried TRIM statements to remove spacing? In .NET you can use the string format functions to do just about anything you need to.

    Post your .net code.

    I have found that the data type in databases can cause unusual behavior when strings are assigned in .net, for example nchar and varchar data types format unusually sometimes in .Net. I have had to use nvarchar data types in SQL to get better behavior, I think this may have to do with the support of UNICODE characters.

    Friday, July 29, 2016 2:42 PM
  • User269602965 posted

    The other issue is BINARY GARBAGE, that is, non-printable characters (TAB, and many others).  If your data collection application does not clean these up front on processing, they get loaded into the database, then when extracted, the strings are affected with unexplained formatting. 

    Friday, July 29, 2016 10:02 PM