define(&LoopCount,integer,0)
define(&LoopPDF,integer,0)
define(&PDF,string,trim(@(1,1,500))) % file path
define(&NoPages,integer,PdfPageCount(&pdf)) % number of PDF pages
define(&PDFCount,integer,strtoint(trim(@(2,1,7)))) % number of PDFs created
define(&Counter,integer,length(&PDFCount)) % used in further processing outside the template
define(&TracerPre,string,trim(@(3,1,500))) % code variables
define(&TracerNum,string,trim(@(4,1,500)))
define(&TracerNumLen,integer,length(trim(@(4,1,500)))) % numeric part character count to ensure consistent code length
define(&TracerSuf,string,trim(@(5,1,500)))
For(&LoopPDF,1,1,&PDFCount) % loop through copies of doc
For(&LoopCount,1,1,&NoPages) % loop through PDF pages
&tracer:=&tracerpre+&tracernum+&tracersuf
&pdfpage:=&LoopCount
$Page1
showpage()
endfor()
%&tracernum:=right('00000000000000000000'+inttostr(strtoint(&tracernum)+1),&tracernumlen) % convert string to int, increment by one and convert back to string
endfor()