#### Right-Justifying a Left-Justified field in RPG IV

Hi!  I have two variables, WeightLeft and WeightRight, both alpha and 7
characters.
WeightLeft has the value of "12345  " (note: there are 2 spaces after the
5).  When I use "EVAL WeightRight = %TRIMR(WeightLeft)" in my program I was
expecting WeightRight to equal "  12345" (note: 2 spaces before the 1).

That didn't work.  WeightRight looked exactly like WeightLeft.  Trailing
blanks instead of leading blanks.  So, I tried just using a MOVE statement:
MOVE WeightLeft WeightRight.
Again, same results.

Can anyone tell me what I'm doing wrong?

Thanks,

Kevin

--
"Experience is a hard teacher because she gives the test first, the lesson
later."


 0
javarox (23)
8/27/2003 5:51:37 PM
comp.sys.ibm.as400.misc 9160 articles. 2 followers.

6 Replies
2042 Views

Similar Articles

[PageSpeed] 15
EVALR should work

HTH

Christian

"Kevin" <javarox@bellsouth.net> a �crit dans le message de news:
biir42$a1pkj$1@ID-182869.news.uni-berlin.de...
> Hi!  I have two variables, WeightLeft and WeightRight, both alpha and 7
> characters.
> WeightLeft has the value of "12345  " (note: there are 2 spaces after the
> 5).  When I use "EVAL WeightRight = %TRIMR(WeightLeft)" in my program I
was
> expecting WeightRight to equal "  12345" (note: 2 spaces before the 1).
>
> That didn't work.  WeightRight looked exactly like WeightLeft.  Trailing
> blanks instead of leading blanks.  So, I tried just using a MOVE
statement:
> MOVE WeightLeft WeightRight.
> Again, same results.
>
> Can anyone tell me what I'm doing wrong?
>
> Thanks,
>
> Kevin
>
> --
> "Experience is a hard teacher because she gives the test first, the lesson
> later."
>
>


 0
8/27/2003 6:05:45 PM
"Kevin" <javarox@bellsouth.net> a �crit dans le message de news: biir42$a1pkj$1@ID-182869.news.uni-berlin.de...
> Hi!  I have two variables, WeightLeft and WeightRight, both alpha and 7
> characters.
> WeightLeft has the value of "12345  " (note: there are 2 spaces after the
> 5).  When I use "EVAL WeightRight = %TRIMR(WeightLeft)" in my program I was
> expecting WeightRight to equal "  12345" (note: 2 spaces before the 1).
>
> That didn't work.  WeightRight looked exactly like WeightLeft.  Trailing
> blanks instead of leading blanks.  So, I tried just using a MOVE statement:
> MOVE WeightLeft WeightRight.
> Again, same results.
>
> Can anyone tell me what I'm doing wrong?
>
> Thanks,
>
> Kevin
>
> --
> "Experience is a hard teacher because she gives the test first, the lesson
> later."
>
Kevin,
You'll get exactly the same results with MOVE or EVAL or MOVEL op-code because both variables are 7 char.
If WeightLeft was 5 char you'd get the right result.
To get what you expect you should use a %SUBST BIF or SUBST op-code instead:
EVAL WeightRight = %SUBST(WeightLeft:1:5)
hth
Mercury


 0
8/27/2003 6:06:23 PM
Mercury,

Thanks for your help!  I do have a question,though.  The field, WeighLeft,
could have a value anywhere from '1      ' (Note: 6 spaces follow the 1) to
'9999999' , so I won't know if the value is a specific length or not.  Any
idea on how to get around this?  Basically, I'm trying to get the alpha
field right justified so I can convert it into a numeric field in another
program (I'm using Synon 2E and the command I'd use to convert the alpha to
numeric is a function called *CVTVAR.  This command will convert the alpha
to numeric, but if the alpha looks like '1     ' then my numeric result will
look like '100000', so I need the value right-justified before I convert
it).

I'm a Synon programmer and I haven't had a lot of experience with RPG IV so
forgive me if I'm missing a glaringly obvious answer to this conundrum. ;-)

Thanks, again!

Kevin

