View previous topic :: View next topic
|
Author |
Message |
divakaran
New User
Joined: 19 May 2010 Posts: 3 Location: India, mumbai
|
|
|
|
Hi,
Anyone know how to eliminate low values or to identify low-values in a variable in REXX.
I am populating a field from a table the table is returning low values.I want to replace the low values by spaces or zeroes.
Thanks in advance. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
use index or pos to find the position of the first x'00' (I presume that that is what you mean by low values) and use that to provide overlay or substr with the information to put in a space. |
|
Back to top |
|
|
Stefan
Active User
Joined: 12 Jan 2006 Posts: 110 Location: Germany
|
|
|
|
The TRANSLATE function does what its name already implies.
Example:
Code: |
new_string = translate(string,'F0'x,'00'x) |
Copy the content of variable <string> to variable <new_string> and replace all low values (hex 00) by the character 0 (hex F0). |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
divakaran wrote: |
[...]
I am populating a field from a table the table is returning low values.I want to replace the low values by spaces or zeroes.
[...] |
If you're getting data from a table, why do you suddenly feel the need to change it?
Or, perhaps more likely, why don't you change your program to only access valid entries in the table? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
changing the data in your rexx is the ass backwards way to do it.
when you say table, is it a db2 table or an ispf table?
if db2, what is the datatype of the column?
if char, use the REPLACE function in your SQL.
if not char, what then?
if it is an ispf table, the place to change it is when the ispf table is created. |
|
Back to top |
|
|
|