>>>In order to communicate with Sterling Commerce EDI products I need to create a flat file that contains multiple record types. In COBOL I did this with a master record then an infinite number of REDEFINEs for that record for each record type. How does one do this in VFP?
>>>
>>>Regards/yb
>>
>>
>>You need to write things out to an ASCII file. Look at the low level file functions (FCREATE, FWRITE, etc.)
>
>Thanks for the prompt response.
>
>I could create multiple cursors for the record types, but neither fwrite or fputs take the cursor as an arguement:
>
>For Example
>
>create cursor rectyp1 (field1 c(10), field2 n(2,1)...)
>...
>
>nfid=fcreate("temp.tmp")
>
>=fputs(nfid,rectyp1)
>
>...
Of course not, but you could write a routine which does
Do FputCurs with "alias_of_the_cursor"
and
Proc FputCurs
Para CursAlias
Select (CursAlias)
Local n, i, tmp[1]
n=afields(tmp)
for i=1 to n
=fputs(nfid, eval(tmp[i]))
endf
This function will write all of your fields, one by one, into the ascii file, provided they are all strings. Otherwise, you'd better write a routine for each of the cursors, or provide some kind of All2String function to convert values you'll fPuts().