--
"Experience is a hard teacher because she gives the test first, the lesson
later."
"Mercury" <nospam.carpediemps@hotmail.com> wrote in message
news:biirv1$ks9$1@news-reader5.wanadoo.fr...
>
> "Kevin" <javarox@bellsouth.net> a �crit dans le message de news:
biir42$a1pkj$1@ID-182869.news.uni-berlin.de...
> > Hi!  I have two variables, WeightLeft and WeightRight, both alpha and 7
> > characters.
> > WeightLeft has the value of "12345  " (note: there are 2 spaces after
the
> > 5).  When I use "EVAL WeightRight = %TRIMR(WeightLeft)" in my program I
was
> > expecting WeightRight to equal "  12345" (note: 2 spaces before the 1).
> >
> > That didn't work.  WeightRight looked exactly like WeightLeft.  Trailing
> > blanks instead of leading blanks.  So, I tried just using a MOVE
statement:
> > MOVE WeightLeft WeightRight.
> > Again, same results.
> >
> > Can anyone tell me what I'm doing wrong?
> >
> > Thanks,
> >
> > Kevin
> >
> > --
> > "Experience is a hard teacher because she gives the test first, the
lesson
> > later."
> >
> Kevin,
> You'll get exactly the same results with MOVE or EVAL or MOVEL op-code
because both variables are 7 char.
> If WeightLeft was 5 char you'd get the right result.
> To get what you expect you should use a %SUBST BIF or SUBST op-code
> EVAL WeightRight = %SUBST(WeightLeft:1:5)
> hth
> Mercury
>
>
>


 0
javarox (23)
8/27/2003 7:16:23 PM
Christian,

Thanks!

Kevin

--
"Experience is a hard teacher because she gives the test first, the lesson
later."
"Christian Gstalder" <cgstalde.nospammm@chpg.mc> wrote in message
news:biirun$9j4g4$1@ID-56826.news.uni-berlin.de...
> EVALR should work
>
> HTH
>
> Christian
>
> "Kevin" <javarox@bellsouth.net> a �crit dans le message de news:
> biir42$a1pkj$1@ID-182869.news.uni-berlin.de...
> > Hi!  I have two variables, WeightLeft and WeightRight, both alpha and 7
> > characters.
> > WeightLeft has the value of "12345  " (note: there are 2 spaces after
the
> > 5).  When I use "EVAL WeightRight = %TRIMR(WeightLeft)" in my program I
> was
> > expecting WeightRight to equal "  12345" (note: 2 spaces before the 1).
> >
> > That didn't work.  WeightRight looked exactly like WeightLeft.  Trailing
> > blanks instead of leading blanks.  So, I tried just using a MOVE
> statement:
> > MOVE WeightLeft WeightRight.
> > Again, same results.
> >
> > Can anyone tell me what I'm doing wrong?
> >
> > Thanks,
> >
> > Kevin
> >
> > --
> > "Experience is a hard teacher because she gives the test first, the
lesson
> > later."
> >
> >
>


 0
javarox (23)
8/27/2003 7:16:52 PM
Christian,

The EVALR did exactly what I needed!  Thank you so much!

Kevin

--
"Experience is a hard teacher because she gives the test first, the lesson
later."
"Christian Gstalder" <cgstalde.nospammm@chpg.mc> wrote in message
news:biirun$9j4g4$1@ID-56826.news.uni-berlin.de...
> EVALR should work
>
> HTH
>
> Christian
>
> "Kevin" <javarox@bellsouth.net> a �crit dans le message de news:
> biir42$a1pkj$1@ID-182869.news.uni-berlin.de...
> > Hi!  I have two variables, WeightLeft and WeightRight, both alpha and 7
> > characters.
> > WeightLeft has the value of "12345  " (note: there are 2 spaces after
the
> > 5).  When I use "EVAL WeightRight = %TRIMR(WeightLeft)" in my program I
> was
> > expecting WeightRight to equal "  12345" (note: 2 spaces before the 1).
> >
> > That didn't work.  WeightRight looked exactly like WeightLeft.  Trailing
> > blanks instead of leading blanks.  So, I tried just using a MOVE
> statement:
> > MOVE WeightLeft WeightRight.
> > Again, same results.
> >
> > Can anyone tell me what I'm doing wrong?
> >
> > Thanks,
> >
> > Kevin
> >
> > --
> > "Experience is a hard teacher because she gives the test first, the
lesson
> > later."
> >
> >
>


 0
javarox (23)
8/27/2003 7:23:18 PM
"Ken" <ng3122@ke9nr.#nospam#.net> a �crit dans le message de news: 002rkvcgphbre40tr19vkm3aqunj7a4f9c@4ax.com...
[snip]
> Don't worry about what Mercury wrote.  His solution doesn't work.  It
> gives the same result as your original code if there are five or less
> characters, and drops characters if there are more than five.

