I obviously have too much time on my hands.
I actually found an even older manual from April 1975, that is
apparently a scanned version of the manual SC21-7504-5 IBM System/3 RPG
II Reference Manual at
https://ia801900.us.archive.org/3/items/bitsavers_ibmsystem3IIRefManApr75_36202767/SC21-7504-5_System3_RPGII_RefMan_Apr75.pdf
On page 264 (PDF page 275) it says "Note: There are two exceptions to
the rule that the number of replaceable characters in the edit word must
be equal to the length of the field to be edited. The exceptions are:
1. An extra space must be left in the edit word for the floating dollar
sign. This ensures a print position for the dollar sign if the output
field is full.
2. An extra space can be left in the edit word if the first character in
the edit word is a zero. In this case, the field to be edited will not
be zero suppressed, but all other specified editing will be performed."
And here we are, on the IBM i, 45 years later, and it still applies.
For the archives,
I remember this from way back in RPG II days. The earliest manual I've
been able to find from IBM is SC09-1818-00 System/36-Compatible RPG II
User ’s Guide and Reference from June 1994. The relevant part is on
page 450 (PDF page 480):
"The Delta position is defined as the position in the edit word that is
to contain the first, or leftmost, character of the data field"
"The First Zero (0)
When to the right of the Delta position (see example 2): Leading zeros
to the left of and including the position in which the zero appears will
be suppressed, but leading zeros to the right will not be suppressed.
Any constants to the left of the zero will print only if preceded by a
significant digit. The zero is a replaceable character.
When in the Delta position (see example 3): Leading zeros and
constants to the right of the zero will print. The zero will not print
in the first position of the output field. If the field contains leading
zeros, a blank will print in the first position; otherwise, a
significant digit will print.
When to the left of the Delta position (see example 4): The results
are described in the preceding paragraph, except that if the field
contains leading zeros, a zero will print in the first position of the
output field. The zero in the edit word is not a replaceable character
and does not print. Note: Any zero or asterisk to the right of the first
zero is treated as a constant."
That last sentence is the one that describes the "hack"/"feature". I'm
pretty sure it was available when I was working on a System 3 Model 15D
back in the late 1970s.
--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx <mailto:petercdow@xxxxxxxxx>
pdow@xxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxx>
/
On 7/3/2020 9:22 AM, Joe Pluta wrote:
Yes, the hack is that it was an undocumented feature. And I don't
know when it was introduced, but I'm almost certain it was not
available in the Silverlake release. But that's a VERY long time ago,
so I could be wrong... :)
On 7/3/2020 10:08 AM, Vernon Hamberg wrote:
LOL - I have to chuckle at Joe's use of "hack" about this technique -
it was always what you had to do, although it wasn't always obvious,
as I recall. I just looked at the documentation, and none of the
examples show exactly this kind of edit.
Vern
On 7/3/2020 9:49 AM, Patrik Schindler wrote:
Hello Joe,
Am 08.06.2020 um 14:43 schrieb Joe Pluta <joepluta@xxxxxxxxxxxxxxxxx>:
Patrik, I have some dim memories of being able to hack the edit
word by adding an extra zero to the front. I haven't had a chance
to try this today, but I thought you could add an "extra" leading
zero. So you could create an edit word like this:
'0bb/bb/bbbb' (where "b" is a blank)
Note that there are actually nine positions specified. Then if you
ran that against an 8.0 field, you'd get 00/00/0000 with no leading
blank. I could be mis-remembering this, but I just thought I'd
bring it up.
Works like a charm! Thanks *a lot*!!
:wq! PoC
PGP-Key: DDD3 4ABF 6413 38DE - https://www.pocnet.net/poc-key.asc
As an Amazon Associate we earn from qualifying purchases.