Heh - no payment required; JDEList is for FREE distibution of knowledge!
Snippet follows. PLEASE NOTE: I cannot see anywhere in the JDE docs that clearly states that this should work, so this may not always work in Service Packs post SP21 where I tested it. Don't sue me if in some future Sp this causes a table to be cleared of ALL records!
code follows. Unfortunately the indentation disappears in the cut&paste.
------------------------------
B580002.c:
#include <jde.h>
#define b580002_c
/*****************************************************************************
* Source File: b580002
*
* Description: Delete F573412 Records Source File
*
* History:
* Date Programmer SAR# - Description
* ---------- ---------- -------------------------------------------
* Author 16/02/04 OLIVERJ Unknown - Created
*
* Copyright (c) J.D. Edwards World Source Company, 1996
*
* This unpublished material is proprietary to J.D. Edwards World Source Company.
* All rights reserved. The methods and techniques described herein are
* considered trade secrets and/or confidential. Reproduction or
* distribution, in whole or in part, is forbidden except by express
* written permission of J.D. Edwards World Source Company.
****************************************************************************/
/**************************************************************************
* Notes:
*
**************************************************************************/
#include <b580002.h>
/**************************************************************************
* Business Function: DeleteFromF573412ByDateUpdated
*
* Description: Delete from From F573412 By Date Updated
*
* Parameters:
* LPBHVRCOM lpBhvrCom Business Function Communications
* LPVOID lpVoid Void Parameter - DO NOT USE!
* LPDSD580002A lpDS Parameter Data Structure Pointer
*
*************************************************************************/
JDEBFRTN (ID) JDEBFWINAPI DeleteFromF573412ByDateUpdated (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD580002A lpDS)
{
/************************************************************************
* Variable declarations
************************************************************************/
HUSER hUser = (HUSER) NULL;
HREQUEST hRequestF573413 = (HREQUEST) NULL;
ID idJDBReturn = (ID) JDEDB_PASSED;
/************************************************************************
* Declare structures
************************************************************************/
SELECTSTRUCT dsSelect[1];
/************************************************************************
* Declare pointers
************************************************************************/
/************************************************************************
* Check for NULL pointers
************************************************************************/
if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
(lpVoid == (LPVOID) NULL) ||
(lpDS == (LPDSD580002A) NULL))
{
jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, "4363", (LPVOID) NULL);
return ER_ERROR;
}
/************************************************************************
* Set pointers
************************************************************************/
/************************************************************************
* Main Processing
************************************************************************/
idJDBReturn = JDB_InitBhvr(lpBhvrCom,&hUser,(char *)NULL,
JDEDB_COMMIT_AUTO);
if( idJDBReturn == JDEDB_FAILED)
{
jdeSetGBRError( lpBhvrCom, lpVoid, (ID)0, "3143");
return ER_ERROR;
}
idJDBReturn = JDB_OpenTable(hUser, NID_F573413, 0, NULL,
(ushort)(0), (char *) NULL,
&hRequestF573413);
if( idJDBReturn == JDEDB_FAILED)
{
jdeSetGBRError( lpBhvrCom, lpVoid, (ID)0, "3143");
return ER_ERROR;
}
jdeNIDcpy(dsSelect[0].Item1.szDict, NID_UPMJ);
jdeNIDcpy(dsSelect[0].Item1.szTable, NID_F573413);
dsSelect[0].lpValue = &lpDS->jdDateUpdated;
dsSelect[0].nValues = 1;
dsSelect[0].nAndOr = JDEDB_ANDOR_AND;
dsSelect[0].nCmp = JDEDB_CMP_LT;
idJDBReturn = JDB_SetSelection(hRequestF573413,
dsSelect,
(ushort)1,
JDEDB_SET_REPLACE);
if( idJDBReturn == JDEDB_PASSED )
{
idJDBReturn = JDB_DeleteTable(hRequestF573413, NID_F573413,
(ID)0, (ID)NULL,
(void *)NULL,
(short) 0);
}
JDB_CloseTable(hRequestF573413);
JDB_FreeBhvr(hUser);
/************************************************************************
* Function Clean Up
************************************************************************/
return (ER_SUCCESS);
}
/* Internal function comment block */
/**************************************************************************
* Function: Ixxxxxxx_a // Replace "xxxxxxx" with source file number
* // and "a" with the function name
* Notes:
*
* Returns:
*
* Parameters:
**************************************************************************/