True, it doesn't work, I made a mistake, sorry.
(I didn't know the EVALR op-code)
Mercury


 0
8/28/2003 7:46:34 AM
Similar artilces about - Right-Justifying a Left-Justified field in RPG IV:

How do I set vector fields using user-input?
Hi guys, I'm new to scheme programming and encountered problems assigning user- input values to vectors. My program flow is as follows: 1. Prompt user to specify how many fields in a vector eg: if user key 3, the vector shall have 3 fields. 2. Prompt user to input values into the 3 fields I tried using : (vector-set! 4AUVector 0 '(read)) 4AUVector is my vector name, 0 is the 1st field, and (read) is the user-input, but I got.. vector-set!: expects type <mutable vector> as 1st argument, given: #(0 ,1 ,2); other arguments were: 0 (read) I believe my syntax is wrong, but I jus...

Display name of field if field is empty
Is there a way to display the name of the field if the field is empty? If there was any way to have it display as it does in layout mode, that would be perfect. Any suggestions appreciated. You can only do this with a work around. For MyField in MyTable Create a textobject with the required text Set textcolor to whatever color you want Set the background color to the color that lays behind (or leave it transparent) Create a conditional format for the object. Formula is not IsEmpty ( MyTable::MyField ) Set the conditional text color to the backgroundcolor Make the background of Myfield ...

What if he's right?
I hope you find the time to read this with an open mind. It's interesting. Please read it with the open mind rather than immediately breaking it down into left or right, but rather look at it from the neutral viewpoint of right or wrong. It's like the line below says, "what if he is right?" Take the three minutes to read this. Maybe he is wrong, but what if he’’s right? David Kaiser is a respected historian whose published works have covered a broad range of topics, from European Warfare to American League Baseball. Born in 1947, the son of a diplomat, ...

VisualAge for RPG with V4R5
Hi, I am working on a V4R5 system, where we currently have VisualAge for C++ running. (NB: According to our C++ developer, the IBM V'age software is a "heap of sh*te" and about 10 to 15 years behind the Microsoft equivalent). We are sticking to V4R5 on this box for release compatibility reasons. Question 1: Would VisualAge for RPG also run on this box as is? Or is there any additional AS/400 software that needs to be installed? ... if so what? Currently we have: 5769CX5 V'age for C++ - Host component 5769CX5 V'age for C++ - Windows client 5769PW1 ...

US-TX-Odessa: FIELD SUPPORT, Windows 2000/XP, Norton Ghost; 2-3 M (45352014404)
US-TX-Odessa: FIELD SUPPORT, Windows 2000/XP, Norton Ghost; 2-3 M (45352014404) =============================================================================== Position: FIELD SUPPORT Reference: ZYD00043 Location: Odessa TX Duration: 2-3M Skills: Detail-oriented - will follow a written procedure at all times. Windows 2000 or Windows XP migration experience. Windows XP desktop support experience. Ability to troubleshoot hardware and network issues. Experience with Norton Ghost and Ghost Exp...

How To: (Objectstudio) Get left and top of an item on a form
Yes it seems like a simpel question but read on.... I have an Objectstudio application and I need to read the left and top off the items on a form. .... still simpel I know, keep reading... I need those values so I can make the same form representation in another programming language, lets say Delphi 2005. Now the problem is this: The values I get for top and left are way to big therefore I cannot use them without doing some conversion first to their real left and top (or x and y). So the real question is how to do this in Objectstudio before I send them to the other (Delphi)...

Re: Macro to create multiple dates from numeric fields in one dat a set #2
Thanks Dennis, Harry and Toby--this worked perfectly. Part of my problem is that I work at a small company and actually spend most of my time doing other things. And when I do have time to work on my rusty SAS skills, and try to learn from code that my predecessors wrote...well, I'm trying to be diplomatic in case any of them subscribe to this list. But our existing code does things like, in a dataset with 60 variables that needs 3 variables dropped, rather than DROPing the 3 variables, the code KEEPs the other 57. Not the best of templates...I wish I'd found this listserv 6 months...

Two way ANOVA
Hi Friends, Warm Greetings to all! Today morning I met my Life Science friend as she required some statistical analysis through SPSS. Her Professor mentioned two way ANOVA for that data. I am also not aware of this technique and I am reading some contents from Google Search. Can any one please help me on understating the below two points and right statistical tools to get the results. Also I have listed some sample records from data set. 1)The activity of Acid Phosphatase in Seminal Plasma between these patient groups. - Analysis to be made 2)The activity of Acid Phosphatase ...

