f

#### 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 9219 articles. 3 followers.

6 Replies
3390 Views

Similar Articles

[PageSpeed] 1

```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
instead:
> EVAL WeightRight = %SUBST(WeightLeft:1:5)
> hth
> Mercury
>
>
>

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

EVALR!  Wow, I never knew about this one.  I'll give it a try!

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
 Reply:

Similar Artilces:

Writing something left-justified and something right-justified
I'm using the article documentclass and the \usepackage{fullpage}, and all I want is to have one phrase left-justified and one phrase right- justified, both on the same line. How do I do that? If you need clarification please let me know. Paul Chen wrote: > I'm using the article documentclass and the \usepackage{fullpage}, and > all I want is to have one phrase left-justified and one phrase right- > justified, both on the same line. How do I do that? If you need > clarification please let me know. How about \hfill between them? \mbox{left phrase} \hfill \mbox{right phras...

Using "Justify" in ODS RTF Output (rather than left/right/center justify)
I was posed the question off list about how to write data to an ODS RTF destination "justified". Justify is the option you get in word that spreads text across the full width of a line and proportionally spaces it out, as oppoed to left/right and center justify. There doesn't seem to be an ODS style attribute for it, at least not documented in V8.2. But you can do it quite easily by embedding a raw RTF code (\qj) as follows (I've done all of the justification codes for comparison). One question arises .. what would you use the "distribution" justification for? dat...

Re: Using "Justify" in ODS RTF Output (rather than left/right/center justify)
******************************************************************************************************************************************************* This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. ******************************************************************************************************************************************************* From trying this out, Distributed appears to be like Justified but rather than just spacing out words to get neat margins, it spaces out characters. Can't im...

list struct fields with field names left-justified
When I use the "get" method from the COM object for an Excel application, the returned structure reflects all the properties of that object. It can be a length listd. I do that for many of the COM objects under the Excel object model to determine what I have access to, and where they go in the object model. It would be much easier to peruse the list if the text information in the field name & value columns were left justified. Like they are in cell array of strings. Is there a way to get that kind of output (without much coding)? That is, without the huge amount of...

Re: PL/I can left justify output (was: PL/I cant left justify output)
From: "David Frank" <dave_frank@hotmail.com>, RoadRunner - Central Florida Date: Fri, 14 Nov 2003 12:25:52 GMT > "Andreas Davour" <ante@update.uu.se> wrote in message > news:cs9ekwb9ook.fsf@tempo.update.uu.se... >> I have a vague recollection about someone posting about how to do a >> WRITE and then backtrack and overwite it, using some sort of >> non-advancing FORMAT. I've been looking in my books for it, and >> Google >> didn't help. >> >> What I'm trying to accomplish is something like: >> LOA...

Re: PL/I can left justify output (was: PL/I cant left justify output) #2
"David Frank" <dave_frank@hotmail.com> writes: > > "R. Vowels" <r|obin_v@bigpond.mapson.com> wrote in message > news:iLgtb.11358\$aT.511@news-server.bigpond.net.au... > > From: "David Frank" <dave_frank@hotmail.com>, RoadRunner - Central > Florida > > Date: Fri, 14 Nov 2003 12:25:52 GMT > > > > > > > write (*,'(a,i0,2a)',advance='no') 'LOADING: ',number,'%',char(13) > > > outputs the number left justified using ONLY columns needed to > > > write the num...

Left justified or center justified under XSL:FO
Hello, I was wondering whether it was possible to have left justified or center justified text under XSL:FO. From what I can see, it looks like text-align can take on the values of "left, center, right, justified". In such a context, how would it be possible to make text left justified. would we have to nest 2 blocks, one center aligned and one justified aligned? It seems to me like the last setting would override the previous one. Any help will be greatly appreciated Regards Jean-Francois Michaud ...

Right Justify Alphanumeric Field
This is another candidate for the FAQ. ----- 1 input-field pic x(50). 1 output-field pic x(50) justified right. 1 p binary pic 9(4). ... move function length (input-field) to p perform varying p from p by -1 until p < 2 or input-field (p:1) not = space continue end-perform move input-field (1:p) to output-field ----- Tested using Micro Focus COBOL 3.2.24 with ANS85 flagging. On Fri, 17 Mar 2006 22:06:04 -0500, "Rick Smith" <ricksmith@mfi.net> wrote: >T...

padding left-justified string fields
I've written a perl program to manipulate data formats so that I can import data from an estimating software program to an accounting program. Works just fine, with the following caveat: The record identifier field is numeric in the estimating program but it can be (and is interpreted as) a string in the accounting software. Hence, when I bring up project data in the accounting software, my items look like so: 10 100 110 .... 190 20 210 220 These fields MUST be left-justified for importation into the account s/w, so I am using "@<<<<<<" in my format block. ...

How to capture left-justified values in numeric fields in a file
I am going to read a file into SAS and will test if a value in a numeric variable is right justified on the file. Let us say the starting position for the field in the file is 10 and the last position is 20. The length of the value may vary, but it is less than 11. The variable is allowed to be empty. In that case, both position 10 and 20 will be blank. I am going to capture (in a data set) those records where the value is left justified. But how? I figure that a safe way would be to take for granted that in those cases the position # 10 will not be blank, but the position # 20 will be blank...

Re: How to capture left-justified values in numeric fields in a
Lots of ways to do that... data test; input @1 left \$1. @1 num BEST11.; if not missing(left) then output; datalines; 1.2348 1.1234 2.2346 1.324 -1234.235 -12.32 ; run; is one example. -Joe On Wed, May 20, 2009 at 2:57 PM, Anaconda <rune@fastlane.no> wrote: > I am going to read a file into SAS and will test if a value in a > numeric variable is right justified on the file. Let us say the > starting position for the field in the file is 10 and the last > position is 20. The length of the value may vary, but it is less than > 11. The variable is allowed to be empt...

Pegasus Mail: left and right justified text reversed
I was looking for a new MIME capable client and tried Pegasus Mail (free client). Everything I tried seems to work except all mails are right justified. The errors that wine (cvs from today) shows are these: fixme:font:GetCharacterPlacementW flags 0x00000012 ignored fixme:font:GetCharacterPlacementW classes not implemented Are they related to the justification problem? If not, is there any registry flag that reverses the justification so that left justified gives right justified text and vice versa? Bernhard Bernhard Mogens Ege wrote: > I was looking for a new MIME capab...

Re: Using "Justify" in ODS RTF Output (rather thanleft/right/center justify)
"Nigel Pain" <Nigel.Pain@SCOTLAND.GSI.GOV.UK> wrote: >From trying this out, Distributed appears to be like Justified but >rather than just spacing out words to get neat margins, it spaces out >characters. Can't imagine how you'd use it but who knows what strange >things people might want?! Incidentally, there doesn't seem to be any >way of getting Word 2002 to do this even though it recognises it when >reading the RTF file. "Distributed" is what professional typesetters usually do - there are additional tiny spaces between letters inst...

Justify "right to left" access report textbox
I have a field that is a memo and I have a report displaying the text in that memo. What I need to know is how to "justify" the text right to left. The reason is in arabic and persian language we write right to left. What I want: |-------------| |-------------| | ----| Hi, mehdi "mehdi" wrote... >I have a field that is a memo and I have a report > displaying the text in that memo. What I need to know is > how to "justify" the text right to left. > > > The reason is in arabic and persian language we write right to left. > &...

How can I write right-justified into a 12 chars width field?
Lets say I have a String var which can contain values of different lengths e.g. "aaa" or "bb bb bb". I want to print them out with System.out.println right-justified with a field width of 12 chars. If necessary this field should be left padded with blanks. For the samples above the output should be e.g.: " aaa" and " bb bb bb" How can I implement this right-justified, blank padded, fixed-width filed output in Java? Cat On Apr 29, 2:23=A0pm, grem...@theme.co.uk (Catherina Svensson) wrote: > Lets say I have a String var which can conta...

1 left justified string, 1 centered 1 right justificed on the same line?
I want to (on one line) show something like the following ------------------------------------------------------- left centered right ------------------------------------------------------- If I use <hr> to draw the lines, then there is too much space between the line and the text If I use a table, then how do I get the right-justified string to be at the right margin of the page and the centered string to be in the center? Also, how do I remove the vertical bars in the table? Thanks. Austin Powers wrote...

Re: It's possible to justify the title as Left /Center/Right comb ined using ODS/RTF?
> From: Zibao Zhang [mailto:zibaozhang@HOTMAIL.COM] > The idea came from the MS word fuction. But i don't know it > is possible in SAS using ODS/RTF? > > This is what i thought(of course this doesn't work): > > TITLE j=l "Left Part title" j=c "Center Part title" j =r > "Right Part title"; > > And the result hope to be like; > > Left Part title > Center Part title > Right Part title > > Any suggestion or reference? This round flat thing with a hold in the middle aka: "wheel" has been invented...

what does SHIFT-left-or-right of up-down-left-right do?
Well, I know about shift up-and-down: shift-right ("red" or whatever) up and down on choose-box, HIST, things like that, take the cursor all the way to the beginning or the end. shift-left ("white") on up and down scroll the screen-full up or down (the FIRST such click *stupidly* goes to the final CURRENTLY-ON-SCREEN choice or whatever (meaning TWO double-button-pushes to scroll-down that FIRST time.) What are some of the OTHER possibilities, ie with the left and right arrows? Oh, apparantely undocumented, I've found (via mistaken key-pushes) that RIGHT-arrow will do a SWAP (on stack), and that an UP-arrow gets you into HIST (that HIST is *one nice feature*!) Other tricks with those arrows? Thanks! David David Combs wrote: > Well, I know about shift up-and-down: > > shift-right ("red" or whatever) up and down on > choose-box, HIST, things like that, take the > cursor all the way to the beginning or the end. > > shift-left ("white") on up and down scroll the > screen-full up or down (the FIRST such click > *stupidly* goes to the final CURRENTLY-ON-SCREEN > choice or whatever (meaning TWO double-button-pushes > to scroll-down that FIRST time.) > > > What are some of the OTHER possibilities, ie with the > left and right arrows? > > > Oh, apparantely undocumented,...

Fully justified/center justified output
Hi, how do I go about fully justifying/center justifying output text in ruby? I'm guessing I have to use sprintf but I can't seem to get it working properly, not sure of the correct "%" characters (don't know the proper name for them). Thanks, Ben > Hi, how do I go about fully justifying/center justifying output text in ruby? > > I'm guessing I have to use sprintf but I can't seem to get it working > properly, not sure of the correct "%" characters (don't know the proper name > for them). http://corelib.rubyonrails.org/classe...

does PHP read left to right or right to left?
I've two functions. currentHeadline looks in \$_GET for a variable called 'image' and prints what it finds. showThumbnail takes an image for a parameter and resizes it before sending it to the screen. But when I do this: <?php showThumbnail(currentImage(), 20, 20); ?> showThumbnail is telling me that it is not being given a file name, and currentImage is printing the file name to the screen. How is that possible? What is the right way to do this? lawrence k wrote: > I've two functions. currentHeadline looks in \$_GET for a variable > called 'image' and pr...

right justify text
How can I right justify the text I print with /temp 12 string def /Times-Italic findfont 14 scalefont setfont 100 100 moveto 314 10 temp cvrs show 100 120 moveto 1 10 temp cvrs show i.e. I want it to be printed with the right margin at (100,100)? i.e. the result should look like 1 314 Gunnar G wrote: > How can I right justify the text I print with > > /temp 12 string def > /Times-Italic findfont > 14 scalefont setfont > > 100 100 moveto > 314 10 temp cvrs show > 100 120 moveto > 1 10 temp cvrs show > > i.e. I want it to be printed with the ri...

equation with a right justified *
i want to produce the following d(x_0, x) - d(x, n) > 1 * this way i can refer to my equation as (*) is this possible in latex? basically i wanted this : \[ d(x_0, x) - d(x, n) > 1 \] but with a * on the right side (obviously no hspace as who knows what paper i could be using ) i dont know how to do this, please help thanks rookandpawn wrote: > i want to produce the following > > d(x_0, x) - d(x, n) > > 1 * > > > this way i can refer to my equation as (*)...

How to right justify a column
Hello group, I am feeling pretty good about this program. I am just learning and am trying to get the basics down. I would like to ask if someone could tell me how to right justify the BALANCE column in my program's output. =============== Here is my code: =============== #include <stdio.h> int main (void) { int i; int accountNumber[10]; char lastName[10][30]; float accountBalance[10]; printf("Enter account number, last name, and balance.\n"); printf("Enter -999 to end input.\n"); for (i = 0; i < 10; i++) { printf(&...

How do I right justify with fprintf?
I need to print several lines of data that are right justified using fprintf. Is this possible? If I use the commands: >>a=[1,12,123]; >> fprintf('%d\n',a) I get: 1 12 123 but I need: 1 12 123 Thanks Hi, a=[1,12,123]; fprintf('%3d\n',a) J�r�me Thanks, that is just what I needed Mike J�r�me wrote: > > > Hi, > > a=[1,12,123]; > fprintf('%3d\n',a) > > J�r�me In article <ef2371b.-1@webx.raydaftYaTP>, "Mike Tonks" <tonksmr@lanl.gov> wrote: > I need to print several lines of data that are right justi...

Web resources about - Right-Justifying a Left-Justified field in RPG IV - comp.sys.ibm.as400.misc

Resources last updated: 3/3/2016 7:24:48 PM