← Back to team overview

nxhtml team mailing list archive

Re: [Question #49234]: MuMaMo examples, question

 

Question #49234 on nXhtml changed:
https://answers.launchpad.net/nxhtml/+question/49234

    Status: Answered => Open

Yary.H is still having a problem:
> lborgman proposed the following answer:
> Thanks for the information, Yary. It looks like there could be a bug.
> Could you please send a short example that gives this backtrace?


#!/bin/ksh
. /bin/shared/.mkt.cfg


STORE_TMP=/tmp/stores.txt
cd /spool/xml

rm -f $STORE_TMP

bteq << EOF
.SESSIONS 1
.LOGON $UserId,$Password;

.EXPORT DATA FILE "$STORE_TMP"
select division_id,store_id,
trim(store)||' '||trim(store_addr_line2_txt)||', '||
trim(store_city)
from stores
where status_id='A'
  and division_id in (517,1920,2445)
order by division_id,store_city,store_id;

.EXIT 0
EOF

perl <<EOF > $1
print qq(<?xml version="1.0" encoding="utf-8"?>\n<stores>);
open IN, '<$STORE_TMP';
while (read IN,\$info, 12) {
  my (\$div, \$s) = unpack 'x2 i i', \$info;  # read binary nums
  \$_ = <IN>;   # Read store name
  chop;	    # Remove newline
  s/(\w+)/\u\L\$1/g; # Title case
  s/&/&amp;/g;  # Fix ampersands
  s/"/&quot;/g; # Fix quotes
  printf qq(<s d="%02d" i="%d" n="%s"/>\n),\$div,\$s,\$_;
}
print "</stores>";
EOF

rm $STORE_TMP

-- 
You received this question notification because you are a member of
nXhtml, which is an answer contact for nXhtml.