Over Flander's field released
OFF is a free add-on for CFS3 you can get it here http://forums.netwings.org/forums/showthread.php?t=3029 "Mitch_A" <naman@nospam.pacbell.net> wrote in message news:_TOpf.37008\$q%.20985@newssvr12.news.prodigy.com... > OFF is a free add-on for CFS3 you can get it here > http://forums.netwings.org/forums/showthread.php?t=3029 > > > Excellent! Time to reinstall CFS3 I hope youre not in a hurry to get it ;) He needs some mirrors pronto! At 12k/s with constant disco's it may be next week before I can try it out ;) Mitch &qu...

[News] Human Rights Monitored with Free Software in the Philippines
Filipinos offer open source human rights monitoring software ,----[ Quote ] | Filipino members of an organization of computer professionals have launched | open source-based software designed for human rights organizations. | | [...] | | CPU has been an advocate of Free and Open Source Software (FOSS) in the | country. | | "These CPU projects prove that FOSS is a viable replacement even for very | specific tools of non-governmental organizations," Bahague said. "The toolkit | is also our small tribute to many human rights violation victims of the | current regime as ...

find text question
I'm having a very bizarre problem. I open up my table in datasheet view, and I click on edit, find. In the Find and Replace dialog box, I enter an address (123 main for example). If I set the Look In parameter to a specific field (Mailing Address), my record is found. If I go back up to the top of the table, and set the Look In parameter to my table name to search all of the fields in the table so that I can also search the Street Address, no record is found. I have Match set to any part of field, Search is set to All, and and Match Case is unchecked. I'm sure I'm missing some...

One field maintaining (boolean) state of multiple items
I have a friend who posed a question to me about how to maintain the state of a few boolean values (radio buttons to be specific) in one (integer) database column. It really is more of a curious question than anything else, as he could simply add more columns to the table to avoid even thinking about it, but for the sake of fun he didn't. So, let's say you have three boolean values that you need to store in one field, and you must be able to determine what the state is (true/false) of any of the 3 values at any time. How would you do this? My immediate thought went to bit shifting ...

Human Rights and Justice in Islam
Human Rights and Justice in Islam Description: A glimpse at the foundations of human rights laid by Islam. By islam-guide.com Islam provides many human rights for the individual. The following are som= e of these human rights that Islam protects. The life and property of all citizens in an Islamic state are considered sa= cred, whether a person is Muslim or not. Islam also protects honor. So, i= n Islam, insulting others or making fun of them is not allowed. The Prophe= t Muhammad, may the mercy and blessings of God be upon him, said: "Truly yo= ur blood, your propert...

Right settings for a good soundcard
Because of my mistake while making settings for a new videocard, my Bios settings went back to factory defaults and now my Aureal Vortex2 PCI soundcard won't work anymore. My MB is Asus P3C2000 (i820). I have disabled Onboard AC97 Modem Controller, Onboard Game Port, Onboard MIDI I/O in Bios, do I have to disable Onboard AC97 Audio Controller too? There is no "Onboard Audio Legacy" in the Bios to disable. Also I have read that jumper 5 has to be moved to test mode but my MB is "jumper free". I have read that Soundblaster emulation has to be disabled in the Devic...

Is this right?
I have heard some thing from my lecture that I disagree. and I would like to hear if I am wrong. "A variable is an object" "C hasn't changed in the past 30 years" "C is an extended assembly language" "Procedure generate unreadable code" I know that C may be considered low level, but I am not sure about extended assembly language. I don't even consider HLA an extended assembly language. But I may be wrong please give your opinion Thanks Profetas "Profetas" <xuxu_18@yahoo.com> wrote in message news:e3a3c840b05a99a337313fc11601...

