Showing posts with label batch file. Show all posts
Showing posts with label batch file. Show all posts

Wednesday, March 16, 2011

Calling an informatica workflow in a loop - Part 2

Please find Script Two below.  It is the script which is responsible for calling the workflow in a loop.

Script two:

 ::


:: Project : INTERFACES

:: Purpose : Ensures that files are processed one by one if multiple files are present in source folder

:: Author : allispossibleteam

:: Date Started : 14 May 2010

:: Date Completed: 25 May 2010

:: Usage : loopWorkflow.bat INTERFACE_CODE WORKFLOW_NAME MAX_NUM_OF_FILES EXTENSION_SOURCE_FILES

::





::@ ECHO OFF

SetLocal EnableDelayedExpansion



::

:: Interface Code (Received as parameter 1)

::

SET INTERFACE_CODE=%1



::

:: Workflow to execute (received as parameter 2)

::

SET WORKFLOW_NAME=%2



::

:: MAX number of files that will be allowed to be executed during one run of the bat file (RECEIVED AS PARAMETER 3) (SEND 0 [zero] FOR NO LIMITS)

::

SET MAX_NUM_OF_FILES=%3



::

:: Extension of source file (received as parameter 4)

::

SET EXTENSION_SOURCE_FILES=%4



::

:: INFORMATICA USERNAME, PASSWORWORD, SERVER IP, PORT NUMBER, FOLDER NAME CONTAINING MAPPING

::

SET INFY_USERNAME=Administrator

SET INFY_PASSWORD=Administrator

SET INFY_SERVER_IP=x.x.x.x

SET INFY_PORT_NUM=4001

SET INFY_FOLDER=XXXX



::

:: Path where log files are generated

::

SET PATH_OF_BATCH_FILE=E:\LOGS



::

:: Path containing the source file(s)

::

SET PATH_OF_SOURCE_FILES=E:\SOURCE_FILE





::

:: eXPECTED sOURCE fILE NAME FORMAT

::

SET SOURCE_FILE_NAME_FORMAT=%INTERFACE_CODE%_*.%EXTENSION_SOURCE_FILES%



::

:: Path for Temporary Folder where Source Files are copied

::

SET PATH_OF_SOURCE_FILES_TEMP=%PATH_OF_SOURCE_FILES%\TEMP_%INTERFACE_CODE%_CREATED_BY_BATFILE



::

:: Path and Name of Logfile

::

SET LOG_FILE=%PATH_OF_BATCH_FILE%\%INTERFACE_CODE%_LOOP_LOG.txt



::

:: Path for backup folder [Not used anymore - functionality disabled]

::

::SET BACKUP_FOLDER=%PATH_OF_SOURCE_FILES%\TEMP_BACKUP_%INTERFACE_CODE%_FILES_CREATED_BY_BATFILE



::

:: TO Allow workflow to execute even if previously it failed, PUT ANY OTHER CHARACTER EXCEPT CHARAcTER 'N'

::

SET ALLOW_WORKFLOW_TO_EXECUTE_WITH_PREVIOUS_STATUS_FAILED=N



::

:: To allow execution of workflow for other files even if workflow fails with one file, PUT ANY OTHER CHARACTER EXCEPT CHARAcTER 'N'

::

SET CONTINUE_EXECUTION_ON_WRKF_FAILURE=N



::

:: To enable prompting if overwriting an existing file in PATH_OF_SOURCE_FILES_TEMP, PUT ANY OTHER CHARACTER EXCEPT CHARAcTER 'N'

::

SET ENABLE_PROMPTING_IF_OVERWRITING=N



::

:: Time to wait (in Seconds) before startING workflow after file has been copied in the proper folder. This is to give sufficient time for file to be copied

::

SET TIME_TO_WAIT_B4_EXECUTING_WRKF=15



::

::====================== Set Variables above this line. Do NOT modify any code below this line. ==================================

::



::

:: Get todays date and place it in DAY, MONTH(numeric 01,02,03..12), MONTHN(Jan, Feb...Dec), YEAR(2007,2008, ...)

::

SET MYDATE=%date%

FOR /F "tokens=1-4 delims=/ " %%a in ("%MYDATE%") do (

SET DAY=%%c

SET MONTH=%%b

SET YEAR=%%d

)

SET TODAY=%YEAR%%MONTH%%DAY%



IF %MONTH%==01 SET MONTHN=Jan

IF %MONTH%==02 SET MONTHN=Feb

IF %MONTH%==03 SET MONTHN=Mar

IF %MONTH%==04 SET MONTHN=Apr

IF %MONTH%==05 SET MONTHN=May

IF %MONTH%==06 SET MONTHN=Jun

IF %MONTH%==07 SET MONTHN=Jul

IF %MONTH%==08 SET MONTHN=Aug

IF %MONTH%==09 SET MONTHN=Sep

IF %MONTH%==10 SET MONTHN=Oct

IF %MONTH%==11 SET MONTHN=Nov

IF %MONTH%==12 SET MONTHN=Dec



::

:: LOG START OF EXECUTION OF BATCH FILE AND ECHO TO SCREEN AS WELL

::

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Starting execution of batch file and hoping for its successful completion..............

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Starting execution of batch file and hoping for its successful completion..............





::

:: ERROR CHECK; Check if we have all required input parameters

::

IF %1.==. GOTO MISSING_PARAM_1

IF %2.==. GOTO MISSING_PARAM_2

IF %3.==. GOTO MISSING_PARAM_3

IF %4.==. GOTO MISSING_PARAM_4



::

:: ERROR CHECK; CHECK IF WORKFLOW HAD FAILED PREVIOUSLY

::

FOR /F "TOKENS=3 DELIMS=:[]" %%G IN ('pmcmd getworkflowdetails -s %INFY_SERVER_IP%:%INFY_PORT_NUM% -u %INFY_USERNAME% -p %INFY_PASSWORD% -f %INFY_FOLDER% %WORKFLOW_NAME% ^
find "Workflow run status:"') DO SET WORKFLOW_PREVIOUS_STATUS=%%G



IF %ALLOW_WORKFLOW_TO_EXECUTE_WITH_PREVIOUS_STATUS_FAILED%==N IF %WORKFLOW_PREVIOUS_STATUS%.==Failed. GOTO WORKFLOW_PREVIOUS_STATUS_FAILED



::

:: ERROR CHECK; CHECK IF SOURCE PATH EXISTS PATH_OF_SOURCE_FILES EXISTS

::

IF NOT EXIST %PATH_OF_SOURCE_FILES% GOTO PATH_OF_SOURCE_FILES_NOT_FOUND



::

:: cHECK IF PROMPTING REQUESTED B4 OVERWRITING FILE

::

IF %ENABLE_PROMPTING_IF_OVERWRITING%==N (

SET PROMPT_OPTION=Y

) ELSE (

SET PROMPT_OPTION=-Y

)



::

:: COPY ALL FILES FOUND IN PATH_OF_SOURCE_FILES TO PATH_OF_SOURCE_FILES_TEMP

::

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Moving All Files from %PATH_OF_SOURCE_FILES% to %PATH_OF_SOURCE_FILES_TEMP%

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Moving All Files from %PATH_OF_SOURCE_FILES% to %PATH_OF_SOURCE_FILES_TEMP%

FOR %%a in (%PATH_OF_SOURCE_FILES%\*.*) do (

>>%LOG_FILE% XCOPY "%%a" "%PATH_OF_SOURCE_FILES_TEMP%"\ /Z /I /H /K /%PROMPT_OPTION%

)



::

:: Delete copied Files

::

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Deleting All Files in %PATH_OF_SOURCE_FILES%

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Deleting All Files in %PATH_OF_SOURCE_FILES%

>>%LOG_FILE% DEL %PATH_OF_SOURCE_FILES%\*.* /Q



::

:: This variable counts total number of files loaded

::

SET TOTAL_FILES_LOADED=0



::

:: Used in case new files came in while the workflow was executing to allow the new files as well to be loaded. should be b4 the loop calling the workflow

::

:FOLDER_CHANGED_REDO



::

:: Call workflow for each file in directory PATH_OF_SOURCE_FILES_TEMP (HEART OF THE BAT FILE IS IN THIS LOOP, so handle with care please)

::

SET RETURNCODE=0

FOR %%a in (%PATH_OF_SOURCE_FILES_TEMP%\%SOURCE_FILE_NAME_FORMAT%) do (

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Moving any new Files from %PATH_OF_SOURCE_FILES% to %PATH_OF_SOURCE_FILES_TEMP%

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Moving any new Files from %PATH_OF_SOURCE_FILES% to %PATH_OF_SOURCE_FILES_TEMP%

SET FILE_COUNTER=0

FOR %%b in (%PATH_OF_SOURCE_FILES%\*.*) do (

>>%LOG_FILE% XCOPY "%%b" "%PATH_OF_SOURCE_FILES_TEMP%"\ /Z /I /H /K /%PROMPT_OPTION%

SET /a FILE_COUNTER=!FILE_COUNTER!+1

)

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Deleting All Files in %PATH_OF_SOURCE_FILES%

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Deleting All Files in %PATH_OF_SOURCE_FILES%

>>%LOG_FILE% DEL %PATH_OF_SOURCE_FILES%\*.* /Q

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] !FILE_COUNTER! new Files were found in %PATH_OF_SOURCE_FILES% and copied to %PATH_OF_SOURCE_FILES_TEMP%

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] !FILE_COUNTER! new Files were found in %PATH_OF_SOURCE_FILES% and copied to %PATH_OF_SOURCE_FILES_TEMP%

IF NOT !FILE_COUNTER!==0 GOTO FOLDER_CHANGED_REDO

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] About to move one file from %PATH_OF_SOURCE_FILES_TEMP% to %PATH_OF_SOURCE_FILES% and starting workflow

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] About to move one file from %PATH_OF_SOURCE_FILES_TEMP% to %PATH_OF_SOURCE_FILES% and starting workflow

>>%LOG_FILE% XCOPY "%%a" "%PATH_OF_SOURCE_FILES%"\ /Z /I

>>%LOG_FILE% DEL "%%a" /Q

:FILE_NOT_YET_DELETED

IF EXIST "%%a" GOTO FILE_NOT_YET_DELETED

CHOICE /T %TIME_TO_WAIT_B4_EXECUTING_WRKF% /D y

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Starting execution of workflow %WORKFLOW_NAME% with source file "%%a" ...

@ECHO Starting execution of workflow %WORKFLOW_NAME% with source file "%%a" ...

>>%LOG_FILE% pmcmd startworkflow -s %INFY_SERVER_IP%:%INFY_PORT_NUM% -u %INFY_USERNAME% -p %INFY_PASSWORD% -f %INFY_FOLDER% -nowait %WORKFLOW_NAME%

>>%LOG_FILE% pmcmd waitworkflow -s %INFY_SERVER_IP%:%INFY_PORT_NUM% -u %INFY_USERNAME% -p %INFY_PASSWORD% -f %INFY_FOLDER% %WORKFLOW_NAME%

SET RETURNCODE=!ERRORLEVEL!

IF ERRORLEVEL 1 IF %CONTINUE_EXECUTION_ON_WRKF_FAILURE%==N GOTO EXITLOOP

SET /a TOTAL_FILES_LOADED=!TOTAL_FILES_LOADED!+1

IF !MAX_NUM_OF_FILES! GTR 0 (

IF !TOTAL_FILES_LOADED!==!MAX_NUM_OF_FILES! (

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] MAX_NUM_OF_FILES[!MAX_NUM_OF_FILES!] has already been loaded. Exiting...

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] MAX_NUM_OF_FILES[!MAX_NUM_OF_FILES!] has already been loaded. Exiting...

GOTO EXITLOOP

)

)

)



::

:: Ensures cleanup scripts are executed in case of failure during execution of workflow

::

:EXITLOOP



::

:: ====================== FUNCTIONALITY REMOVED BELOW ==============================================================================================

::

:: DESC of OLD FUNCTIONALITY : Originally all files from source folder were being copied to the temp folder. After execution of the 'HEART' loop above,

:: if files remained in the temp folder, they were copied to a backup folder and the temp folder was deleted.

::

:: NEW FUNCTIONALITY: After execution of 'HEART' loop, if any files still remain in the temp folder, they are left there and the next time the interface is

:: is run, these files are run if they meet the proper file format

::



::

:: Copy any files remaining in %PATH_OF_SOURCE_FILES_TEMP% to %BACKUP_FOLDER%

::

::>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Copying any files remaining in %PATH_OF_SOURCE_FILES_TEMP% to %BACKUP_FOLDER%

::@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Copying any files remaining in %PATH_OF_SOURCE_FILES_TEMP% to %BACKUP_FOLDER%

::FOR %%a in (%PATH_OF_SOURCE_FILES_TEMP%) do (

::>>%LOG_FILE% XCOPY "%%a" "%BACKUP_FOLDER%"\ /Z /I /H /E /K /Y

::)

::

::

:: DELETING the DIRECTORY PATH_OF_SOURCE_FILES_TEMP

::

::>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Deleting temporary directory %PATH_OF_SOURCE_FILES_TEMP%

::@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Deleting temporary directory %PATH_OF_SOURCE_FILES_TEMP%

