This is an example of a multiple-line WTO using CONNECT. The text
is variable. This code is re-entrant, if the static data has been
copied into a getmained area.
.
.
* Access to CMDX parameter list
L R8,0(R1) save address of CMDX
USING CMDX,R8 Access the CMDX
.
.
.
* Put the first line of text into the TEXT field
* Set the length of the first line
LA R4,L'first line of text
STH R4,TEXTLEN
* Copy actual first line into text field
MVC TEXTTEXT(L'first line of text),first line of text
* Clear register 0 so it will not look like a CONNECT ID
XR R0,R0
* Issue WTO for the first line
WTO TEXT=((TEXTADDR,,)), X
CONSID=CMDXC4ID, X
CART=CMDXCART, X
DESC=5, X
MF=(E,LINE1)
* Save the connect ID returned from the first line WTO
ST R1,MSGID
*
* Repeat the following block until finished putting out all the lines
*
* Put the next line of text into the TEXT field
* Set the length of the next line
LA R4,L'next line of text
STH R4,TEXTLEN
* Copy actual next line into text field
MVC TEXTTEXT(L'next line of text),next line of text
WTO TEXT=((TEXTADDR,,)), X
CONNECT=MSGID, X
MF=(E,CONTINUE)
*
* Ship a "null end line" (no text) to indicate message is finished
WTO ('',E), X
CONNECT=MSGID, X
MF=(E,NULLEND)
.
.
.
* Dynamic variables - declare as static and copy into getmained area
LINE1 WTO TEXT=((,D)), X
CONSID=, X
CART=, X
DESC=5, X
MF=L
CONTINUE WTO TEXT=((,D)), X
CONNECT=, X
MF=L
NULLEND WTO ('',E), X
CONNECT=, X
MF=L
TEXTADDR DS 0H
TEXTLEN DC CL2' '
TEXTTEXT DC CL72' '
MSGID DS F
.
.
.
* DSECTs
* CMDX - Command exit parameter list -*
IEZVX101 CMDX