Beruflich Dokumente
Kultur Dokumente
/*************************************************************************/
/* BGIv8UPG 06/04/2002 Cliff Miller Begin
*/
/* This is the pcode necessary to instantiate a CI session and pass all */
/* of the necessary data elements to the JOB_DATA component.
*/
/*************************************************************************/
/* VARIABLE DESCRIPTIONS
*/
/* --------------------------------------------------------------------- */
/*
*/
/* API Objects
*/
/* ======================================================================*/
/*
&Session
- Session objects controls security and error
*/
/*
handling.
*/
/*
*/
/*
&CI_JOB_DATA
- Component Interface for JOB_DATA pages
*/
/*
&COLL_JOBCol
- Collection (scroll) for JOB rowset
*/
/*
&COLL_JOBItm
- Individual row for collection JOBCol
*/
/*
&COLL_JOB_JRCol
- Collection (scroll) for JOB_JR rowset
*/
/*
&COLL_JOB_JRItm
- Individual row for collection JOB_JRCol
*/
/*
&COLL_COMPCol
- Collection (scroll) for COMPENSATION_WS rowset*/
/*
&COLL_COMPItm
- Individual row for collection COMPENSATION_WS */
/*
*/
/*
&PSMessages
- Collection (scroll) for error processing.
*/
/*
Contains all error messages generated by CI. */
/*
*/
/* Number Data Types
*/
/* ===================================================================== */
/*
&MaxRowNum
- Row number of the employee's max effdt'd row */
/*
from the PS_JOB collection.
*/
/*
&SQLUpdateEmplRcd - Variable to hold the &HP_JOB_STGE_TBL value
*/
/*
for the EMPL_RCD field for use in the UPDATE */
/*
PS_EMPLOYMENT DML (&SQLUpdate object).
*/
/*
&SQLArrayIDX
- SQL cursor array element index.
*/
/*
*/
/* String Data Types
*/
/* ===================================================================== */
/*
&SQL_Emplid
- Contains the EMPLID from the HP_JOB_STGE_TBL */
/*
working storage record.
*/
/*
&FileDirectory
- Set to file system path for entire AE process.*/
/*
&FileName
- Set to log/error file name for AE process.
*/
/*
&PriorAction
- Variable in prior PAY/MSI fetch -- accepts the*/
/*
PS_JOB.ACTION column value.
*/
/*
&PriorReason
- Variable in prior PAY/MSI fetch -- accepts the*/
/*
PS_JOB.ACTION_REASON column value.
*/
/*
*/
/* Date Data Types
*/
/* ===================================================================== */
/*
&SQL_Effdt
- Set to the ACTION_DT field value from the
*/
/*
HP_JOB_STGE_TBL working storage record.
*/
/*
&NewEffdt
- Set to the EFFDT field value from the
*/
/*
HP_JOB_STGE_TBL working storage object.
*/
/*
&SQLUpdateLastDt
- Variable to hold the &HP_JOB_STGE_TBL value
*/
/*
for the LAST_INCREASE_DT field for use in the */
/*
UPDATE PS_EMPLOYMENT DML (&SQLUpdate object). */
/*
*/
/* File Data Types
*/
/* ===================================================================== */
/*
&ErrorFile
- Error file object (physical data file resides */
/*
on UNIX server).
*/
/*
*/
/* Boolean Data Types
*/
/* ===================================================================== */
/*
&Error
- Switch to allow specific error branching.
*/
/*
*/
/* SQL Data Types
*/
/* ===================================================================== */
/*
&SQLCursor
- The SQL select block to retrieve the data from*/
/*
the HP_JOB_STGE_TBL DB table.
*/
/*
&SQLUpdate
- The DML update block to set the last increase */
/*
date on PS_EMPLOYMENT.
*/
/*
*/
/* Record Data Types
*/
/* ===================================================================== */
/*
&HP_JOB_STGE_TBL
- Virtual representation of the HP_JOB_STGE_TBL */
/*
that acts as working storage for the SQL
*/
/*
object to fetch data into.
*/
/*
&ArrayRecord
- Temporary record to accept SQL cursor data.
*/
/*
*/
/* Array Data Types
*/
/* ===================================================================== */
/*
&SQLArray
- Record array to hold SQL cursor data.
*/
/*************************************************************************/
Local ApiObject &Session, &CI_JOB_DATA, &COLL_JOBCol, &COLL_JOBItm, &COLL_JOB_JRCol, &COLL_JOB_JRItm, &COLL_COMPCol,
&COLL_COMPItm, &PSMessages;
Local
Local
Local
Local
Local
Local
Local
Local
/************************************************************************/
/* Function: CheckErrorCodes
*/
/************************************************************************/
Function CheckErrorCodes()
/************************************************************************/
/*Increment the error count variable to be reported in 8100 section
*/
/*This number reflects the total number of rows rejected by the CI.
*/
/************************************************************************/
HP_HP9999_AET.AE_SQLROWS = HP_HP9999_AET.AE_SQLROWS + 1;
&PSMessages = &Session.PSMessages;
/* Write out the offending record */
&ErrorFile.WriteLine(" ");
&ErrorFile.WriteLine(&HP_JOB_STGE_TBL.GetField(Field.EMPLID).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.EMPL_RCD).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.EFFDT).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.EFFSEQ).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.DEPTID).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.JOBCODE).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.ACTION).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.ACTION_DT).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.ACTION_REASON).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.JOB_ENTRY_DT).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.DEPT_ENTRY_DT).Value | "
" | &HP_JOB_STGE_TBL.GetField(Field.FLSA_STATUS).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.ELIG_CONFIG1).Value | "
" | &HP_JOB_STGE_TBL.GetField(Field.ELIG_CONFIG2).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.ELIG_CONFIG3).Value |
" " | &HP_JOB_STGE_TBL.GetField(Field.EMPL_TYPE).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.SAL_ADMIN_PLAN).Value
| " " | &HP_JOB_STGE_TBL.GetField(Field.GRADE).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.GRADE_ENTRY_DT).Value |
" " | &HP_JOB_STGE_TBL.GetField(Field.RATING_SCALE).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.REVIEW_RATING).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.COMP_FREQUENCY).Value | "
" | &HP_JOB_STGE_TBL.GetField(Field.CHANGE_AMT).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.COMP_RATECD).Value | "
" | &HP_JOB_STGE_TBL.GetField(Field.LAST_INCREASE_DT).Value | " " | " FAILED to Process");
&ErrorFile.WriteLine(" ");
&Session.PSMessages.DeleteAll();
End-Function;
/************************************************************************/
/* File Handling
*/
/* -------------------------------------------------------------------- */
/* Absolute file path: /opt/psoft/(dbname)/bgidir/site/tools/logs
*/
/* Mode - A string indicating the manner in which to access the file.
*/
/*
"R" = Read Mode - opens file for reading, starting at begining*/
/*
"W" = Write Mode - opens file for writing and any existing
*/
/*
content in the file is discarded
*/
/*
"A" = Append mode - opens the file for writing, starting at
*/
/*
at the end. Any existing content is saved.
*/
/*
"U" = Update mode - Opens the file for reading or writing,
*/
/*
starting at the end. Any existing content is retained. */
/* Open the error file first and assign the file layout.
*/
/* If the data file exists, open it and assign the file layout to it.
*/
/************************************************************************/
&FileName = HP_HP9999_AET.FILENAME;
&FileDirectory = HP_HP9999_AET.FILE_OUTPUT_DIR;
&File = &FileDirectory | &FileName;
&ErrorFile = GetFile(&File, "A", %FilePath_Absolute);
/************************************************************************/
/* Initialize Variables
*/
/************************************************************************/
&Error = False;
/************************************************************************/
/* Get Current Session
*/
/************************************************************************/
&Session = %Session;
If None(&Session) Then
&ErrorFile.WriteLine("Could not establish CI PeopleSoft session!!");
Exit 1;
End-If;
&Session.PSMessagesMode = 1;
/************************************************************************/
/* Establish the Job Data component interface and set std properties
*/
/* GetHistoryItems - set to false since MODE=INSERT
*/
/* InteractiveMode - set to false for better performance (batch load)
*/
/************************************************************************/
&CI_JOB_DATA = &Session.GetCompIntfc(Component.CI_JOB_DATA);
If &CI_JOB_DATA = Null Then
&ErrorFile.WriteLine("Job Data Component Interface Object Not Established!!");
Exit 1;
Else
&CI_JOB_DATA.InteractiveMode = False;
&CI_JOB_DATA.GetHistoryItems = False;
/***********************************************************************/
/* These 4 blocks of code perform the following function:
*/
/* 1. Establish the SQL cursor to be used for fetching rows from the */
/*
HP_JOB_STGE_TBL table (a SQL meta string).
*/
/* 2. Create a temporary record object to fetch the cursor data into,*/
/*
create an Array to accept the data in the temp. record object, */
/*
and set the Array element index to 1 (first item).
*/
/* 3. Fetch rows into the virtual &ArrayRecord, populate the Array
*/
/*
with data from the record object, and reset the record object */
/*
so that it's ready to accept the next fetch.
*/
/****************************************************************************************/
/* Set Create Key of CI to EMPLID being fetched from HP_JOB_STGE_TBL in 5100 AE section */
/****************************************************************************************/
&CI_JOB_DATA.Cancel();
&CI_JOB_DATA.KEYPROP_EMPLID = &HP_JOB_STGE_TBL.GetField(Field.EMPLID).Value;
If Not &CI_JOB_DATA.Get() Then
CheckErrorCodes();
&Error = True;
End-If;
/****************************************************************/
/* If the employee being processed has already had a PAY/MSI
*/
/* processed for them (in the current pay period), then simply */
/* bypass them by setting the &Error variable to True.
*/
/****************************************************************/
&SQL_Emplid = &HP_JOB_STGE_TBL.GetField(Field.EMPLID).Value;
SQLExec("SELECT J1.ACTION, J1.ACTION_REASON FROM PS_JOB J1 WHERE J1.EMPLID = :1 AND J1.EMPL_RCD = 0 AND J1.EFFDT
= (SELECT MAX(J2.EFFDT) FROM PS_JOB J2 WHERE J2.EMPLID = J1.EMPLID AND J2.EMPL_RCD = J1.EMPL_RCD AND J2.EFFDT BETWEEN
(SYSDATE - 14) AND SYSDATE) AND J1.EFFSEQ = (SELECT MAX(J3.EFFSEQ) FROM PS_JOB J3 WHERE J3.EMPLID = J1.EMPLID AND
J3.EMPL_RCD = J1.EMPL_RCD AND J3.EFFDT = J1.EFFDT)", &SQL_Emplid, &PriorAction, &PriorReason);
If &PriorAction = "PAY" And
&PriorReason = "MSI" Then
&Error = True
End-If;
/****************************************************************/
/* Set the Component Interface Properties that are changing (or */
/* the fields/columns provided by the users in the HP6000 input */
/* file).
*/
/****************************************************************/
If Not &Error Then
/* Set COLL_JOB Collection Field Properties -- Parent: PS_ROOT Collection */
&COLL_JOBCol = &CI_JOB_DATA.COLL_JOB;
&NewEffdt = &HP_JOB_STGE_TBL.GetField(Field.EFFDT).Value;
&MaxRowNum = &COLL_JOBCol.GetEffectiveItemNum(&NewEffdt, 1);
/**************************************************************/
/* Compute EFFSEQ if a row with the same effdt already exists.*/
/**************************************************************/
&SQL_Effdt = &HP_JOB_STGE_TBL.GetField(Field.ACTION_DT).Value;
&SQL_Emplid = &HP_JOB_STGE_TBL.GetField(Field.EMPLID).Value;
SQLExec("SELECT %dateout(J1.EFFDT), MAX(J1.EFFSEQ) FROM PS_JOB J1 WHERE J1.EMPLID = :1 AND J1.EFFDT =
%datein(:2) GROUP BY EFFDT", &SQL_Emplid, &SQL_Effdt, &MaxEffdt, &MaxEffseq);
If &MaxEffdt = &NewEffdt Then
&NewEffSeq = (&MaxEffseq + 1);
&ErrorFile.WriteLine(" ");
&ErrorFile.WriteLine("Job Data Row Exists with Same EFFDT date as this record for: " |
&HP_JOB_STGE_TBL.GetField(Field.EMPLID).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.EFFDT).Value | "
| " ===> " | "New EffSeq will be set to : " | &NewEffSeq);
&ErrorFile.WriteLine(" ");
Else
&NewEffSeq = 0;
End-If;
/****************************************************************/
" | &MaxEffseq
/****************************************/
/* Save Instance of Component Interface */
/****************************************/
If Not &CI_JOB_DATA.Save() Then
CheckErrorCodes();
&Error = True;
End-If;
/*****************************************************************************/
/* Log the record that was just processed if it went through the CI cleanly. */
/*****************************************************************************/
If Not &Error Then
&ErrorFile.WriteLine(&HP_JOB_STGE_TBL.GetField(Field.EMPLID).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.EMPL_RCD).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.EFFDT).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.EFFSEQ).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.DEPTID).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.JOBCODE).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.ACTION).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.ACTION_DT).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.ACTION_REASON).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.JOB_ENTRY_DT).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.DEPT_ENTRY_DT).Value | "
" | &HP_JOB_STGE_TBL.GetField(Field.FLSA_STATUS).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.ELIG_CONFIG1).Value | "
" | &HP_JOB_STGE_TBL.GetField(Field.ELIG_CONFIG2).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.ELIG_CONFIG3).Value |
" " | &HP_JOB_STGE_TBL.GetField(Field.EMPL_TYPE).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.SAL_ADMIN_PLAN).Value
| " " | &HP_JOB_STGE_TBL.GetField(Field.GRADE).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.GRADE_ENTRY_DT).Value |
" " | &HP_JOB_STGE_TBL.GetField(Field.RATING_SCALE).Value | " " |
&HP_JOB_STGE_TBL.GetField(Field.REVIEW_RATING).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.COMP_FREQUENCY).Value | "
" | &HP_JOB_STGE_TBL.GetField(Field.CHANGE_AMT).Value | " " | &HP_JOB_STGE_TBL.GetField(Field.COMP_RATECD).Value | "
" | &HP_JOB_STGE_TBL.GetField(Field.LAST_INCREASE_DT).Value | " " | " Processed OK");
/*************************************************************************/
/* Update the Last Increase Date field for the employee being processed. */
/*************************************************************************/
&SQLUpdate = CreateSQL("Update PS_EMPLOYMENT SET LAST_INCREASE_DT = %datein(:1) WHERE EMPLID = :2 AND
EMPL_RCD = :3");
&SQLUpdateEmplRcd = &HP_JOB_STGE_TBL.GetField(Field.EMPL_RCD).Value;
&SQLUpdateLastDt = &HP_JOB_STGE_TBL.GetField(Field.LAST_INCREASE_DT).Value;
&SQLUpdate.Execute(&SQLUpdateLastDt, &SQL_Emplid, &SQLUpdateEmplRcd);
&SQLUpdate.Close();
/*************************************************************************/
/*Increment the total CI processed count variable to be reported in 8100 */
/*This number reflects the total number of rows successfully processed by*/
/*the CI_JOB_DATA comp. interface.
*/
/*************************************************************************/
HP_HP9999_AET.EXECUTE_COUNT = HP_HP9999_AET.EXECUTE_COUNT + 1;
End-If;
End-If;
&SQLArrayIDX = &SQLArrayIDX + 1
End-While;
End-If;
/*************************************************************************/
/* BGIv8UPG 06/04/2002 Cliff Miller End
*/
/*************************************************************************/