COMPILE FUNCTION obj_SHELL(Method,Parms) /* Methods for SHELL table 07/09/2015 JCH - Initial Coding Properties: Methods: Create() ;* Creates new record in SHELL file Find() ;* Collector Window or Popup to select or find SHELL record keys */ * Subroutine Declaration * DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, ErrMsg, Btree.Extract * Function Declarations * DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, Dialog_Box * File Inserts * $INSERT MSG_EQUATES * Ad Hoc equates * EQU CRLF$ TO \0D0A\ * Setup for ErrMsg error handling routine * ErrTitle = 'Error in Stored Procedure "obj_SHELL"' ErrorMsg = '' * Checking for missing method IF NOT(ASSIGNED(Method)) THEN ErrorMsg = 'Unassigned parameter "Method" passed to subroutine' IF NOT(ASSIGNED(Parms)) THEN Parms = '' IF ErrorMsg NE '' THEN Set_Status(-1,ErrTitle:@SVM:ErrorMsg) ;* Push error onto STATUS stack and bail out RETURN '' END Result = '' * Object Dispatcher * BEGIN CASE CASE Method = 'Create' ; GOSUB Create CASE Method = 'Find' ; GOSUB Find CASE 1 ErrorMsg = 'Unknown Method ':QUOTE(Method):' passed to routine.' END CASE IF ErrorMsg NE '' THEN Set_Status(-1,ErrTitle:@SVM:ErrorMsg) ;* Push error onto STATUS stack and bail out RETURN '' END RETURN Result * * * * * * * Create: * * * * * * * Var1 = Parms[1,@RM] Var2 = Parms[COL2()+1,@RM] Var3 = Parms[COL2()+1,@RM] Var4 = Parms[COL2()+1,@RM] * Build the record here * * Sample call to obj_Tables to write a new or updated record * /* OtParms = 'COC':@RM:ShipNo:@RM:@RM:ShipRec obj_Tables('WriteRec',OtParms) IF Get_Status(errCode) THEN obj_Tables('UnlockRec',OtParms) END */ RETURN * * * * * * * Find: * * * * * * * * Routine to do look up of one or more keys to the SHELL file ShipKeys = Dialog_Box( 'COC_QUERY', @WINDOW, '' ) ;* Interface with user to get selection parameters, perform select and return keys CONVERT @FM TO @VM IN ShipKeys Result = ShipKeys RETURN