Matt Hopkins wrote on May 21, 2007 10:41 AM
I am having a problem with a program that is using externally described 
varchar fields. It appears that the program is not recognizing that the 
fields are varchar, even though the program is compiled with 
CVTOPT(*VARCHAR).
The compile listing shows that it is a variable length character field 
(70 
is the max):
1035=O                       FTCCM3             562A CHAR       72  FTC 
COMMENT 3 
I don't have any experience with using VARCHAR fields in RPG, but it looks 
to me as though RPG is seeing FTCCM3 as a plain old character, not an RPG 
character with the 'varying' option.  Hence, when you assign a value, it 
just sticks that value in the first byte and clears the rest.
Matt Hopkins wrote on 21/05/2007 12:02:30:
The problem is that it _IS_ updating the index area when I do an EVAL 
FTCCM# = 'z'. It is putting the 'z' in the index area. The entire field 
is 
filled with blanks even the index area when the field is empty.
You could try defining a work field that respects the size prefix area, if 
the VARCHAR data type specifies the length of the content using a two-byte 
binary value in the same way as the 'varying character' type in RPG.
     D ftcComment3...
     D                               10A   varying
     D                                     based(pFTCComment)
     D pFTCComment...
     D                                 *   inz(%addr(FTCCM3))
I think that if you do this, you should be able to say ftcComment3 = 'z', 
and have everything work out fine.
Hope this helps,
Adam
Attention:
The information contained in this message and or attachments is 
intended only for the person or entity to which it is addressed and may contain 
confidential and/or privileged material. Any review, retransmission, 
dissemination or other use of, or taking of any action in reliance upon, this 
information by persons or entities other than the intended recipient is 
prohibited. If you received this message in error, please contact the sender 
and 
delete the material from any system and destroy any copies. Thank you for your 
time and consideration.
Attention: 
Le contenu de ce message et(ou) les fichiers ci-joints s?adressent 
exclusivement à la personne ou -entité à laquelle ils sont destinés. Ils 
peuvent 
contenir de l?information confidentielle, protégée et(ou) classifiée. Il est 
strictement interdit à toute personne ou entité autre que le(la) destinataire 
prévu(e) de ce message d?examiner, de réviser, de retransmettre ou de diffuser 
cette information, de prendre une quelconque action en fonction ou sur la base 
de celle-ci, ou d?en faire tout autre usage. Si vous avez reçu ce message par 
erreur, veuillez communiquer avec l?expéditeur(trice), supprimer ce message et 
les fichiers ci-inclus de tout système, et en détruire toutes copies, qu?elles 
soient électroniques ou imprimées. Nous vous remercions de votre entière 
collaboration. 
As an Amazon Associate we earn from qualifying purchases.