5 STORE_TMP=/tmp/stores.txt
12 .LOGON $UserId,$Password;
14 .EXPORT DATA FILE "$STORE_TMP"
15 select division_id,store_id,
16 trim(store)||' '||trim(store_addr_line2_txt)||', '||
20 and division_id in (517,1920,2445)
21 order by division_id,store_city,store_id;
27 print qq(<?xml version="1.0" encoding="utf-8"?>\n<stores>);
28 open IN, '<$STORE_TMP';
29 while (read IN,\$info, 12) {
30 my (\$div, \$s) = unpack 'x2 i i', \$info; # read binary nums
31 \$_ = <IN>; # Read store name
32 chop; # Remove newline
33 s/(\w+)/\u\L\$1/g; # Title case
34 s/&/&/g; # Fix ampersands
35 s/"/"/g; # Fix quotes
36 printf qq(<s d="%02d" i="%d" n="%s"/>\n),\$div,\$s,\$_;