PL/I INMOD Example
The INMOD in the following example reads the data from the input file and presents it as read to the Teradata FastLoad utility.
This basic program can be modified to select records that meet a specified criteria, convert certain fields, or perform other preprocessing functions.
BLKEXIT: PROC (PARM_LIST) OPTIONS(MAIN);
/* Routine name must always be BLKEXIT */
DCL EXPORT FILE RECORD INPUT;
DCL EOF FIXED BINARY (31,0) INIT (0);
DCL THIS_LENGTH FIXED BINARY (31,0);
DCL1 PARM_LIST,
10 STATUS FIXED BINARY (31,0),
10 RLENGTH FIXED BINARY (31,0),
10 CCDB_REC CHAR (80);
ON ENDFILE (EXPORT) EOF = 1;
IF STATUS = 3 /* disregard restarts and checkpoints */
THEN GO TO PROC_RETURN;
IF STATUS = 4 /* disregard restarts and checkpoints */
THEN GO TO PROC_RETURN;
IF STATUS = 2 /* client restart */
/*Note:STATUS values 2 , 3 and 4 are only applicable to
the FastLoad program. An INMOD program can be written
to interface with either FastLoad or Bulk Data Load ‑‑
STATUS values greater than ’1’ will not be set by the
Bulk Data Load program. */
THEN DO;
OPEN FILE (EXPORT);
GO TO PROC_RETURN;
END;
IF STATUS = 0 /* CHECK FOR FIRST‑TIME‑THRU CYCLE */
THEN DO;
OPEN FILE (EXPORT);
END;
RLENGTH = 80;
READ FILE (EXPORT) INTO (CCDB_REC);
IFEOF = 1
THEN DO;
CLOSE FILE (EXPORT);
STATUS=1; /* INDICATE EOF TO BDL OR FDL */
RLENGTH = 0;
GO TO PROC_RETURN;
END;
STATUS=0; /* INDICATE NEXT RECORD TO BDL OR FDL */
/* Additional processing can be done at this point */
PROC_RETURN:
END BLKEXIT ‘OPTIONS(MAIN)’;