updating @cb and @ub
Walter Vaughan
wvaughan at steelerubber.com
Fri Dec 22 10:51:16 PST 2006
> Quoting VL (Fri, 22 Dec 2006 08:49:59 -0600):
> [...]
>>What is the format of the key and data files? How would I go about
>>updating them with perl? No indexes on @cb or @ub.
Ack... Merry Christmas... here you go
**NOTE** this is just rough notes to help you along the way. You probably will
damage your data a few times till you get it right.
***YOU HAVE BEEN WARNED***
setup an Alien file that uses your key file you want to update
Data File Name: /appl/filepro/Order/key
and has fields similar to this:
OrderKey Define files
Number -------------Field Heading-------------- Len --Type--
1 - Used ■ 1■
2 - Res1 ■ 1■
3 - Create Date ■ 2■
4 - Created By ■ 2■
5 - Updated Date ■ 2■
6 - Updated By ■ 2■
7 - Batch Date ■ 2■
8 - Res2 ■ 8■
9 - order num ■ 9■
10 - filler ■ 125■
You will notice that the first 20 bytes are what you are interested in. Remember
since this is an alien file, you gotta be extra careful. After field 8 you have
to have enough characters that match how many characters you have in your normal
file. In the case above we have the first field of nine characters with the
order number so we can verify what we are doing.
Then in filepro we set a variable "rr" to be the record number we want to change
and "id" is the number out of /etc/password that is the person we want to change
the record to. This code only works with id's less than 1024. You should be able
to see from the code how to extend it up to 32K or so.
Then: lookup OrdKey r=rr -n
If: not OrdKey
Then: close Ordkey;goto lokpik
Then: hf=id
If: hf le "256" '<= 256 - NO OFFSET - DIFFERENCE
Then: hg=hf-"256";hi=chr("0");goto setit
If: hf lt "512" '< 512 - OFFSET 1 + DIFFERENCE
Then: hg=hf-"256";hi=chr("1");goto setit
If: hf lt "768" '< 768 - OFFSET 2 + DIFFERENCE
Then: hg=hf-"512";hi=chr("2");goto setit
If: hf lt "1024" '< 1024 - OFFSET 3 + DIFFERENCE
Then: hg=hf-"768";hi=chr("3");goto setit
setit
Then: hh=chr(hg)
Then: OrdKey(4)=hh&hi;close OrdKey
Double and triple check everything. The above is only for @cb, but it'll be
similar for @ub [update OrdKey(6)].
Make sure you have the correct number of characters in the filler fields.
--
Walter
..who's finally seeing the light that writing a sql update to do the above is a
whole lot easier.
More information about the Filepro-list
mailing list