17.00 - Assembler INMOD  - Parallel Data Pump

Teradata® Parallel Data Pump Reference

prodname
Parallel Data Pump
vrm_release
17.00
created_date
June 2020
category
Programming Reference
featnum
B035-3021-220K
//JCKAS1 JOB 1,’JCK’,MSGCLASS=A,NOTIFY=JCK,CLASS=B,
REGION=4096K 
//***************************************************************** 
//*                                                               * 
//*     IDENTIFY NECESSARY LOAD LIBRARIES FOR RELEASE             * 
//*                                                               * 
//***************************************************************** 
//JOBLIB   DD  DISP=SHR,DSN=STV.GG10.APP.L 
//         DD  DISP=SHR,DSN=STV.GG00.APP.L 
//         DD  DISP=SHR,DSN=STV.TG00.APP.L 
//         DD  DISP=SHR,DSN=STV.RG00.APP.L 
//         DD  DISP=SHR,DSN=TER2.SASC301H.LINKLIB 
//ASMFCL   EXEC ASMFCL 
//ASM.SYSIN DD * 
DYNAMN  TITLE ’-- CONCATENATE INPUT RECORDS FOR INPUT TO TPump’ 
DYNAMN   CSECT
         USING DYNAMN,15
******************************************************************* 
*   THIS PROGRAM IS CALLED BY THE TERADATA TPump PROGRAM          * 
*     TO OBTAIN A RECORD TO BE USED TO INSERT,UPDATE, OR          *             *     DELETE ROWS OF A TARGET TABLE.                              * 
*                                                                 * 
*   THIS PROGRAM IS NOT REENTRANT.                                * 
*   FUNCTION:                                                     * 
*          READ AN INPUT RECORD AND ADD A FOUR-BYTE INTEGER FIELD * 
*          THE FRONT OF THE RECORD. THE NEW FIELD WILL CONTAIN    * 
*          A SEQUENCE NUMBER WHICH RANGES FROM 1 TO ...           * 
*          NUMBER-OF-INPUT-RECORDS.                               * 
*                                                                 * 
*          RETURN TO THE CALLER (TPump) INDICATING                * 
*          EITHER MORE RECORDS ARE AVAILABLE OR NO MORE RECORDS   * 
*          ARE TO BE PROCESSED.                                   * 
*                                                                 * 
*  THIS INMOD PROGRAM CAN BE USED TO ENSURE UNIQUE RECORDS        * 
*  IN CERTAIN APPLICATIONS, THE SEQUENCE FIELD                    * 
*    CAN BE USED FOR “DATA SAMPLING”.                             * 
*                                                                 * 
*   DDNAME OF THE INPUT DATA SET: “INDATA”                        * 
*                                                                 * 
*******************************************************************
         B    STOREGS                  BRANCH AROUND EP
         DC   AL1(31)                  DEFINE EP LENGTH
         DC   CL9’DYNAMN  ’            DEFINE
         DC   CL9’&SYSDATE’               ENTRY
         DC   CL8’    VM ’                   POINT
         DC   CL5’&SYSTIME’                     IDENTIFIER
******************************************************************* 
*                   SAVE REGISTERS                                * 
******************************************************************* 	STOREGS  DS    0H                       DEFINE AND ALIGN SYMBOL
         STM   R14,R12,12(R13)          STORE OFF CALLER’S REGISTERS
         LR    R12,R15                  COPY BASE ADDRESS
         DROP  R15                      DROP VOLATILE BASE REGISTER
         USING DYNAMN,R12               ESTAB PERM CSECT ADDRBLTY
         LA    R14,SAVEAREA             POINT AT LOCAL SAVE WORK
         ST    R14,8(,R13)              STORE FWD LINK IN SA CHAIN
         ST    R13,4(,R14)              STORE BWD LINK IN SA CHAIN
         LR    R13,R14                  COPY LOCAL SAVE/WORK AREA
                                        ADDR
         L     R11,0(,R1)               POINT TO PARM
         SPACE 1
******************************************************************* 
*                OPEN  “DATA” DATA SET                            * 
*                       (ONLY THE FIRST TIME)                     * 
*******************************************************************
         USING PREBUF,R11               COVER PRE-PROC AREA
         LA    R9,PREREC                POINT TO START OF PREPROC.
                                        DATA
         OC    PRECODE,PRECODE          FIRST ENTRY ?
                                        (0=FIRST ENTRY)
         BNZ   NOOPEN                   NO, SKIP OPEN
         USING IHADCB,R10               YES,COVER DCB FOR OPEN
         LA    R10,INDATA               POINT TO DATA DCB
         OPEN  INDATA                   OPEN INPUT DATA SET
         TM    DCBOFLGS,X’10’           DID IT OPEN ?
         BO    OPENOK                   YES,
         WTO   ’UNABLE TO OPEN INDATA DATA SET’,ROUTCDE=11
         B     BADRET                   RETURN WITH ERROR CODE
