× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks for your response.

What I am really asking is this.


DbTLogonMsg       DS
D bMsgCode                    5A
D bMsgLen                     5A  INZ(' ')
D aMsgCode                         S                       10A
C
C    eval     bMsgCode = %trim(aMsgCode)           Step 1
C             callp     Translate(%size(bMsgCode):
                                                     bMsgCode:'QASCII')

Lets say aMsgCode = '12bbbbbbbb'   (Where b is a blank).
After execution of step 1, the value of bMsgCode is same as aMsgCode,
but I want the value of bMsgCode as '12nnnnnnnn'    (Where n is the null
value).
And then translate to ASCII.

I hope you understand my question.

Rgds
Lakshmi





                                                                                
                 
                    Scott Klement                                               
                 
                    <klemscot@klements.        To:     RPG programming on the 
AS400 / iSeries    
                    com>                       <rpg400-l@xxxxxxxxxxxx>          
                 
                    Sent by:                   cc:                              
                 
                    rpg400-l-bounces@mi        Subject:     Re: Moving Null to 
a Character       
                    drange.com                 variable                         
                 
                                                                                
                 
                                                                                
                 
                    03/03/2004 01:57 PM                                         
                 
                    Please respond to                                           
                 
                    RPG programming on                                          
                 
                    the AS400 / iSeries                                         
                 
                                                                                
                 
                                                                                
                 





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.
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




Confidentiality Caution
=======================
Privileged/Confidential Information may be contained in this message. If
you are not the addressee indicated in this message (or responsible for
delivery of the message to such person), you may not copy or deliver this
message to anyone. In such case, you should destroy this message and kindly
notify the sender by reply email. Opinions, conclusions and other
information in this message that is not of an official nature shall be
deemed as neither given nor endorsed by SGX unless indicated by an
authorised representative independent of this message.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.