27.04.2013 Views

MVS Jan 2005.p65 - CBT Tape

MVS Jan 2005.p65 - CBT Tape

MVS Jan 2005.p65 - CBT Tape

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SYSLIN DD *<br />

INCLUDE OBJECT(TESTATT) OBJ MODULE FOR TESTATT AFTER PRELINK<br />

INCLUDE OBJECT(ATTACH) OBJ MODULE FOR ATTACH FUNCTION<br />

INCLUDE OBJECT(DETACH) OBJ MODULE FOR DETACH FUNCTION<br />

ENTRY CEESTART<br />

NAME TESTATT(R)<br />

INCLUDE OBJECT(ATTPGM1) OBJ MODULE FOR ATTPGM1 PROGRAM<br />

NAME ATTPGM1(R)<br />

Here is sample JCL for running a test:<br />

//TESTATT EXEC PGM=TESTATT<br />

//STEPLIB DD DSN=load.library,DISP=SHR<br />

//SYSPRINT DD SYSOUT=*<br />

CONCLUSION<br />

Using the ATTACH()/DETACH() function pair in a C or C++<br />

program environment provides much more control over a<br />

multi-tasking environment than any of the inherent methods<br />

provided for IBM C/C++ programs. If you have the need for<br />

multi-tasking C/C++ applications, I’m confident that you will<br />

see the benefit of using these functions.<br />

ATTACH ASM<br />

*---------------------------------------------------------------------*<br />

* This program provides support for a C/C++ ATTACH() function. *<br />

* It is designed to function similarly to the ATTACH macro for *<br />

* Assembler programs. The ATTACH() function supports a basic *<br />

* program ATTACH with parameter passing support. This version *<br />

* of the function does not support the more esoteric ATTACH macro *<br />

* parameters, but does provide for specifying the address of a DCB *<br />

* for an open TASKLIB DD. As well, for tasks that need to be *<br />

* waited on for completion, the ATTACH() function supports the *<br />

* passing of an ECB area address and a return area for the TCB *<br />

* address. *<br />

* *<br />

* For this program the following register usage is in effect: *<br />

* *<br />

* RØ - R1 : work registers, but generally available for use *<br />

* by calls to system functions *<br />

* R2 : used to save the incoming parameter address *<br />

* R3 - R7 : work registers *<br />

* R8 : used as base register for the required incoming *<br />

* workarea *<br />

34 © 2005. Xephon USA telephone (214) 340 5690, fax (214) 341 7081.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!