******************************************************************* 
*         CHECK TPump STATUS CODES                                * 
* 0 =  FIRST ENTRY       (TPump EXPECTS TO RECEIVE A RECORD)      * 
* 1 =  GET NEXT RECORD   (TPump EXPECTS TO RECEIVE A RECORD)      * 
* 2 =  CLIENT RESTART CALL (TPump DOES NOT EXPECT A RECORD)       * 
* 3 =  CHECKPOINT CALL   (TPump DOES NOT EXPECT A RECORD)         * 
* 4 =  RESTART CALL      (TPump DOES NOT EXPECT A RECORD)         * 
* 5 =  CLOSE INMOD       (TPump DOES NOT EXPECT A RECORD)         * 
*                                                                 * 
*                                                                 * 
*    NOTE: CODES 2,3 AND 4 ARE NOT HANDLED BY THIS PROGRAM        * 
*                                                                 * 
******************************************************************* 	
OPENOK   DS    0H 
NOOPEN   L     R15,PRECODE              CHECK ON CODE FROM TPump
         C     R15,=F’1’                NEED RECORD ?
         BH    NOREC                    NO , DO NOT “GET” A RECORD
         L     R15,SAMPNUM              GET CURRENT SAMPLE NUM.
         LA    R15,1(R15)               INCR BY 1
         ST    R15,0(R9)                STORE AT FRONT OF RECORD
         ST    R15,SAMPNUM              RESET COUNTER
         LA    R9,4(R9)                 ADVANCE FOR READ ADDR.
         LA    R10,INDATA               COVER INDATA DCB
GETNEXT  GET   INDATA,(R9)              READ A RECORD
INCREC   LH    R9,DCBLRECL              GET RECORD LENGTH
         AH    R9,=H’4’                 ADD 4 FOR NEW FIELD
         SR    R15,R15                  SET RETURN CODE VALUE
RETURN   ST    R9,PRELEN                SET LENGTH (ZERO AFTER EOF) 
         ST    R15,PRECODE
         L     R13,4(R13)
         RETURN  (14,12),RC=0
         RETURN
         SPACE 5
*******************************************************************
*        EOF ENTERED AT END-OF-FILE                               *
*******************************************************************
*        EOF      CLOSE INDATA          CLOSE INPUT DATA SET      *
*******************************************************************
NOREC    SR    R15,R15                  SET ZERO RETURN CODE
         SR    R9,R9                    SET ZERO LENGTH
         B     RETURN                   RETURN
* 
BADRET   LA    R15,16                   SET RETURN CODE FOR ERROR
         SR    R9,R9                    SET LENGTH = 0 
         B     RETURN                   ERROR RETURN 
         EJECT
*
*        CONSTANTS
*
*        REGEQU
R0       EQU  0
R1       EQU  1
R2       EQU  2
R3       EQU  3
R4       EQU  4
R5       EQU  5
R6       EQU  6
R7       EQU  7
R8       EQU  8
R9       EQU  9
R10      EQU  10
R11      EQU  11
R12      EQU  12
R13      EQU  13
R14      EQU  14
R15      EQU  15
         EJECT 
* 
*        DATA STRUCTURES AND VARIABLES 
*
         SPACE 1
SAVEAREA DC    9D’0’                    SAVE AREA
SAMPNUM  DC    F’0’
         SPACE 10
INDATA   DCB   DDNAME=INDATA,MACRF=(GM),DSORG=PS,EODAD=EOF
PREBUF   DSECT
PRECODE  DS    F
PRELEN   DS    F
PREREC   DS    0XL31000
         DCBD  DEVD=DA,DSORG=PS
PREPRM   DSECT
PRESEQ   DS    F
PREPRML  DS    H
PREPRMS  DS    CL80
         END
//LKED.SYSLMOD DD DSN=JCK.INMOD.LOAD(INMODG1),DISP=MOD,UNIT=3380, 
//          VOLUME=SER=TSO805 
//LKED.SYSIN DD  *
 ENTRY DYNAMN 
 NAME INMODG1(R)
