Cl does not create storage in this case. The command parser has to do that....
The command parser makes default assumptions about ho much storage to
allocate, by looking at the TRIMMED length of your parm data. If it appears
that all your TRIMMED data will fit into the default character field size (32
bytes?) then the default size is used.
One easy workaround that works from the command line is to type in your
complete parm value (type in all the blanks), then add one more non-blank
character on the end. The command parser see that your second parm has a
trimmed length of 51 bytes (50 bytes of real data + one byte character) and
will allocate and pass 51 bytes. Your program only uses the first fifty bytes
of real data, and never sees the bogus byte....
Eric
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[
mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of AGlauser@xxxxxxxxxxxx
Sent: Monday, June 11, 2007 10:34 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Problems with parameter passing
Glen Gundermann wrote on 11/06/2007 11:21:21:
Here is a prototype I've done:
D CAFWTBLEML pr
D TrRptId 10a const
D TrRptDes 50a const
D TrDlyMth 1a const
D TrFile 1000a const
If I call this from the command line using:
===> call cafwtbleml parm('A' 'B' 'C' '/home/subdirectory/long file
name
goes here.csv')
I get some funny results for 2 of the parameters:
That's to be expected ... CL has to create storage for your literals, and
has to guess about how much space to allocate. The short story is that
you should create a *CMD object to call this if you need to call it from
the command line. For the long story, check out:
http://faq.midrange.com/data/cache/70.html
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.