Nesting Functions

Watt, Peter pwatt@dairyworld.com
Thu, 17 Jun 1999 14:08:21 -0700


I've encountered this before. The right justification takes place on the
size of the string variable, not the resulting string variable.  The size of
"Y" in the equation of rj(Y) is 10.  The size of "ASCII(X)"  in rj(ascii(X)
is 5.  The result is then PLACED into the reporting variable (Z1,Z2). 

Add this twist:
DEFINE Z3  CHAR*5 = RJ(Y)

The result is "    1".

Hmmmmm......

	-----Original Message-----
	From:	Terry Pickering [SMTP:pickering@myself.com]
	Sent:	Thursday, June 17, 1999 1:51 PM
	To:	powerh-l@lists.swau.edu
	Subject:	Nesting Functions

	Consider the following code (I hope it aligns correctly in your
email reader): 

	DEFINE X INT*8 = 12345 
	DEFINE Y CHAR*10 = ASCII(X) 

	DEFINE Z1 CHAR*10 = RJ(Y) 
	DEFINE Z2 CHAR*10 = RJ(ASCII(X)) 

	REPORT X Y Z1 Z2 


	It produces the following results: 

	      X      Y           Z1          Z2 

	      12345  12345            12345  12345 

	My basic question is why doesn't the results of Z2 the same as Z1?
What I want is a right justified character field containing a number (no
leading zeroes - that's cheating). I also want to do it without doing a two
step define, but instead with functions in one step. I don't see anything in
the manual that says you can't combine these two functions together, but it
sure doesn't appear to let you do it. 



	What I'm trying to do is display in a QUICK INFO statement, a
numeric field with two implied decimal places, something like this: 

	INFO = "Amount:" + ASCII(X)[1:8] + "." + ASCII(X)[9:2]  

	INFO statement would then display: 
	Amount:     123.45 


	I can get it to work if I do it this way: 

	INFO = "Amount:" + ASCII(X,10)[1:8] + "." + ASCII(X,10)[9:2]  

	But then the INFO statement displays: 
	Amount:00000123.45 


	Any suggetions???????? 


	Terry Pickering                         CompuGroup, Inc. 
	pickering@myself.com <mailto:pickering@myself.com>
Portland, Oregon USA 
	www.teleport.com/~compugrp <http://www.teleport.com/~compugrp>
Cessna 172 & Lancair ES = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = Subscribe: "subscribe powerh-l" in message body to
majordomo@lists.swau.edu <mailto:majordomo@lists.swau.edu>  Unsubscribe:
"unsubscribe powerh-l" in message to majordomo@lists.swau.edu
<mailto:majordomo@lists.swau.edu>  powerh-l@lists.swau.edu
<mailto:powerh-l@lists.swau.edu>  is gatewayed one-way to
bit.listserv.powerh-l This list is closed, thus to post to the list, you
must be a subscriber.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.