Zxdl Script Review

Avoid monolithic scripts. Split logic into reusable modules:

#INCLUDE common/error_handling.zxdl
#INCLUDE common/ftp_utils.zxdl

Let’s walk through a practical example. Suppose you need to:

Here’s a complete zxdl script solution:

#ZXDL_VERSION 2.0
#ENV PRODUCTION

SET $ftp_host = "ftp.example.com" SET $ftp_user = "automation" SET $ftp_pass = "secure123" SET $work_dir = "/opt/zxdl/work/" SET $log_file = $work_dir + "process.log" zxdl script

JOB main_processor LOG "Starting invoice download process" TO $log_file

TASK read_customer_list COMMAND read_lines --file $work_dir + "customers.txt" --into $customer_array IF [ -z $customer_array ] THEN LOG "ERROR: customer list empty" TO $log_file ABORT JOB ENDIF END_TASK

TASK loop_customers FOR EACH $cid IN $customer_array LOG "Fetching invoices for " + $cid TO $log_file RUN ftp_get --host $ftp_host --user $ftp_user --pass $ftp_pass —remote "/invoices/" + $cid + ".pdf" —local $work_dir + "downloads/" ENDFOR END_TASK Avoid monolithic scripts

TASK generate_report RUN report_generator —template summary.tpl —output final_report.html END_TASK

LOG "Process completed successfully" TO $log_file END_JOB

To execute this script (assuming a hypothetical interpreter called zxdl-run):

zxdl-run process_invoices.zxdl

Conditional branching uses IF, ELIF, and ELSE:

IF [$error_count -gt 0] THEN
  CALL send_alert
ELSE
  CALL commit_transaction
ENDIF