spacing after \right) and before \left)
I have set up a macro for parentheses: \newcommand{\of}[1]{\left( #1 \right)} which works wonderfully within math equations, but I have noticed that if I use a comma (or period, etc.) after it I get a little extra horz. space after the \right) vs. just using ")" directly even when both produce the same size symbol ")". Why is this and is there a way to get rid of this extra space? Thanks, ds Dave94705 <david.jobman.schwartz@gmail.com> writes: > I have set up a macro for parentheses: > > \newcommand{\of}[1]{\left( #1 \right)} > > whi...

[News] Free Software's Impact on Society, Human Rights
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Free Software Essay ,----[ Quote ] | Imagine a world in which computer software was free. Now, imagine a world | where software can be modified in whatever way the user desires. This is the | world of free software. Free software has been touted as an evil entity by | large companies, such as Microsoft, but these companies often use lies and | miscommunication to make free software seem like it is an evil entity trying | to steal form people that work hard and get paid to make software. Free | software was designed to give people freedom in...

Hi: I'm a Teradata newbie, struggling to force Teradata to display a calculated field with a desired precision. It's simpliest to use a hard-coded calc for illustration purposes: select 2/3 from blah sample 1; results in 0 select 2/3.0000 from blah sample 1; results in 0.6667 In the real world, I'm not dividing two literals, but rather two integer fields. I want my answer in float format, but the only way I can attain this is by: select fld1 / fld2 * 1.000000 from blah sample 1; I've tried a couple things, neither of which work: select cast((f...

FAQ Topic
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? ----------------------------------------------------------------------- The nonstandard  contextmenu  event is not widely supported. Browsers that do support it may configured to prevent scripts from accessing that event. Example: <body oncontextmenu="return false"> Disables the context menu where supported. Note that this will not prevent users from viewing your source code or copying images. To discourage copying, provide a copyright...

G-Linux, right from the ghetto
I�m going to install linux on my iBook G3 (233), but I want to go little off the beaten path. I�m going to install a basic package with the Kernal, Winx, and all the other bare essentials. But us Ppc guys are a little in the dark about these things. There is nothing published for us So here are my key questions 1) What booting mechinsm should I use, I heard Grub is now the best, but not sure if it is going to work for me. 2) has anyone used an iBook video card with linux, is there a driver or configuation that I should know about 3) Do the airports really not work with linux?? The...

Right Tool for the Right Job
I use a Macbook 15." Why? Because it works. I had a Windows failure when I was traveling and I made the switch. At home I have a Vista Ultimate 64 machine, that I use for video editing. It is a Core 2 Duo with 4GB of RAM, two Seagate 320GB SATA drives configured in a RAID 1 (mirrored) volume. However I got that copy of Vista U. for free - thank you MS Action Pack! I also used to use FreeBSD and Ubuntu - until a drive failed. I never restored the system. I used the Linux machine all thought my masters degree - thanks to OpenOffice. I never had a compatibility problem when I ...

Re: Make a PHP coding ERROR in Wordpress in the right file and your entire Blog could conceivably disappear in a Flash
On 7/30/14, 1:55 PM, in article 7785bd1a-69ba-4b0d-9ad6-5e82badd5db9@googlegroups.com, "tmelmosfire@gmail.com" <tmelmosfire@gmail.com> wrote: > On Wednesday, July 30, 2014 8:49:58 PM UTC, Steve Carroll wrote: >> On Wednesday, July 30, 2014 2:45:26 PM UTC-6, tmelm...@gmail.com wrote: >> >> >> >>>> Wow! Another GREAT ARGUMENT, 'John'! Way to back your "points"! >> >>> >> >>> Do you think your claims are better supported? >> >> >> >> Of course, ...

Controlling user rights in IIS 4
Does anyone know if it is possible to prevent users from printing from an intranet site? We have created an internal site using IIS 4 so our employees can access documents through IE, but we do not want them to print the documents (kind of defeats the purpose). Any input would be appreciated. Thanks, Andy ...

right justify image?
I'm new obviously to html and I'm looking for a way put an image on the right side of the page opposite text on the left. How does one do this? I've heard of text wrapping of an image but not sure if this is what I really want, and further don't know how to do that either. Appreciate any info. JG wrote: > I'm new obviously to html and I'm looking for a way > put an image on the right side of the page opposite > text on the left. How does one do this? I've heard > of text wrapping of an image but not sure if this is > what I really wa...

Duplicate numbers in "Autonumber" field -- help!
To comp.databases.ms-access -- I just discovered, to my more than mild dismay, that some tables in my Microsoft Access 2003 database have duplicate numbers in the "AutoNumber" field. (Field Size is set to "Long Integer", and New Values is set to "Increment".) I know that an old version of the Jet database engine can cause this problem, but my version of msjet40.dll is 4.0.8618.0, which is supposedly bug-free in this respect. I am using Windows XP, SP2. (I started developing this database in 2006, and might possibly have used an earlier version of Windows XP,...