Luc,

I agree, default edit codes or words would be nice. However they are very
limited as to where they are used. For example, let's take this DDS file:
R LUCR
NBRFLD 9P 0 EDTWRD(' - - ')

If I compile that and punch in two records and then run RUNQRY
QRYFILE(LUC) I get:
....+....1.
NBRFLD
123-45-6789
987-65-4321

All well and good. However if I pull that into Excel I get
NBRFLD
1.23E+08
9.88E+08
Then I adjust my column width and I get:
NBRFLD
123456789
987654321

Where's my editing? How would that appear on a web screen (by "default")?

Let's try this instead. If run this wee bit of sql:
CREATE TABLE ROB/LUC2
(NBRFLD DEC(9,0))
RCDFMT LUC2R;

CREATE FUNCTION ROB/SSN(INPUT DEC(9,0))
RETURNS CHAR(11)
RETURNS NULL ON NULL INPUT
LANGUAGE SQL
BEGIN
DECLARE CHARNBR CHAR(9);
DECLARE SSN CHAR(11);
SET CHARNBR = CHAR(INPUT);
SET SSN = SUBSTR(CHARNBR,1,3) CONCAT '-' CONCAT
SUBSTR(CHARNBR,4,2) CONCAT '-' CONCAT
SUBSTR(CHARNBR,6,4);
RETURN SSN;
END;

CREATE VIEW ROB/LUC2VIEW AS (
SELECT NBRFLD, SSN(NBRFLD) AS SSNFMT
FROM LUC2)
RCDFMT LUC2VIEWR;

and then I run this:
select * from rob/luc2view
I get:
NBRFLD SSNFMT
123,456,789 123-45-6789
987,654,321 987-65-4321

Now, when I pull this down into Excel the column SSNFMT looks like:
SSNFMT
123-45-6789
987-65-4321

And there's nothing that says that different regions cannot have their own
version of the SSN function.
The SSN function itself could have logic in it to reformat based on
region.


Rob Berendt

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].