home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
NWTP04
/
XBINDRY
/
SWAPNAME.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-12-29
|
3KB
|
79 lines
{$X+,B-,V-}
program swapnames;
{ Example for the nwBindry unit / NwTP 0.4 API. (c) 1994, R.Spronk }
{ AREA:NOVELL
(1394) Thu 30 Sep 93 16:07
By: JAMES SIMONSON
To: All
Re: Novell 3.11/4.01 bindery access
------------------------------------------------------------
Is there a way to access the full name information inthe bindery files?
Here's the scoop:
We've got "firstname mi lastname" in the FULLNAME space in the user record.
We need to convert that to "lastname, firstname mi" & place that
information BACK into the FULLNAME field. Is there any relatively fast way
to do this conversion?
--- SLMAIL v3.0 (#0623)
* Origin: WorkStations Unlimited / 312-404-2824 (1:115/404) }
{ This program will reverse all first& last names in the bindery.
Lastname is defined as being everything after the last space in the full name.
This may not be true for all names.
If there is no space in the full name, nothing changes. }
uses nwBindry;
Var lastObjSeen:LongInt;
objName :string;
objType :word;
objId :LongInt;
objFlag,objSec:Byte;
hasProp :boolean;
propVal :propertyType;
moreseg :boolean;
propFlags:Byte;
NewName,FullName:string;
t:byte;
begin
LastObjSeen:=-1;
WHILE ScanBinderyObject('*',1,LastObjSeen,
objName,objType,objId,objFlag,objSec,hasProp)
do begin
IF ReadPropertyValue(objName,objType,'IDENTIFICATION',1,
propVal,moreSeg,propFlags)
then begin
t:=1;
while (propVal[t]<>0)
do begin FullName[t]:=chr(propVal[t]);inc(t) end;
FullName[0]:=chr(t-1);
IF pos(',',FullName)=0
then begin
writeln(FullName);
while fullName[ord(fullName[0])]=' '
do dec(FullName[0]);
t:=ord(FullName[0]);
while (t>0) and (FullName[t]<>' ') do dec(t);
if t>0
then begin
NewName:=copy(FullName,t+1,255)+', '
+copy(FullName,1,t-1);
writeln(newname);
fillChar(propVal,SizeOf(propVal),#0);
for t:=1 to ord(newName[0])
do propVal[t]:=ord(newName[t]);
WritePropertyValue(objName,objType,
'IDENTIFICATION',1,propVal,FALSE);
end;
end;
end;
end;
if nwBindry.result<>$FC then writeln('error scanning bindery');
end.