![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |
When accessing an external data set through an export table in z/OS, you can write an external routine to manipulate the data. The external routine must be written in assembler and can:
• Insert multiple records to the external file based on one record from TIBCO Object Service Broker
You can concatenate the library in the CLIST that you use to log in to TIBCO Object Service Broker or if you are exporting the data in batch, you can concatenate the library in the batch JCL DD statement HRNEXTR.To write an external routine use the IMPXPARM macro found in the MACRO data set distributed with TIBCO Object Service Broker to describe the DSECT of the parameters that are passed to the external routine.
Represents the record length. If the record length is changed by the external routine, the server uses the changed length for input or output. HRNXRLEN is set to zero upon entry to the import external routine when the end of the file is reached. You can use this to insert additional records into TIBCO Object Service Broker. Points to the I/O record buffer. If the buffer pointer is changed by the external routine, the server uses the new buffer for input or output. Do not change the data in this buffer. A 4 KB work area that is preserved between calls to the external routine. It is cleared to X’00’ at the first rules-based INSERT to an export table. A 4 KB work area that is not preserved between calls to the external routine. It is also not cleared before the external routine call. It can be used as the work area where you compose the record to be inserted. At the end of the external routine, Register 15 contains a return code that indicates the action the server should take. The valid return codes whose description follows are located in the IMPXPARM macro.
Do not call the external routine again for this transaction. No more physical records are read or written and the external routine is not called again for this transaction. For an export table, end of file is indicated when HRNXRLEN is zero and you should return @HRNXDON to prevent its external routine from being called again. A new record is to be inserted. The external routine must set HRNXRECA to the address of the new record and HRNXRLEN to the length of the new record.The following example calculates record size based on data in the record. The record size is modified to create variable length records in the output data set.
COPY EQUATES STANDARD EQUATES.
COPY IMPXPARM EXIT PARAMETERS.
EXPREC DSECT
EXPDLEN DS H
EXPTYPE DS CL1
DS CL1
EXPDATA DS 4CL1000
SCREXIT CSECT
SAVE (14,12),,* SAVE THEM ... STANDARD LINKAGE
USING SCREXIT,R12 R12 ...
LR R12,R15 BASE REGISTER
USING HRNXPARM,R1 ADDR CALLING PARMS.
L R2,HRNXRLEN R2 = RECORD LENGTH
LTR R2,R2 IS IT A NORMAL RECORD?
BNZ NORMAL YES
*---------------------------------------------------------------------*
* WE’VE BEEN CALLED AT THE END OF ALL NORMAL RECORDS. *
*---------------------------------------------------------------------*
LA R15,@HRNXDON RC = DON’T CALL ANY MORE
B RETURN RETURN
*---------------------------------------------------------------------*
* CORRECT RECORD LENGTH ON OUTPUT VB RECORD. *
*---------------------------------------------------------------------*
NORMAL L R9,HRNXRECA GET ADDRESS OF RECORD
USING EXPREC,R9 TELL ASSEMBLER
LH R3,EXPDLEN GET DATA LENGTH
LA R3,4(,R3) ADD 4 TO LENGTH FOR HEADER
ST R3,HRNXRLEN SAVE AS RECORD LENGTH
LA R15,@HRNXKEP SET ’KEEP’ RC.
RETURN DS 0H
RETURN (14,12),,RC=(15)
LTORG
END
![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |