Hi,
An alternative method to Jeff's would be to use MPEX.
Lets say you have a command file called EMAILX to process
one entry,
eg parm name eaddress
# processing logic ...
and your address file is ADDRFILE,
Then you create a temporary command file,
MAIN.PUB.VESOFT > TEMPCF 'PRINT ADDRFILE;FORMAT="XEQ EMAILX "+R'
and then execute it ,
XEQ TEMPCF
And you could use the SEARCH= option to further enhance the
functionality. There are a number of other ways of using
MPEX for this job, but I find the above easy to remember.
Another alternative,
Although this is not really practical in your case,
for small files, I often use the following technique for
loading a 'small' file into a variable, and some people
may find it useful in other contexts :-
Assuming that the file has a block size of < 1022 bytes, you can
us 'input' to load multiple records (or 1 block) into a variable
by using 'nobuf'.
For example, this loads up to a hundred 8-char filenames
into a a variable :-
FILE filette;rec=-10,102,F,ASCII
LISTFILE @ > *filette
FILE filette;nobuf
INPUT buf < *filette
SETVAR buf xword(buf)
while setvar(fname,word(buf)) > ""
setvar buf xword(buf)
echo !fname
endif
Internet
From: [log in to unmask] on 13/10/99 21:22 GMT
Pour : HP3000-L
cc :
ccc: Tad BOCHAN
Objet : Re: Process a file question Thanks
> > !FCOPY FROM=CUST001W.QUIZ;TO=CUST001W.PROD
> Having to make a copy can be costly if the original file is large.
The original file is only 1 to 20 recods long.
....
>
> > !# DO NOT WORK ON THE SETUP RECORD
> > ! IF STR("!_RAW_REC",1,8) <> "12345678"
> This next comment is just a pet crusade of mine: you already have
> a string variable (_raw_rec) since that is what INPUT creates. You
> will not need to quote the variable (to make it a string) if you
> do not explicitly reference it (the "!"). I find it more readable to
> simply write:
> IF STR(_RAW_REC,1,8) ...
>
Thanks I did not know this.
> > ! SETVAR _USER_CODE STR("!_RAW_REC",1,8)
> Ditto. And also you may or may not have trailing blanks depending
> on if all of your user codes are 8 characters long. If you do not
> want trailing blanks in the _USER_CODE variable you can do one of the
> following:
> SETVAR _USER_CODE rtrim(STR(_RAW_REC,1,8)) or
> SETVAR _USER_CODE word(_RAW_REC) assuming that a common
> delimiter separates the
fields.
>
RTRIM solved a solved a potentual problem with _EMAIL making the line to
long.
> ...
>
> regards,
> Jeff Vance, CSY
-----------------------------------------------------------------------------
This message is confidential; its contents do not constitute a
commitment by Paribas except where provided for in a written agreement
between you and Paribas. Any unauthorised disclosure, use or
dissemination, either whole or partial, is prohibited. If you are not
the intended recipient of the message, please notify the sender
immediately.
Ce message est confidentiel ; son contenu ne représente en aucun cas un
engagement de la part de Paribas sous réserve de tout accord conclu par
écrit entre vous et Paribas. Toute publication, utilisation ou
diffusion, même partielle, doit être autorisée préalablement. Si vous
n'êtes pas destinataire de ce message, merci d'en avertir immédiatement
l'expéditeur.
|