# Code Samples: Link to SXCQWRIT or SXCQWTSQ

COBOL and C code samples are listed as follows, which demonstrate how to link to SXCQWRIT.

- COBOL

      MOVE LOW-VALUES TO TDQW-TSQ-Name
      SET TDQW-PDATA TO ADDRESS OF DATAAREA.
      MOVE LENGTH OF DATAAREA TO TDQW-DATALEN.
      MOVE {'R', 'G', 'O', ’S’} TO TDQW-TDQ-TYPE.
      EXEC CICS LINK PROGRAM('SXCQWRIT' or 'SXCQWTSQ')
                     COMMAREA(SXCCTDQW)
                     LENGTH(TDQW-Header-Len)
                     RESP(DFHRESP1)
                     RESP2(DFHRESP2)
      END-EXEC.
      IF TDQW-RETURN NOT = TDQW-NORMAL
        TAKE-ACTION.

- C

      short int sTDQW = sizeof(SXCHTDQWR);
      SXCHTDQWR TDQW;

      memset(&TDQW.Tsq_Name[0],0x00,16);
      TDQW.pData = address of data;
      TDQW.DataLen = length of data;
      TDQW.Tdq_Type = {'R', 'G', 'O', ’S’};
      EXEC CICS LINK PROGRAM('SXCQWRIT' or 'SXCQWTSQ')
                       COMMAREA(&TDQW)
                       LENGTH(sTDQW);
      if (TDQW.Return != 0)
         Take_action;

Copyright © TIBCO Software Inc. All rights reserved.