tandem - 用于清除和创建新文件的简单 TACL 宏
问题描述
我想清除现有文件,使用 tedit 创建新文件,并在 TACL 宏的帮助下使用 jlist 将非结构化文件的内容复制到新文件。
? TACL MACRO
#PURGE $A.B.C
#TEDIT $A.B.C !
#JLIST $D.E.F, PUT $A.B.C, NOPRINT
如果我在 tacl 提示符下通过 RUN 命令运行上面的代码,它会给我错误,例如“名称既不是变量也不是内置函数”。请帮忙,我是 TACL 编程的新手。
解决方案
给你,使用 ROUTINE 而不是 MACRO,这样会更好。
?tacl routine
#output CRE8COPY Mark H. Poriss, Sr.
==
== RUN CRE8COPY <file to be copied> <new file from file to be copied>
==
#frame
== Create a set of variables to work with
#push makeCopyOfThisFile copyContentsToThisFile resultOfPurge copyV
== Accepts arguments from the run(command) line
#if [#argument/value makeCopyOfThisFile/filename end]
#if [#argument/value copyContentsToThisFile/filename/syntax/]
== Make filenames uppercase (looks better)
#set makeCopyOfThisFile [#shiftstring [makeCopyOfThisFile]]
#set copyContentsToThisFile [#shiftstring [copyContentsToThisFile]]
== Use #FILEINFO with EXISTENCE to see if the file exists
== Use #PURGE to actually delete the file passing back a result
#output Purge copy file if it exists
[#if [#fileinfo/existence/[copyContentsToThisFile]] |then|
#set resultOfPurge [#purge [copyContentsToThisFile]]
[#if [resultOfPurge = 0] |then|
#output File [copyContentsToThisFile] purged ok
|else|
#output Error [resultOfPurge] on purge of [copyContentsOfThisFile]
]
|else|
#output File [copyContentsToThisFile] does not exist, ok to continue
]
== Use EDIT with PUT to create your new file
#output Using EDIT to create [copyContentsToThisFile]
#push editV
edit /outv editV/ [makeCopyOfThisFile] put [copyContentsToThisFile] !;exit
#unframe
推荐阅读
- node.js - 接收错误:html-pdf:PDF 生成超时。Phantom.js 脚本没有退出。在 Firebase 云函数中
- c++ - 完美的前向返回类型,但带有 const
- azure - 为什么我的 Azure Cosmos DB SQL API 容器拒绝具有相同分区键值的多个项目?
- amazon-web-services - 创建 web 源模块 oracle apex 20.0
- xamarin.forms - 在轮播视图中调整每个图像的大小
- python - 将 numpy 数据类型转换为本机 python 数据类型的更简单方法
- c - 二叉搜索树和结构
- thymeleaf - Thymeleaf - 如何编写 Html 字符串文字?
- pine-script - 将自己的战略与另一个战略联系起来
- javascript - 在 html 中使用 Javascript 更改视频源,而无需仅刷新视频页面