DEFINE FILE abc newField /A250 = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE (oldField, '1', ''), '2', ''), '3', ''), '4', ''), '*', ''), '(', ''), ')', ''); END
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | ||
WebFOCUS App Studio 8.2.06 standalone on Windows 10 |
#include <stdio.h> #include <string.h> #include <memory.h> const unsigned char nospasc[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; /*-------------------------------------------------------------------*/ /* xnospchar: return input text without special characters */ /*-------------------------------------------------------------------*/ /* */ int nospchar(unsigned char *input, double *dlen, unsigned char *output) { int len = (int)*dlen ; unsigned char *in,*out,*end ; if(len>256 || len<0) len = 0; end = input + len; memset(output,' ',len); /* blank out output */ for(in=input,out=output; in<end; in++) { if(nospasc[*in]) *out++ = *in; } return(0); } /* this commented out main will printout the nospchar text from the command line. int main(int argc, char **argv) { unsigned char outc[256]; int len ; double dlen; memset(outc,0,sizeof(outc)); printf("argc: %d %s\n",argc,argv[1]); if(argc != 2) { printf("usage: nospchar <string>\n"); return(0); } len = strlen(argv[1]); dlen = len ; nospchar((unsigned char *)argv[1],&dlen,outc); printf("%s\n",outc); return(0); } */ /* this commented out main prints out the nospasc array above for upper and lower case latin1 characters int main(int argc, char **argv) { unsigned char lower[26] = "abcdefghijklmnopqrstuvwxyz" ; unsigned char upper[26] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; int i,j; memset(nospasc,0,sizeof(nospasc)); for(i=0; i<26; i++) nospasc[lower[i]] = 1; for(i=0; i<26; i++) nospasc[upper[i]] = 1; for(i=0; i<16; i++) { for(j=0; j<16; j++) { printf("%d,",nospasc[i*16+j]); } printf("\n"); } return(0); } */
gencpgm.sh -g -e -v -m cpgm nospchar.c
DEFINE FILE CAR MYC/A15 = EDIT(COUNTRY,'9%lh9+*999999$9') ; MYD/A15 = NOSPCHAR(MYC,15,MYD) ; END TABLE FILE CAR PRINT COUNTRY MYC MYD END -RUN So, we execute it: EX TEST To get: PAGE 1 COUNTRY MYC MYD ------- --- --- ENGLAND E%lhN+*GLAND ElhNGLAND JAPAN J%lhA+*PAN JlhAPAN ITALY I%lhT+*ALY IlhTALY W GERMANY W%lh +*GERMAN WlhGERMAN FRANCE F%lhR+*ANCE FlhRANCEThis message has been edited. Last edited by: Edward Wolfgram,
quote:...but do wish IBI can have this feature on it own, so don't have too rely on others.
DEFINE FILE WF_RETAIL_STORE AREARANGESTFT/A20V = DB_EXPR(REPLACE(TRANSLATE("AREA_RANGE_SQ_FT", '0123456789 .-:,', '@@@@@@@@@@@@@@@'), '@', '') ); AREARANGESTM/A20V = DB_EXPR(REPLACE(TRANSLATE("AREA_RANGE_SQ_M", '0123456789 .-:,', '@@@@@@@@@@@@@@@'), '@', '') ); END -* TABLE FILE WF_RETAIL_STORE "'Keep' Only 'A-Z' Characters In a String." PRINT AREA_RANGE_SQ_FT AREA_RANGE_SQ_M AREARANGESTFT AREARANGESTM -* ON TABLE SET STYLE * INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/jellybean_combo.sty, $ TYPE=DATA, JUSTIFY=CENTER,$ ENDSTYLE -* IF READLIMIT EQ 10 IF AREA_RANGE_SQ_FT IS-NOT MISSING END
SELECT TOP 10 (REPLACE(TRANSLATE(T1."AREA_RANGE_SQ_FT", '0123456789 .-:,', '@@@@@@@@@@@@@@@'), '@', '') ), (REPLACE(TRANSLATE(T1."AREA_RANGE_SQ_M", '0123456789 .-:,', '@@@@@@@@@@@@@@@'), '@', '') ), T1."AREA_RANGE_SQ_FT", T1."AREA_RANGE_SQ_M" FROM wrd_wf_retail_store T1 WHERE (T1."AREA_RANGE_SQ_FT" IS NOT NULL);This message has been edited. Last edited by: David Briars,