Macro: APPEND_OUTPUT
#IFSAME !1 CHANNEL
!A [] $10A |CI1 !2
#IF !0>2
APPEND_OUTPUT !3 !4
#ENDIF
#ELSE
#IFSAME !1 DBMS IMAGE
#IFSAME !1 IMAGE
#IFDEF !2 // allow variable for image number
APPEND_OUTPUT ('!1:' + string(!2)) !3 !4 !5 !6 !7 !8 !9
#ELSE
#SET Q$ !2.N
!A [] $101 |CS"!1:!q" |CI2
#ENDIF
#ELSE
#IFCLASS !2 "F" // if field ref, use as is
!A [] $101 |CS"!1:!2" |CI2
#ELSE
#IFDEF !2 // for all classes/types, assume variable string for field ref
APPEND_OUTPUT ('!1:' + string(!2)) !3 !4 !5 !6 !7 !8 !9
#ELSE
#CHECK !2 _U // force cannot be untyped error.
#ENDIF
#ENDIF
#ENDIF
#ELSE
#CHECK !2 .
!A [] $101 !1 |CI2
#ENDIF
#ENDIF