//**** START OF SPECIFICATIONS *****************************************00010000 //* *00020000 //* MODULE NAME = APSUC04X *00030000 //* *00040000 //* $MOD (APSUC04X) COMP(APS) PROD(PSF) : VERSION 3.3.0 *00050000 //* *00060000 //* DESCRIPTIVE NAME = Logical Record Installation Exit Example *00070000 //* (Line data records) *00080000 //* *00090000 //* STATUS = Version 3, Release 3, Level 0 *00100000 //* *00110000 //* FUNCTION = *00120000 //* *00130000 //* This is installation sample exit APSUX04X written in C. *00140000 //* *00150000 //* Add records to the input line data *00160000 //* *00170000 //* OPERATION = *00180000 //* 1. Clear the storage in the APSUECA work buffer. *00190000 //* 2. Build the index, index entries, and records for the current *00200000 //* record and the added records. *00210000 //* 3. Update the PSF processing indicator to 'write records in *00220000 //* index'. *00230000 //* 4. Update the index pointer in parameter list APSGEXTP. *00240000 //* *00250000 //* NOTES = *00260000 //* DEPENDENCIES = None *00270000 //* RESTRICTIONS = *00280000 //* This example will not process blank or short line records. *00290000 //* The data must be long enough to contain the modification *00300000 //* field, modrec. *00310000 //* *00320000 //* MODULE TYPE = Procedure *00330000 //* PROCESSOR = C *00340000 //* ATTRIBUTES = Reentrant *00350000 //* AMODE 31 *00360000 //* RMODE ANY *00370000 //* *00380000 //* ENTRY POINT = APSUC04 *00390000 //* LINKAGE = *00400000 //* One parameter is passed - the address of APSGEXTC *00410000 //* *00420000 //* INPUT = *00430000 //* APSGEXTC - PSF installation exit paramater area *00440000 //* *00450000 //* OUTPUT = *00460000 //* Index and records in the APSUECA *00470000 //* *00480000 //* EXIT NORMAL = Return to caller *00490000 //* *00500000 //* EXIT ERROR = None *00510000 //* *00520000 //* EXTERNAL REFERENCES = *00530000 //* ROUTINES = None *00540000 //* DATA AREAS = *00550000 //* APSGEXTC - PSF installation exit parameter area *00560000 //* APSUECAC - PSF exit communications area *00570000 //* APSUIDXC - JES record index *00580000 //* *00590000 //* MACROS = None *00600000 //* *00610000 //* MESSAGES = None *00620000 //* *00630000 //* CHANGE ACTIVITY = *00640000 //* $B0=LAPS0008, HPRF320, 000107, BDKUEAS: Initial Version @B0A*00650000 //* $EV=LAPS0009,HPRF330,010530,BUQ4RLB: Version 3.3.0 @EVA*00660000 //* *00670000 //**** END OF SPECIFICATIONS *******************************************00680000 00690000 #pragma comment(date) 00700000 #pragma csect(CODE,"$APSUC04") 00710000 #pragma csect(STATIC,"#APSUC04") 00720000 #pragma linkage(APSUC04,OS) 00730000 #pragma runopts(TRAP(OFF)) 00740000 #pragma map(apsuc04,"APSUC04") 00750000 00760000 /*--------------------------------------------------------------------- 00770000 #include these header files for structure & function definitions: 00780000 ---------------------------------------------------------------------*/ 00790000 00800000 #include "apsgextc.h" 00810000 #include "apsuecac.h" 00820000 #include "apsuidxc.h" 00830000 00840000 /*--------------------------------------------------------------------- 00850000 Constants 00860000 ---------------------------------------------------------------------*/ 00870000 00880000 #define numidxe 3 // Number of index entries 00890000 #define write 0x09 // Write with space control 00900000 #define reclen 36 // Length of added record (length(RECCC) 00910000 // + length(RECTEXT)) 00920000 #define indexid "IDX " // Used for index header ID 00930000 #define recid "APSUC04 " // Used for record ID 00940000 #define modrec "THIS RECORD WAS MODIFIED BY APSUC04" 00950000 // Used to modify current record 00960000 #define recinfo "THIS RECORD WAS INSERTED BY APSUC04" 00970000 // Used to build added records 00980000 /*--------------------------------------------------------------------- 00990000 Declarations 01000000 ---------------------------------------------------------------------*/ 01010000 01020000 typedef unsigned char byte; // Used for pointer arithmetic 01030000 01040000 IAZIDX * idxptr; // Ptr to new IAZIDX 01050000 IDXENTRY * idxeptr; // Ptr to new index entry 01060000 NEWREC * recptr; // Ptr to data portion of record 01070000 01080000 void apsuc04(APSGEXTP * xtpptr) 01090000 { 01100000 01110000 idxptr = (IAZIDX *)&(xtpptr->XTPECAP->ECABASE.ECAWKBUF); 01120000 // Set address of new index 01130000 idxeptr = (IDXENTRY *)((byte *)idxptr + IDXSIZ); 01140000 // Set ptr to 1st index entry 01150000 01160000 /*--------------------------------------------------------------- 01170000 Clear work area. The work area will contain the index header, 01180000 3 index entries followed by 2 added records. 01190000 ---------------------------------------------------------------*/ 01200000 memset(idxptr, 0, 300); // Clear work area 01210000 01220000 /*--------------------------------------------------------------- 01230000 Build the index header 01240000 ---------------------------------------------------------------*/ 01250000 memcpy(idxptr->IDXID, indexid, strlen(indexid)); 01260000 // Set index header ID 01270000 idxptr->IDXNUM = numidxe; // Set number of entries 01280000 01290000 /*--------------------------------------------------------------- 01300000 Copy the first index entry and modify the current record. 01310000 This entry points to the modified current record. 01320000 01330000 Set the record address and length in the IDX. This is 01340000 necessary for 'spanned' records. For 'spanned' records, the 01350000 original IDX points to the last section of the 'spanned' record. 01360000 This IDX must point to the entire record. 01370000 ---------------------------------------------------------------*/ 01380000 memcpy(idxeptr,xtpptr->XTPRIXP,IDXESIZ); 01390000 // Copy old PSF index entry to new entry 01400000 idxeptr->IDXRECL = xtpptr->XTPRECL; 01410000 // Set record length 01420000 idxeptr->IDXRADR = xtpptr->XTPRECP.XTPRECP04; 01430000 // Set record address 01440000 memcpy((byte *)xtpptr->XTPRECP.XTPRECP04 + 1, modrec, 01450000 strlen(modrec)); 01460000 // Modify the current record data, 01470000 // see the warning information in 01480000 // restrictions area of the 01490000 // specifications above 01500000 01510000 /*--------------------------------------------------------------- 01520000 Build the second index entry and first added record 01530000 ---------------------------------------------------------------*/ 01540000 recptr = (NEWREC *)((byte *)idxeptr + (IDXESIZ * numidxe)); 01550000 // Set ptr to first added record 01560000 // IDXEPTR currently points to the first 01570000 // index entry. Since we're building 3 01580000 // index entries, we multiply IDXESIZ 01590000 // by numidxe (3), to get to the end of 01600000 // the 3 entries, where we want to build 01610000 // the first added record 01620000 idxeptr = (IDXENTRY *)((byte *)idxeptr + IDXESIZ); 01630000 // Set ptr to second entry 01640000 idxeptr->IDXENTRL = IDXESIZ; 01650000 // Set entry length 01660000 idxeptr->IDXRECL = reclen; // Set record length 01670000 idxeptr->IDXRADR = recptr; 01680000 // Set record address 01690000 idxeptr->IDXFLAG1 = IDXLMR + IDXMACH; 01700000 // Set record type to line data using 01710000 // machine character 01720000 memcpy(idxeptr->IDXRECID, recid, strlen(recid)); 01730000 // Set record id 01740000 recptr->reccc = write; // Set control to write with space 01750000 memcpy(recptr->rectext,recinfo, strlen(recinfo)); 01760000 // Complete new record text 01770000 01780000 /*--------------------------------------------------------------- 01790000 Build the third index entry and second added record 01800000 ---------------------------------------------------------------*/ 01810000 recptr = (NEWREC *)((byte *)recptr + reclen); 01820000 // Adjust pointer to 2nd new record 01830000 idxeptr = (IDXENTRY *)((byte *)idxeptr + IDXESIZ); 01840000 // Adjust ptr to third entry 01850000 idxeptr->IDXENTRL = IDXESIZ; 01860000 // Set entry length 01870000 idxeptr->IDXRECL = reclen; // Set record length 01880000 idxeptr->IDXRADR = recptr; 01890000 // Set record address 01900000 idxeptr->IDXFLAG1 = IDXLMR + IDXMACH; 01910000 // Set record type to line data using 01920000 // machine character 01930000 memcpy(idxeptr->IDXRECID, recid, strlen(recid)); 01940000 // Set record id 01950000 recptr->reccc = write; // Set control to write with space 01960000 memcpy(recptr->rectext,recinfo, strlen(recinfo)); 01970000 // Complete new record text 01980000 01990000 /*--------------------------------------------------------------- 02000000 Update the installation exit parameter list 02010000 ---------------------------------------------------------------*/ 02020000 xtpptr->XTPPIND = XTWRTIX; // Set PSF processing indicator to 02030000 // write records in index 02040000 02050000 xtpptr->XTPRIXP = idxptr; 02060000 // Update pointer to newly created index 02070000 // header 02080000 02090000 return; // Return with no error 02100000 02110000 } // End of main routine 02120000 02130000