Guidance Forums / Reginald Rexx / Treating numeric strings as strings

Search 搜索
Home Home

Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Treating numeric strings as strings
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
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. Hits:0