********************************************************************** * To Compile: * * CRTBNDRPG PGM(xxx/CSTMNTFREE) SRCFILE(xxx/QRPGLESRC) * ********************************************************************** FCustomer UF A E K Disk D CustomerData E DS ExtName(Customer:CustRec) D CustData S Like(CustomerData) D Valid S N D Total S 5S 0 Inz(0) D StatusCode S 5S 0 Inz(0) D RecordLock C Const(01218) D Result2Big C Const(00103) C *Entry Plist C Parm CustData /free Monitor; CustomerID = %SubSt(CustomerData:1:8); DoU %Status <> RecordLock; Chain CustomerID Customer; EndDo; If %Found; ExSr Validate; If Valid; Total = Total + 1; // Accumulate number of udates Update Custrec; // update record format EndIf; Else; ExSr Validate; If Valid; Write Custrec; // write to record format EndIf; Endif; // Begin error trapping for any error with Monitor group On-Error RecordLock; // Record Lock Dsply 'Record Locked - Sorry Charlie'; On-Error *FILE; // Any other file error StatusCode = %Status; Dsply StatusCode; Dsply 'Some File Error'; On-Error Result2Big; // Field not large enough Dsply 'Define the result big enough, goofy'; On-Error *PROGRAM; // Any other program error StatusCode = %Status; Dsply StatusCode; Dsply 'Some Program Error'; On-Error *ALL; // Any error not already trapped Dsply 'Already trapping *FILE and *PROGRAM - do not need'; EndMon; *InLr = *On; // **************************************************************** // Validate subroutine - validate data before updating // **************************************************************** BegSr Validate; CustomerData = CustData; Valid = *on; // Some validation, eh? EndSr; /end-free