[Isis-users] change the structure of the CDS/ISIS database by Ernesto !
Wieslaw Glinski
wieslawglinski at op.pl
Tue May 1 23:26:16 CEST 2012
Hi everybody
I had the problem with changing the structure of cds/isis database.
Ernesto Spinak spend a lot of time and effort and showed me step by step how to overcome this problem
I hope it can be usefull for anyone who may have the same or similar problem.
Below is the problem and Ernesto’s great solution:
thanks
_____
PROBLEM
We have a database named agwb, with the structure
mfn= 1
10 «´╗┐¯ö»¯êÜab┼éo┼ä»
20 «39»
30 «VI»
40 «3»
..
mfn= 2
10 «¯ö»¯êÜab┼éo┼ä»
20 «59»
30 «VI»
40 «3»
..
mfn= 3
10 «¯ö»¯êÜab┼éo┼äa»
20 «54»
30 «VI»
40 «3»
We want to join all records with the same value of v10, into a single records with fields v10,v30,v40 converted in a single filed v100 with subfields (as repeatable group), like
mfn= 3
10 «¯ö»¯êÜab┼éo┼äa»
100 «^a54^bVI^c3»
..
mfn= 4
10 «¯ö»¯êÜab┼éo┼äa»
100 «^a54^bVI^c3»
100 «^a106^bVI^c3»
..
mfn= 5
10 «¯ö»¯êÜab┼éo┼äa»
100 «^a54^bVI^c3»
100 «^a106^bVI^c3»
100 «^a107^bVI^c3»
..
AND ERNESTO’s SOLUTION
// You need the CISIS utilties of (c) Bireme in your PC
1) first you have to convert a group of fields into a single subfielded field
the proc is simple because there are no repeatable fields involved,
otherwise the strategy would be more complex.
mx agwb <mailto:proc=@subfields.prc> proc=@subfields.prc create=zzz1 now -all tell=100
File: subfields.prc
'd20d30d40'
'<100>^a',v20,'^b',v30,'^c',v40,'</100>'
Now you have a dbase zzz1 with contents
mfn= 1
10 «´╗┐¯ö»¯êÜab┼éo┼ä»
100 «^a39^bVI^c3»
..
mfn= 2
10 «¯ö»¯êÜab┼éo┼ä»
100 «^a59^bVI^c3»
..
mfn= 3
10 «¯ö»¯êÜab┼éo┼äa»
100 «^a54^bVI^c3»
2) the following step is more tricky
if field v10 were a common Isis field (char are ascii or ansi, or non graphic Unicode, Utf)
you could use the parameter join= of mx, but for this you need a classic Inverted File which fails
because the non-standard characters
Therefore we had to circumvent this problem using another strategy
Also: We have the database ordered by v10, so all the contigous records belong to the same group
Otherwise we should to order the database using the command msrt.exe)
The idea is to browse the database in ascending MFN order and if field v10 or record xx is the same as record xx -1, theN we carry over the data from the previous record and add to the actual record.
mx zzz1 <mailto:proc=@carryover.prc> proc=@carryover.prc copy=zzz1 now -all tell=100
file: carryover.prc
if ref(mfn-1,v10)=s(v10) then
'd100',
'<100>', ref(mfn-1,v100+|%|), '</100>'
'<100>', v100, '</100>'
fi,
In the example, v10 of MFN 3 and 4 are the same, then MFN=4 carry the contents of MFN=3 and places it
as the first occ of the field V100.
(note: the concatenation of strings with % is a trick to preserve the order)
mfn= 3
10 «¯ö»¯êÜab┼éo┼äa»
100 «^a54^bVI^c3»
..
mfn= 4
10 «¯ö»¯êÜab┼éo┼äa»
100 «^a54^bVI^c3»
100 «^a106^bVI^c3»
..
mfn= 5
10 «¯ö»¯êÜab┼éo┼äa»
100 «^a54^bVI^c3%^a106^bVI^c3»
100 «^a107^bVI^c3»
3) Explode of chains with % as repeatable field and clean file from spaces, etc
mxcp zzz1 create=final repeat=% clean
mfn= 3
10 «¯ö»¯êÜab┼éo┼äa»
100 «^a54^bVI^c3»
..
mfn= 4
10 «¯ö»¯êÜab┼éo┼äa»
100 «^a54^bVI^c3»
100 «^a106^bVI^c3»
..
mfn= 5
10 «¯ö»¯êÜab┼éo┼äa»
100 «^a54^bVI^c3»
100 «^a106^bVI^c3»
4) export the file to an ISO standard
mx final iso=nwagb.iso now -all tell=100
ready!!!
If you find this excercise interesting, I'd appreciate you communicate it to the ISIS list
in order to give some feedback to the list and show colleagues that this List works
Regards from Montevideo
Ernesto Spinak
so you should do the following command
mxcp zzz1 create=zzz2 repeat=% clean
then
mx zzz2 "proc=if ref(mfn+1,v10)=s(v10) then 'd.' fi" copy=zzz2 now -all tell=100
then
mx zzz2 iso=zzz2.iso now -all tell=100
mx iso=zzz2.iso create=final now -all tell=100
Now it works
The set of commands are:
_____
1. mx agwb <mailto:proc=@subfields.prc> proc=@subfields.prc create=zzz1 now -all tell=100
2. mx zzz1 <mailto:proc=@carryover.prc> proc=@carryover.prc copy=zzz1 now -all tell=100
3. mxcp zzz1 create=zzz2 repeat=% clean
4. mx zzz2 "proc=if ref(mfn+1,v10)=s(v10) then 'd.' fi" copy=zzz2 now -all tell=100
5. mx zzz2 iso=zzz2.iso now -all tell=100
6. mx iso=zzz2.iso create=final now -all tell=10
_____
V V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.iccisis.org/pipermail/isis-users/attachments/20120501/5ba572ad/attachment.html>
More information about the isis-users
mailing list