Monday, April 13, 2015

Single Index Creation Utility

Single Index Generation Utility
(JD Edwards XE):
Author: Zaki Ahmed
Have you ever had a need to add and generate an index to a file such as F0911 or any other file that contained millions of rows of data with multiple indices? How many hours did you have to wait until the index regeneration process finished? 4? 6? 8? May be more? Well, JD Edwards, by default drops/rebuilds all indices of a file even if you just wanted one index to be generated.  
The solution for this is pretty simple; utilizing business function called “Create Single Index” B9800200. This business function will solve our problem and will potentially save plenty of lost hours. 
Programming Logic:
1.       Add row Exit to P9866/W9866J – Single Index Generation
2.       Create a new form P9866/W9866B as follows:
a.       A new field “Index Identifier field” is added on this form. This will be the numeric value of index that user wants to generate.
b.      A row exit “Find Index ID” is added which users will use to identify the numeric value of the index that they need to generate.
Post Dialogue Initialized ER:
Form: PLXS_Generate Single Index [W9866B] -
Event: Post Dialog is Initialized
Event GUID: e1edaf02-23e1-4912-8c1d-0069d38a5328
00001 
-
GetDataSourceName(B98TAM.GetDataSourceName)

            FC Object Name -> szNameObject [OBNM]
            UNDEFINED <> idApplicationIDOW [APPLID]
            FC Data Source <- szServerDataSource [DATS]

00002 
-
GetDataSourceOwner(B9800202.GetDataSourceOwner)

            FC Data Source -> szDatabasepath [DATP]
            FC Object Owner ID <> szObjectownerid [OOWN]

Form Variables:
Form: PLXS_Generate Single Index [W9866B] -
Event: Form Variables
Event GUID: 10a3a5c4-0b65-41e6-8744-5427c756426f
frm_frm_cDoesTableExistYN [EV01]

Add a row exit – Find Index
HC Find Index ID -
Event: Button Clicked
Event GUID: f3570b02-46e2-4646-b7f4-1397cc5daa10
00001  Call App:P80010 Form:W80010B Version:<Blank>[]
            FC Object Name -> szNameObject [OBNM]
            UNDEFINED <> szTableDescription [DL01]

Add a push button – Generate Index
Event Rules:
FC Generate Index -
Event: Button Clicked
Event GUID: 5043ebe7-e5e3-458b-9b6d-57ccb2579813
----------------------------------------
Event Level Variables
----------------------------------------
evt_Description [DESC]
----------------------------------------
00001  //
00002  // ----------------------------------------------------------------
00003  // Check to see if the table exist, before generating index.
00004  // ----------------------------------------------------------------
00005 
-
DoesTableExist(B98403.DoesTableExist)

            FC Object Name -> szNameObject [OBNM]
            FC Data Source -> szServerDataSource [DATS]
            FC Object Owner ID -> szObjectOwnerID [OOWN]
            frm_frm_cDoesTableExistYN [EV01] <- cExistingObjectYOrN [EXOB]

00006  If frm_frm_cDoesTableExistYN [EV01] is equal to 'N'
00007  |    Call App:
P9866 Form:W9866C Version:<Blank>[]
       
|         UNDEFINED <> cButtonType [EV01]
       
|         UNDEFINED <> cReturn [EV01]
       
|         '9' -> idCaption [APPLID]
       
|         UNDEFINED <> szTextSub [GK]
       
|         'F' -> cIconType [EV01]
00008  |    Stop Processing
00009  Else
00010  |    // Does Index Exist?
00011  |   
-
DropSingleIndex(B9800200.DropSingleIndex)

       
|         FC Object Name -> szTableName [OBNM]
       
|         FC Index Identifier -> idIndexId [INID]
       
|         FC Data Source -> szDatabasePath [DATP]
       
|         FC Object Owner ID -> szObjectOwnerID [OOWN]
       
|         FC Password -> szSignonPassword [PSWD]
       
|         FC Math Numeric <- mnErrorNumber [MATH01]

00012  |   
-
CreateSingleIndex(B9800200.CreateSingleIndex)

       
|         FC Object Name -> szTableName [OBNM]
       
|         FC Index Identifier -> idIndexId [INID]
       
|         FC Data Source -> szDatabasePath [DATP]
       
|         FC Object Owner ID -> szObjectOwnerID [OOWN]
       
|         FC Password -> szSignonPassword [PSWD]
       
|         FC Math Numeric <- mnErrorNumber [MATH01]

00013  |    If SV Error_Status is equal to CO SUCCESS
00014  |    |    Call App:
P9866 Form:W9866C Version:<Blank>[]
       
|    |         UNDEFINED <> cButtonType [EV01]
       
|    |         UNDEFINED <> cReturn [EV01]
       
|    |         '6' -> idCaption [APPLID]
       
|    |         UNDEFINED <> szTextSub [GK]
       
|    |         'S' -> cIconType [EV01]
00015  |    Else
00016  |    |    Call App:
P9866 Form:W9866C Version:<Blank>[]
       
|    |         UNDEFINED <> cButtonType [EV01]
       
|    |         UNDEFINED <> cReturn [EV01]
       
|    |         '2' -> idCaption [APPLID]
       
|    |         UNDEFINED <> szTextSub [GK]
       
|    |         'S' -> cIconType [EV01]
00017  |    End If
00018  End If



No comments:

Post a Comment