::RMDIR /S /Q %PATH_OF_SOURCE_FILES_TEMP%



::

:: ====================== FUNCTIONALITY REMOVED ABOVE ==============================================================================================

::



::

:: cHECK IF ERRORS OCCURED DURING EXECUTION OF WORKFLOWS AND LOG CORRESPONDING ERROR

::

@ECHO RETURNCODE IS %RETURNCODE%

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] RETURNCODE IS %RETURNCODE%

IF NOT %RETURNCODE%.==0. GOTO LEVEL%RETURNCODE%



::

:: No Errors occured. Skip error logging

::

GOTO END_OF_SCRIPT



::

:: Error Logging in case required parameters are missing OR Workflow failed

::

:MISSING_PARAM_1

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Missing Parameter 1; USAGE loopWorkflow.bat INTERFACE_CODE WORKFLOW_NAME MAX_NUM_OF_FILES EXTENSION_SOURCE_FILES

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Missing Parameter 1; USAGE loopWorkflow.bat INTERFACE_CODE WORKFLOW_NAME MAX_NUM_OF_FILES EXTENSION_SOURCE_FILES

GOTO END_OF_SCRIPT



:MISSING_PARAM_2

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Missing Parameter 2; USAGE loopWorkflow.bat INTERFACE_CODE WORKFLOW_NAME MAX_NUM_OF_FILES EXTENSION_SOURCE_FILES

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Missing Parameter 2; USAGE loopWorkflow.bat INTERFACE_CODE WORKFLOW_NAME MAX_NUM_OF_FILES EXTENSION_SOURCE_FILES

GOTO END_OF_SCRIPT



:MISSING_PARAM_3

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Missing Parameter 3; USAGE loopWorkflow.bat INTERFACE_CODE WORKFLOW_NAME MAX_NUM_OF_FILES EXTENSION_SOURCE_FILES

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Missing Parameter 3; USAGE loopWorkflow.bat INTERFACE_CODE WORKFLOW_NAME MAX_NUM_OF_FILES EXTENSION_SOURCE_FILES

GOTO END_OF_SCRIPT



:MISSING_PARAM_4

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Missing Parameter 4; USAGE loopWorkflow.bat INTERFACE_CODE WORKFLOW_NAME MAX_NUM_OF_FILES EXTENSION_SOURCE_FILES

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Missing Parameter 4; USAGE loopWorkflow.bat INTERFACE_CODE WORKFLOW_NAME MAX_NUM_OF_FILES EXTENSION_SOURCE_FILES

GOTO END_OF_SCRIPT



:WORKFLOW_PREVIOUS_STATUS_FAILED

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; %WORKFLOW_NAME% had failed in its previous run. To allow the workflow to execute even if the workflow had failed in its previous run, set the flag ALLOW_WORKFLOW_TO_EXECUTE_WITH_PREVIOUS_STATUS_FAILED to any other character except 'N' in the batch file.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; %WORKFLOW_NAME% had failed in its previous run. To allow the workflow to execute even if the workflow had failed in its previous run, set the flag ALLOW_WORKFLOW_TO_EXECUTE_WITH_PREVIOUS_STATUS_FAILED to any other character except 'N' in the batch file.

GOTO END_OF_SCRIPT



:PATH_OF_SOURCE_FILES_NOT_FOUND

@ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The path %PATH_OF_SOURCE_FILES% was not found!!!

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The path %PATH_OF_SOURCE_FILES% was not found!!!

GOTO END_OF_SCRIPT



:LEVEL1

@echo The PowerCenter Server is down, or pmcmd cannot connect to the PowerCenter Server. The TCP/IP host name or port number or a network problem occurred.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The PowerCenter Server is down, or pmcmd cannot connect to the PowerCenter Server. The TCP/IP host name or port number or a network problem occurred.

GOTO END_OF_SCRIPT



:LEVEL2

@echo The specified task name, workflow name, or folder name does not exist.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The specified task name, workflow name, or folder name does not exist.

GOTO END_OF_SCRIPT



:LEVEL3

@echo An error occurred in starting or running the workflow or task.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; An error occurred in starting or running the workflow or task.

GOTO END_OF_SCRIPT



:LEVEL4

@echo Usage error. You passed the wrong parameters to pmcmd.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Usage error. You passed the wrong parameters to pmcmd.

GOTO END_OF_SCRIPT



:LEVEL5

@echo An internal pmcmd error occurred. Contact Informatica Technical Support.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; An internal pmcmd error occurred. Contact Informatica Technical Support.

