Home > other >  Using WTO to write multi-line message via __asm__ in C language
Using WTO to write multi-line message via __asm__ in C language

Time:07-09

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.

CodePudding user response:

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.

  • Related