Starting from:

$29.99

BCI433 Lab 7 Solution


- Update a master file with adds/changes and deletes from a transaction file
- Use a CLLE driver program to automate testing of the update program
- View the journaled changes made to the master file

Requirements to pass the lab:

All the parts for this application will be handed out. The RPGLE program, the CLLE driver program, and the master and transaction files. You need to adapt this application so you can update a master file in your own collection. Successfully run the CLLE program updating data in a collection created by you and be able to show the add, update and delete journaled changes.

Call RunLab7
SALESSTAF2 – data comes from SALESSTAFF in BCI433LIB


Transaction File SALESTRANS in BCI433LIB indicates adds, changes and deletes to your SALESTAFF table


Report on what occurred when implementing the updates from the transaction file


SALESTAFF after the updates were applied by your program



All the spooled files generated with meaningful names.



The transactions are journaled






Steps to successfully run lab 7

1. Create a source physical file called LAB7

2. Create a collection using parts of your id (mine is DM433B40 so I will use DM and B40. The U stands for update and is common for all ids.

CREATE COLLECTION DMUB40

3. Copy the provided code in BCI433LIB/Lab7Code. The PRTF is called UPDREPORT and can be copied and compiled. The RPGLE program is called SLSTRNPGM and the CLLE program is called RUNLAB7. Only a few lines of code need to be added to the CLLE driver program and the RPGLE program. Study these programs. The code has been supplied for both on the next pages and your teacher will supply the missing few lines in class. You will also need to change the CLLE code so it refers to your data, journal and output queue.


4. After you enter the missing code and make the necessary edits, you will compile the CLLE and RPGLE programs.

RPGLE program to apply the updates


DCL-F UPDREPORT PRINTER OflInd(*IN01);
DCL-F SALESTRANS DISK(*EXT) KEYED USAGE(*INPUT)
RENAME(SALESTRANS:SALESTRANR);
DCL-F SALESSTAF2 DISK(*EXT) KEYED
USAGE(*UPDATE : *OUTPUT : *DELETE);

DCL-DS FullKey ;
ADept CHAR(3);
ASalesId CHAR(4);
END-DS FullKey;

DCL-DS SalesTransDS;
TDept;
TSalesId;
TFName;
TLName;
TCity;
TAddress;
TPCode;
End-Ds SalesTransDs;

DCL-DS SalesStaf2DS;
Dept;
SalesId;
FName;
LName;
City;
Address;
PCode;
End-Ds SalesStaf2Ds;

WRITE HEADING;
READ SALESTRANS;
DOW NOT %EOF;

______________________________________________________

______________________________________________________

SELECT;

WHEN %FOUND(SALESSTAF2);
SELECT;
WHEN TCODE = 'C';
EXSR CHGREC;
WHEN TCODE = 'D';
EXSR DELREC;
OTHER;
EXSR ERROR;
ENDSL;

WHEN NOT %FOUND(SALESSTAF2);
IF TCODE = 'A';
EXSR ADDREC;
ELSE;
EXSR ERROR;
ENDIF;

WHEN %ERROR;
EXSR ERROR;
ENDSL;

IF *IN01 = *ON;
WRITE HEADING;
*IN01 = *OFF;
ENDIF;

WRITE DETAIL;
READ SALESTRANS;

ENDDO;
*INLR = *ON;
RETURN;

BEGSR ADDREC;

______________________________________________


______________________________________________


______________________________________________


ENDSR;
BEGSR CHGREC;


______________________________________________


______________________________________________


______________________________________________


ENDSR;
BEGSR DELREC;
DELETE SALESTFR;
ENDSR;
BEGSR ERROR;
TFNAME = 'UPDATE/DELETE/CHANGE';
TLNAME = 'E R R O R';
ENDSR;


CLLE driver program

/* This program will not work until have it refer to your own collection and userprofile */

PGM
DLTF DMUB40/SALESSTAF2
MONMSG MSGID(CPF2105)

______________________________________________________________________

______________________________________________________________________

______________________________________________________________________

______________________________________________________________________

CLROUTQ DM433B40

OVRPRTF FILE(QPQUPRFIL) SPLFNAME(BEFORE_UPD)
RUNQRY *NONE DMUB40/SALESSTAF2 *PRINTER

OVRPRTF FILE(QPQUPRFIL) SPLFNAME(SALESTRANS)
RUNQRY *NONE BCI433LIB/SALESTRANS *PRINTER

OVRPRTF FILE(QPRINT) SPLFNAME(UPDREPORT)
OVRDBF SALESSTAF2 DMUB40/SALESSTAF2
CALL SLSTRNPGM

OVRPRTF FILE(QPQUPRFIL) SPLFNAME(AFTER_UPD)
RUNQRY *NONE DMUB40/SALESSTAF2 *PRINTER

DSPSPLF BEFORE_UPD
DSPSPLF SALESTRANS
DSPSPLF UPDREPORT
DSPSPLF AFTER_UPD
WRKOUTQ DM433A40

DSPJRN JRN(DMUB40/QSQJRN) FILE((DTUB40/SALESSTAF2))
ENDPGM




More products