/* 
//TPUMPDEL   EXEC PGM=IEFBR14 
//TPUMPLOG   DD  DSN=JCK.INMOD.TDQ8.TPumpLOG, 
//         DISP=(MOD,DELETE),UNIT=SYSDA,SPACE=(TRK,0) 
//TPUMPCAT   EXEC PGM=TPUMP 
//STEPLIB  DD  DSN=STV.GG00.APP.L,DISP=SHR 
//         DD  DSN=STV.TG00.APP.L,DISP=SHR 
//         DD  DSN=STV.RG00.APP.L,DISP=SHR 
//SYSPRINT DD  SYSOUT=* 
//TPUMPLOG DD  DSN=JCK.INMOD.TDQ8.TPumpLOG,DISP=(NEW,CATLG), 
//         UNIT=SYSDA,DCB=(RECFM=F,DSORG=PS,LRECL=8244), 
//         SPACE=(8244,(12,5)) 
//SYSIN    DD  * 
//**********************************************************************
//* THIS STEP WILL ONLY DROP THE TABLES IF TPump IS NOT IN APPLY PHASE *
//**********************************************************************
//CREATE   EXEC BTEQ 
//STEPLIB  DD  DSN=STV.GG00.APP.L,DISP=SHR 
//         DD  DSN=STV.TG00.APP.L,DISP=SHR 
//         DD  DSN=STV.RG00.APP.L,DISP=SHR 
//SYSPRINT DD  SYSOUT=A 
//SYSABEND DD  SYSOUT=* 
//SYSIN    DD  DATA,DLM=## 
.LOGON TDQ8/DBC,DBC;
RELEASE TPump XXXX.INMODAS1;
.IF ERRORCODE = 2572 THEN .GOTO NODROP; 
DROP TABLE XXXX.LOGTABLE; 
DROP TABLE XXXX.ET_INMODAS1; 
DROP TABLE XXXX.UV_INMODAS1; 
DROP TABLE XXXX.WT_INMODAS1; 
.QUIT;
.LABEL NODROP;
.EXIT 4;
## 
//*****************************************************************
//*                                                               *
//*        RUN TPump                                              *
//*                                                               *
//*****************************************************************
//LOADIT   EXEC PGM=TPump 
//STEPLIB  DD  DISP=SHR,DSN=STV.GG10.APP.L 
//         DD  DISP=SHR,DSN=STV.GG00.APP.L 
//         DD  DISP=SHR,DSN=STV.TG00.APP.L 
//         DD  DISP=SHR,DSN=STV.RG00.APP.L 
//         DD  DISP=SHR,DSN=TER2.SASC301H.LINKLIB 
//         DD  DISP=SHR,DSN=JCK.INMOD.LOAD,VOLUME=SER=TSO805,UNIT=3380 
//SYSPRINT DD  SYSOUT=* 
//SYSTERM  DD  SYSOUT=* 
//SYSOUT   DD  SYSOUT=* 
//SYSIN    DD  DATA,DLM=## 
.LOGTABLE XXXX.LOGTABLE; 
.LOGON TDQ8/XXXX,XXXX; 
/*  TEST DATAIN, DATALOC          */ 
DROP TABLE XXXX.INMODAS1; 
CREATE TABLE INMODAS1 (F1 CHAR(10), F2 CHAR(70)); 
.BEGIN IMPORT TPump TABLES INMODAS1; 
.Layout layname1; 
.FIELD L1FLD0 1 CHAR(4); 
.FIELD L1FLD1 * CHAR(10); 
.Field L1Fld2 * Char(70); 
.DML Label DML1; 
INSERT INMODAS1(F1,F2) VALUES (:L1FLD1, :L1FLD2); 
.IMPORT INMOD INMODG1 USING (“AAA” “BBB”) LAYOUT LAYNAME1 APPLY DML1; 
.End LOAD; 
.LOGOFF; 
## 
//INDATA  DD DATA,DLM=## 
01ASSEMBLEAAAAAAAAAAAAAAAA 
02ASSEMBLEBBBBBBBBBBBBBBBB 
03ASSEMBLECCCCCCCCCCCCCCCC 
04ASSEMBLEDDDDDDDDDDDDDDDD 
## 
//SELECT   EXEC BTEQ 
//STEPLIB  DD  DSN=STV.GG00.APP.L,DISP=SHR 
//         DD  DSN=STV.TG00.APP.L,DISP=SHR 
//         DD  DSN=STV.RG00.APP.L,DISP=SHR 
//SYSPRINT DD  SYSOUT=A 
//SYSABEND DD  SYSOUT=* 
//SYSIN    DD  DATA,DLM=## 
.LOGON TDQ8/XXXX,XXXX; 
SELECT * FROM INMODAS1; 
.LOGOFF; 
## 
//