GOTO END_OF_SCRIPT



:LEVEL6

@echo An error occurred while stopping the PowerCenter Server. Contact Informatica Technical Support.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; An error occurred while stopping the PowerCenter Server. Contact Informatica Technical Support.

GOTO END_OF_SCRIPT



:LEVEL7

@echo You used an invalid username or password.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; You used an invalid username or password.

GOTO END_OF_SCRIPT



:LEVEL8

@echo You do not have the appropriate permissions or privileges to perform this task.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; You do not have the appropriate permissions or privileges to perform this task.

GOTO END_OF_SCRIPT



:LEVEL9

@echo The connection to the PowerCenter Server timed out while sending the request.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The connection to the PowerCenter Server timed out while sending the request.

GOTO END_OF_SCRIPT



:LEVEL12

@echo The PowerCenter Server cannot start recovery because the session or workflow is scheduled, suspending, waiting for an event, waiting, initializing, aborting, stopping, disabled, or running.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The PowerCenter Server cannot start recovery because the session or workflow is scheduled, suspending, waiting for an event, waiting, initializing, aborting, stopping, disabled, or running.

GOTO END_OF_SCRIPT



:LEVEL13

@echo The username environment variable is not defined.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The username environment variable is not defined.

GOTO END_OF_SCRIPT



:LEVEL14

@echo The password environment variable is not defined.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The password environment variable is not defined.

GOTO END_OF_SCRIPT



:LEVEL15

@echo The username environment variable is missing.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The username environment variable is missing.

GOTO END_OF_SCRIPT



:LEVEL16

@echo The password environment variable is missing.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The password environment variable is missing.

GOTO END_OF_SCRIPT



:LEVEL17

@echo Parameter file does not exist.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Parameter file does not exist.

GOTO END_OF_SCRIPT



:LEVEL18

@echo The PowerCenter Server found the parameter file, but it did not have the initial values for the session parameters, such as $input or $output.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The PowerCenter Server found the parameter file, but it did not have the initial values for the session parameters, such as $input or $output.

GOTO END_OF_SCRIPT



:LEVEL19

@echo The PowerCenter Server cannot start the session in recovery mode because the workflow is configured to run continuously.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The PowerCenter Server cannot start the session in recovery mode because the workflow is configured to run continuously.

GOTO END_OF_SCRIPT



:LEVEL20

@echo A repository error has occurred. Please make sure that the Repository Server and the database are running and the number of connections to the database is not exceeded.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; A repository error has occurred. Please make sure that the Repository Server and the database are running and the number of connections to the database is not exceeded.

GOTO END_OF_SCRIPT



:LEVEL21

@echo PowerCenter Server is shutting down and it is not accepting new requests.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; PowerCenter Server is shutting down and it is not accepting new requests.

GOTO END_OF_SCRIPT



:LEVEL22

@echo The PowerCenter Server cannot find a unique instance of workflow/session you specified. Enter the command again with the folder name and workflow name.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; The PowerCenter Server cannot find a unique instance of workflow/session you specified. Enter the command again with the folder name and workflow name.

GOTO END_OF_SCRIPT



:LEVEL23

@echo There is no data available for your request.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; There is no data available for your request.

GOTO END_OF_SCRIPT



:LEVEL24

@echo Out of memory.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Out of memory.

GOTO END_OF_SCRIPT



:LEVEL25

@echo Command is cancelled.

>>%LOG_FILE% ECHO [%DAY% %MONTHN% %YEAR% %TIME%] Execution ABORTED; Command is cancelled.

GOTO END_OF_SCRIPT





:END_OF_SCRIPT



::

:: Draw a line in log file to seperate it from logs of next run

::

>>%LOG_FILE% ECHO ===========================================================================================================================================================

EndLocal

@ ECHO ON

Thursday, May 27, 2010

Informatica: Error using PMCMD

Error: The connect request failed because the client application is trying to connect to server type [pmserver].  Repository server accepts only requests for server types REPSERVER and REPAGENT.

Issue Description: The project consisted of writing a batch file that would be able to call workflows in a loop.  However, each time we tried to execute a PMCMD command, it failed and we got the message "The connect request failed because the client application is trying to connect to server type [pmserver].  Repository server accepts only requests for server types REPSERVER and REPAGENT."

Issue Resolution: In our case, we were getting the error message because we were providing the wrong port number when executing the PMCMD command.  Once we used the correct port number, we were able to execute the PMCMD commands from our batch file and we managed to execute workflows in a loop.