Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Treating numeric strings as strings

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Treating numeric strings as strings
#5350
Posted by: rfrost 2004-11-04 04:19:10
In our payroll system, eveyone has a seven-digit employee number with leading zeros being used to pad out the number. My employee number, for example, is 0014613. The leading zeros are necessary (payroll system is written in COBOL; employee number field is PIC X). Reading/writing the number from/to a text file preserves the leading zeros, but assigning that number to a variable results in the leading zeros being trucated. Is there a way to tell Reginald to preserve the leading zeros?
Message2. Re: Treating numeric strings as strings
#5356
Posted by: Jeff Glatt 2004-11-04 14:21:31
Not per se.

What you could do is, immediately after reading the number into some variable, append some letter to it (other than 'E') such as:
myvariable = myvariable || 'P'
Now MyVariable's value will be '0014613P' which REXX doesn't regard as a number, so no truncation of zeroes is performed. Of course, you can't then use it as a real number in REXX mathematical calculations.

And when you write it back out just clip off the last character:
myvariable = LEFT(myvariable, 7)

Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2024-2-21  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0