[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference ilbbak::ibi_focus

Title:FOCUS, from INFORMATION BUILDERS
Moderator:ZAYIUS::BROUILLETTE
Created:Thu Feb 19 1987
Last Modified:Mon May 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:615
Total number of notes:1779

494.0. "Stripping dashes (-) from Part number field" by KAHALA::FOREMAN (Nothings Impossible, you just run out of time) Thu Feb 06 1992 15:29

Hi all,

A couple of us were playing around with the problem of stripping "floating"
dashes out of part numbers to get a 2-5-2 format 9 character part number.
I did a quick check in here and didn't see any reference, so I though I'd
post the solution in case someone else needs to do this.  The only thing
that I know will break it is if the part comes across without a dash 
indicating a variant at the end (ie part # comes across as RP06 and nothing
else, or AA-RP06 and nothing else). In other words, there has to be at
least one dash and if there's only 1 dash it's got to be before the
variant.  Haven't seen any incoming that way, keeping my fingers crossed.
You're free to try other ways to break it ;-)

Enjoy,

Sharon

FILEDEF PARTNO DISK [FOREMAN.SLR]PARTNO.DAT

DEFINE FILE PARTNO
DASH1/I2  = POSIT (PART, 11, '-', 1, DASH1);
CLASS/A2  = IF DASH1 EQ 3 THEN EDIT(PART, '99$') ELSE '  ';
VAR/A2    = GETTOK (PART, 11, -1, '-', 2, VAR);
BASIC1/A5 = GETTOK (PART, 11, -2, '-', 5, BASIC1);
BASIC/A5  = LJUST (5, BASIC1, BASIC);
FORMAT_PART/A9 = CLASS|BASIC|VAR;
END

TABLE FILE PARTNO
PRINT PART DASH1 CLASS VAR BASIC1 BASIC FORMAT_PART
END

Incoming data is ....

RA70-A     
RA70 -A    
LA75-A2    
LA75 -A2   
VT2XC-A    
VT220-B4   
4A-MM8-AB  
4A-  MM8-AB
4A-MM8  -AB
4A-MM11-DP 
4A-MM11 -DP
4A- MM11-DP
DV-6C93A-AK

Formatting results are ...

  PAGE     1
 
 
  PART         DASH1  CLASS  VAR  BASIC1  BASIC  FORMAT_PART
  ----         -----  -----  ---  ------  -----  -----------
  RA70-A           5         A    RA70    RA70     RA70 A
  RA70 -A          6         A    RA70    RA70     RA70 A
  LA75-A2          5         A2   LA75    LA75     LA75 A2
  LA75 -A2         6         A2   LA75    LA75     LA75 A2
  VT2XC-A          6         A    VT2XC   VT2XC    VT2XCA
  VT220-B4         6         B4   VT220   VT220    VT220B4
  4A-MM8-AB        3  4A     AB   MM8     MM8    4AMM8  AB
  4A-  MM8-AB      3  4A     AB     MM8   MM8    4AMM8  AB
  4A-MM8  -AB      3  4A     AB   MM8     MM8    4AMM8  AB
  4A-MM11-DP       3  4A     DP   MM11    MM11   4AMM11 DP
  4A-MM11 -DP      3  4A     DP   MM11    MM11   4AMM11 DP
  4A- MM11-DP      3  4A     DP    MM11   MM11   4AMM11 DP
  DV-6C93A-AK      3  DV     AK   6C93A   6C93A  DV6C93AAK
                                                         
T.RTitleUserPersonal
Name
DateLines