on 07-07-2015 11:48 PM
HI experts,
I am using a script by which I am creating a .txt file , a .csv file and a dynamic file from a source .pgp file. I have to do it in an existing job to reduce the manual works.
Problem here is all the file values ( like how i have wanted A.csv,A.txt,A20150702.csv is showing in the print statement ) are showing perfectly. But when I am trying to move those to another path it is throwing error.
49924 50964 RUN-050306 08-07-2015 00:29:33 Function <exec> failed to execute program <cmd.exe copy
49924 50964 RUN-050306 08-07-2015 00:29:33 "\\coopsap5001.coop.nnithosting.com\DATALOAD\DEV\DS_OUT\HCM_I_0121\ESBWLR15070208043100000087.csv""
49924 50964 RUN-050306 08-07-2015 00:29:33 "\\coopsap5001.coop.nnithosting.com\DATALOAD\DEV\DS_IN\HCM_I_0121">. Program terminated with exit code <1>.
But the values are showing as desired.
I think the values are not holding anywhere. I am pasting the code I am using. Pleasehelp me in this case as it is very urgent one.
print('********** DECRYPT STARTED ' || $PROCESS_FILENAME);
exec('cmd.exe', 'copy "'|| $INPUTDIR ||'\\' || $PROCESS_FILENAME || '" "' || $TEMP_WORK_DIR || '"');
#exec('cmd.exe', 'copy "'|| $INPUTDIR ||'\\' || $ESBWLR_FILENAME || '" "' || $TEMP_WORK_DIR || '"');
exec('gpg.exe', '--batch --yes --skip-verify --passphrase sapds20191010 --homedir "d:\gnupg" -o "' || $TEMP_WORK_DIR || '\\' || replace_substr($PROCESS_FILENAME, '.pgp', '.txt') || '" --decrypt "'|| $TEMP_WORK_DIR ||'\\' || $PROCESS_FILENAME || '"');
#exec('gpg.exe', '--batch --yes --skip-verify --passphrase sapds20191010 --homedir "d:\gnupg" -o "' || $TEMP_WORK_DIR || '\\' || replace_substr($ESBWLR_FILENAME, '.pgp', '.csv') || '" --decrypt "'|| $TEMP_WORK_DIR ||'\\' || $ESBWLR_FILENAME || '"');
print('********** DECRYPT COMPLETED ' || $PROCESS_FILENAME );
#print('********** DECRYPT COMPLETED ' || $ESBWLR_FILENAME );
IF (file_exists($TEMP_WORK_DIR || '\\' || $PROCESS_FILENAME) = 1)
begin
print( 'ESBWLR File found');
print('***** Moving file started *****');
exec('cmd.exe', 'move "' || $TEMP_WORK_DIR || '\\' || $PROCESS_FILENAME || '" "' || $OUTPUTDIR || '"');
#exec('cmd.exe', 'move "' || $TEMP_WORK_DIR || '\\' || $ESBWLR_FILENAME || '" "' || $OUTPUTDIR || '"');
print('***** Moving file completed *****');
wait_for_file($OUTPUTDIR || '\\ESBWLR*.pgp', 60, 30, 2, $INPUT_FILENAME , $PROCESS_FILE_COUNT, ';');
wait_for_file($OUTPUTDIR || '\\ESBWLR*.pgp', 60, 30, 2, $INPUT_FILENAME_TXT , $PROCESS_FILE_COUNT, ';');
wait_for_file($OUTPUTDIR || '\\ESBWLR*.pgp', 60, 30, 2, $INPUT_FILENAME_DYNAMIC , $PROCESS_FILE_COUNT, ';');
print('***** Copying file started *****');
$INPUT_FILENAME = replace_substr($INPUT_FILENAME, '/', '\\');
$INPUT_FILENAME_DYNAMIC = replace_substr($INPUT_FILENAME_DYNAMIC, '/', '\\');
$INPUT_FILENAME_TXT = replace_substr($INPUT_FILENAME_TXT, '/', '\\');
$OUTPUT_FILENAME = replace_substr(replace_substr( $INPUT_FILENAME , $OUTPUTDIR, ''), '\\', '');
$OUTPUT_FILENAME_DYNAMIC = replace_substr(replace_substr( $INPUT_FILENAME_DYNAMIC , $OUTPUTDIR, ''), '\\', '');
$OUTPUT_FILENAME_TXT = $Prefix_Filename || replace_substr(replace_substr( $INPUT_FILENAME_TXT , $OUTPUTDIR, ''), '\\', '');
print( 'OUTPUT filename ' || $OUTPUT_FILENAME );
print( 'OUTPUT filename text ' || $OUTPUT_FILENAME_TXT );
print( 'OUTPUT filename dynamic ' || $OUTPUT_FILENAME_DYNAMIC );
print( 'INPUT filename ' || $INPUT_FILENAME );
print( 'INPUT filename text ' || $INPUT_FILENAME_TXT );
print( 'INPUT filename dynamic' || $INPUT_FILENAME_DYNAMIC );
print('***** Copying file completed *****');
print('***** Renaming file started *****');
$OUTPUT_FILENAME_TXT = substr( $OUTPUT_FILENAME_TXT ,1,26 )|| '.txt"';
print('********** Renaming COMPLETED ' || $OUTPUT_FILENAME_TXT );
$OUTPUT_FILENAME = substr( $OUTPUT_FILENAME,1,26 )|| '.csv"';
print('********** Renaming COMPLETED ' || $OUTPUT_FILENAME );
$OUTPUT_FILENAME_DYNAMIC = substr( $OUTPUT_FILENAME_DYNAMIC ,1,26 )|| '.csv"';
print('********** Renaming COMPLETED ' || $OUTPUT_FILENAME_DYNAMIC );
print('***** Renaming file started *****');
#Dynamic Folder name creation started
$FILE_EXTRACT_DATE = substr( $OUTPUT_FILENAME_DYNAMIC ,7,6);
print( $FILE_EXTRACT_DATE );
$Prefix_Filename = '20'|| $FILE_EXTRACT_DATE || '_' || 'Ref.no' || $REFERENCE || '_' ;
print( $Prefix_Filename );
$OUTPUT_FILENAME_DYNAMIC = $Prefix_Filename || $OUTPUT_FILENAME_DYNAMIC ;
print( $OUTPUT_FILENAME_DYNAMIC );
#Dynamic Folder name creation completed
print('***** Copying file started *****');
exec('cmd.exe', 'copy "' || $OUTPUTDIR || '\\' || $OUTPUT_FILENAME || '" "' || $INPUTDIR || '"');
exec('cmd.exe', 'copy "' || $OUTPUTDIR || '\\' || $OUTPUT_FILENAME_TXT || '" "' || $INPUTDIR || '"');
exec('cmd.exe', 'copy "' || $OUTPUTDIR || '\\' || $OUTPUT_FILENAME_DYNAMIC || '" "' || $INPUTDIR || '"');
print('***** Copying file completed *****');
end
else
begin
print( 'go to next stage');
end
Thanks
Deb
Hi,
It could be a permission related issue. Can you first narrow down the problem by simply issuing the move command of an existing file rather than creating the file on the fly. Also test this file move directly from command line and outside of DS but using data services profile user.
Regards
Nawfal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.