I want to purge existing file, create new file using tedit and copy the contents of unstructured file to new file using jlist with the help of TACL macro.
? TACL MACRO
#PURGE $A.B.C
#TEDIT $A.B.C !
#JLIST $D.E.F, PUT $A.B.C, NOPRINT
If I run above code through RUN command in tacl prompt it gives me error like 'name is not either variable or built in function'. Please help, I am new to TACL programming .
It looks like #TEDIT and #JLIST are causing your issue. They are not valid builtins in the TACL language. To make your macro work, I would substitute EDIT there as in below:
? TACL MACRO
#PURGE $A.B.C
EDIT $A.B.C !
EDIT $D.E.F, PUT $A.B.C, NOPRINT
Alternatively, you could save yourself the startup time for the 3 runs (PURGE, EDIT and EDIT), by specifying a input file and doing it all within Edit as in below. Note that this will only work if you don't care if $A.B.C just gets its data purged, instead of actually getting rid of $A.B.C and recreating it each time.
?TACL MACRO
#Frame == Localizes your variables to this run session
#Push InFile == Create a new variable to be used
#Set InFile Get $A.B.C ! == Puts the data in the variable just created. Gets the file to be worked upon.
#Append InFile D F/L == Deletes all of the data in the file ($A.B.C)
#Append InFile G $D.E.F F/L to F == Gets the data from the new file from the first to last of the file and moves it to the file being edited at the first of the file.
#Append InFile Exit == Exits Edit
EDIT/INV InFile/ == executes the commands put into InFile
#Unframe == Removes any localized variables created by this run