Syntax error... in the wrong place
Jay Ashworth
jra at baylink.com
Fri Mar 1 09:04:22 PST 2013
The table below is giving me a syntax error. the error is
"""
Syntax error in line 21:
::new(to) = old(fr):
^
"""
If you count, though, you'll find that line 21 is actually:
::import ascii old=(fn) r=^J f=|:
inside the block labeled 'header', and indeed, that's the line dcabe
leaves me on when I ack the error message.
Any thoughts on what it doesn't like here? Import accepts an indirected
variable for a filename these days right? fr isn't a reserved word?
'old' used to be called 'web', and I thought maybe *that* was reserved,
so I changed it.
Confused now.
dcabe is 4.8.3K2D4. Yes, it's ancient. No, I can't change it.
On a side note, is my plan for skipping the label line actually going
to work? The semantics of IMPORT ASCII are "open if necessary, and
then read a line every time you're called", correct?
Cheers,
-- jra
================8<=========================
::debug on:
::' webget/importreg - import the student reg file we're given with -r:
::':
::' jra at baylink.com - 17 Feb 2013:
::':
data:::
::fn(80,*) ' name of the file (today's date):
::':
start:::
::' this code is a "sit on record 1 and lookup free" table:
::' I don't much like those, but there's no other obvious way to import:
::' a variable length CSV file with IMPORT:
::':
::' REMEMBER - if there *is* no record 1, the code won't run:
::':
::' even first-er, get the filename from the command line:
::fn=@PM ' the -r argument must be a full path name, possibly quoted:
::':
header:::
::' first skip the headers:
::import ascii old=(fn) r=^J f=|:
::':
rloop:::
::' ok, now, lets get a record:
::import ascii old=(fn) r=^J f=|:
:not web:end ' if import fails, we're done:
::' everything's ok, so get a free record:
::lookup new=webimport r=free -nx:
:not new:show "@Couldn't get free record - disk full?"; exit:
::':
rcopy:::
::' and copy the fields:
::' don't forget to flag which file the data's coming from:
::':
:fn co "bricks":new(1) = "B":
:fn co "online":new(1) = "O":
::ii(3,.0)="1":
rloop:::
::' loop - actually pull in the records:
::' no parsing or edits here; that happens on post, kicking out failures:
::':
::' for (i=1; i<=29; i++):
::fr(3,.0) = ii; to(3,.0) = ii+"1" ' 1 field offset in webimport due to B/O flag:
::new(to) = old(fr):
::gosub special:
::show "@"<ii<|"{new(to){"| == |"{old(fr){"|":
::ii=ii+"1":
:ii gt 29:goto rend:
::goto rloop:
::':
rend:::
::' never know if we'll need wrap-up processing later:
::end:
::':
special:::
::' process special fields:
:fr eq "24" and web(fr) eq "Cash":new(to)="CA":
:fr eq "24" and web(fr) eq "Check":new(to)="CK":
:fr eq "24" and web(fr) eq "Money Order":new(to)="MO":
::':
::return:
::':
================8<=========================
--
Jay R. Ashworth Baylink jra at baylink.com
Designer The Things I Think RFC 2100
Ashworth & Associates http://baylink.pitas.com 2000 Land Rover DII
St Petersburg FL USA #natog +1 727 647 1274
More information about the Filepro-list
mailing list