3

I have successfully written out single line WTO messages using __asm__ from a C language program, thus:-

typedef struct WTO_Parm
{
  short    int  len;          /* Total length of structure */
  short    int  mcsflags;
  unsigned char message[126];
} WTOPARM;
:
pWtoParm = (WTOPARM *)__malloc31(sizeof(WTOPARM));
:
__asm__(" WTO   MF=(E,(%[text]))\n"
        :
        :[text] "r"(pWtoParm)
        :"r0","r1","r14","r15");

What I'm struggling with is how to write a Multi-line WTO in the same fashion.

The description of WTO - Write to operator says:-

  • For a multiple-line message, you must clear register 0 on the first WTO issuance if the WTO is being issued from an authorized program. For WTOs issued from problem programs, any data in register 0 is ignored.
    I am not an authorized program
  • If you code LINKAGE=SVC ...
    which is the default
    and you code the CONNECT parameter, you need a minimum authorization of either supervisor state with PSW key 0-7 or APF-authorized.
    I am not an authorized program
  • You must clear register 0 before issuing a multiple-line WTO. The only exception is when you are using register 0 to pass a message identifier to connect multiple-line messages. However, in this case, IBM® suggests you use the CONNECT parameter rather than register 0.
    I cannot code the CONNECT parameter as I am not an authorized program, so must use register 0, but any data in register 0 is ignored from problem programs.

I have been able to retrieve the message identification number used to connect WTO messages, on return from a successful WTO, with the following invocation:-

__asm__(" WTO   MF=(E,(%[text]))\n"
        " ST 1,%[wtoconn]\n"
        :[wtoconn] "=m"(ConnID)
        :[text] "r"(pWtoParm)
        :"r0","r1","r14","r15");

But I have not been able to pass the ConnID back in and have WTO make use of it. I have tried register 0 and CONNECT= (even though the above bulleted list suggests neither will work) but it seems to be ignored. I have tried putting in a ConnID with a hard-coded number (1234) and still didn't get any error back in R15, also suggesting that it is being ignored as I should have got RC=08.

I am sure that problem state programs can write multi-line WTOs but perhaps not by using CONNECT. What are the alternative ways to write a multi-line WTO and can anyone confirm that problem state programs can or cannot use CONNECT/register 0.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Morag Hughson
  • 7,255
  • 15
  • 44

1 Answers1

3

Since your program is not an authorized one, you ought to read the WTO description in the non-authorized version of the manuals. See z/OS MVS Programming: Assembler Services Guide, and z/OS MVS Programming: Assembler Services Reference IAR-XCT

CONNECT=, LINKAGE=, etc. are parameters for authorized programs, only.

Unauthorzied programs can only write multi-line WTOs of up to 10 lines with a single call to WTO. No CONNECT.

phunsoft
  • 2,674
  • 1
  • 11
  • 22
  • Thank you for the confirmation. I was confused by the fact that the documentation I was reading seemed to cover both authorized and non-authorized (as per the stuff I copied and pasted into my question) but didn't quite go far enough to indicate that CONNECT= was not applicable for non-authorized. I have now managed to successfully write a MLWTO with a single invocation of WTO - reading the comments in the header of SYS1.MODGEN(IEZWPL) was the most helpful documentation I found! :-) – Morag Hughson Jul 09 '22 at 04:50
  • If you're writing an unauthorized program, you should generally only use the "unauthorized" Assembler Services manuals, except for the topic "Dynamic Allocation", which for reasons unknown to me, has always been documented only in the Authorized Assembler Services Guide, despite it being available to unauthorized programs as well. – phunsoft Jul 09 '22 at 20:15
  • Understood - I simply didn't notice because the documentation I was reading was mentioning the rules for both authorized and non-authorized. I think that's the problem with landing up on a page from a Google search. Be more obvious if you were just grabbing a book off a shelf. – Morag Hughson Jul 10 '22 at 10:27