|
Hi Lakshmi,
> DbTLogonMsg DS
> D bMsgCode 5A
> D bMsgLen 5A INZ(' ')
>
> C MOVE *BLANKS bMsgCode
>
> I initialized one subfield with Blanks and Moved Blanks to another
> subfield.
After this code runs, both bMsgCode and bMsgLen are filled with spaces.
Is that what you're asking? Or, what are you asking?
> In RPG, Moving Blanks and Moving NULL to a Character variable are same or
> different?
> If it is different, how to move NULL to a Character Variable?
When you say "NULL" what are you refering to?
Are you talking about database NULL value support? (This is controlled in
RPG using the ALWNULL keyword on the H-spec and %nullind() BIF in the
calcs)
Is that what you mean? If so, it's different from moving blanks to a
character field. Blanks are still a value. %nullind() is a separate
indicator that you can check that means "no value."
Are you talking about NULL pointers? These are set and checked for by
comparing a pointer to the special value *NULL.
Is that what you mean? If so, it's VERY different from setting the string
to blanks -- since whatever is based on this pointer has no memory, it
cannot be filled with spaces without the program crashing.
Are you talking about an empty varying string? For example:
D myString s 10A varying
c eval myString = ''
or, another way of doing the same thing:
D myString s 10A varying
c eval %len(myString) = 0
Is that what you mean? If so, it's different from moving blanks to a
string. Moving blanks means that the string is 5 bytes long, each byte
contains a space character. Space is unprintable, but it's still a
character x'40'. For example:
D bigString s 20A
D myString s 10A varying
c eval %len(myString) = 0
c eval myString = '
c eval bigString = 'Word1'+mystring+'Word2'
After that code runs, bigString will contain "Word1Word2"
However, if I move blanks to a fixed-length string:
D bigString s 20A
D myString s 10A
c eval myString = *blanks
c eval bigString = 'Word1'+mystring+'Word2'
After that code runs, bigString will contain 'Word1 Word2'
See the difference? in the first case, there's no data in myString, so
when I concatenate it, it does not add anything to the string. in the
second case, myString is full of spaces. When I concatenate it, I add 10
spaces to the string.
I hope I answered your question. Since I'm not clear on what you're
really asking, I actually answered 3 different questions.
Please clarify what you meant.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.