[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re typing allergy



Both Carl's post on 1/06, and Robert's back on 10/22/03, seemed to imply
that you could embed code in a text doc and have it run. That is also
said in CTRLCHARS, in connection with the power of PV. Well, how does one
go about that? Must one type RUN (rather than, or after, "CALL")
filename.ext on the command line? Here's what I'm trying to do:

I have to get data out of a dBase 5 for DOS database, and have discovered
that by using XyWrite as my programming editor I can embed Xy formatting
commands in the datastream dBase puts out (to a text file, thereafter
called in Xy), thereby getting much more precise control over the final
appearance of the resulting text file than would ever be possible with a
mere mail merge. (Will document this if anyone else does database with a
real RDBMS, not one of those point-and-click simulacra). This enables me
to invoke two different but powerful languages, XPL and xBase.

There are four types of subscribers, so there are four different text
blocks, one of which has to be inserted in each letter. All far too big
to store to SGs; I'd be OOM in no time flat. OK, save each block to a
separate file, and Merge it at the appropriate place. From dBase,
depending on what would work in Xy, I could do the CASE test (dBase has a
full DO CASE...END CASE function that does quicker tests of multiple "IF"
scenarios) and output the merge command in any of several ways. So I've
been testing different options within Xy to find the best.

My first thought was to just embed the line of code
BC merge e:gos.txt XC
(using PFUNC to get the BC and XC in there of course; so long as it's
enclosed in quotation marks, dBase will just pass it on the the output
file). That didn't work; I CAlled the resulting file in Xy and the code
just sat there. Then I tried (should have tried this first)
BX merge e:gos.txt Q2
No go.
Then I tried a different tack: embed PV01 in the text file (e:test.txt)
then create a program file that goes
≪SV01,BX merge e:gos.txt Q2≫CA e:test.txtXC
Test.txt gets called, but ≪PV01≫ just sits there. (I tried using SX,
but got the dreaded "SX requires a number" error msg.)
Next I tried saving each element (BX, merge e:gos.txt, Q2) to separate
SGs, then PV each in the text file. Still nada. Hmm. Should I have tried
concatinating them?

The one thing that did work was to embed the code (BX merge e:gos.txt Q2)
at the proper place in the file, DEFine it, and run RUNCODE. But
1) that would involve paging through the file, or another SE routine (see
below)
2) Can and may one use U2 routines in one's own code, and how would one
embed the equivalent of the HELPKEY?
3) the file gets merged, but the code remains and both are DEFined, which
means more cleanup.

Now this is not vital. I have a workaround: embed a line that reads "The
substype is a" (or b or c or d) in the text file, then make the program
that calls it SE for "The Substype is a", DEFine and delete it, run the
merge command, and continue searching; on error, go Top of File, branch
to a LBSt2, which searches for "The substype is b", and so on. One could
also simply search for "The substype is," DEF and SG the following
letter, and run an IF routine, but as in some 85% of the cases it will be
type a, this seemed more efficient. But if there is really a way to embed
the merge commands in the text file itself, that would be a more elegant
way to do it, I should think.

I have read Robert's CTRLCHAR, several times. But it mostly seems to deal
with searching for code, which is not what I'm trying to do here. And, as
he said, many of the examples no longer work under Xy 4. What it does
suggest is that I should perhaps be using 3-byte BX and Q2 commands if
they're in text so that they'd be interpreted as 1-byte on being run? Or
no? Any ideas? But no hurry. As I say, I have a workaround, but it seems
a bit kludgy.

Patricia