When the macro is created and the export file defined, the following script exports the data returned as a report and executes the macro:
.LOGON tdpid/userid, password .EXPORT REPORT DDNAME=report EXECUTE deptdisplay; .SET FORMAT OFF .EXPORT RESET .LOGOFF
Execute the z/OS JCL (from outside of BTEQ) to submit the script and execute the macro.