datastage parameter for file directory not working - etl

I am creating an extract from sequential file. I created a parameter with the correct file location and when I try to "View Data", it says it can't find the file. If I hard code the location it finds the file and I am able to "View Data".
example:
#filedirectory# = aaa/bbb/ccc/
so my entry for "File" is #filedirectory#filename.txt and this does not work
however, the following does work
aaa/bbb/ccc/filename.txt
Any ideas what would cause this?

Try using the absolute path. Start with a / and the root directory.
Second point is that the parameter itself does not have "#". The "#" are only needed to reference it - in the Sequential File stage. So name it filedirectory when you define it in the job.
Recommendation:
As filedirectory will probably be used throughout your project I recommand using a ParameteSet.

I had the same issue, and it happened I forgot to include the directory parameter before the file parameter. Hope this information helps someone.

Related

caffeine simulator: could not find file: WebSearch1.spc.bz2

I'm simulating in Caffeine's simulator a sequence of a several traces, of different formats.
However, when trying to run Umass storage traces I get errors, e.g.:
Could not find file: WebSearch2.spc.bz2
I guess that the problem dwells in some combination of the format, path, and filename.
E.g., when writing in the .conf file:
paths = ["lirs:loop.trace.gz"]
the format is "lirs", and indeed there's a file
\simulator\src\main\resources\com\github\benmanes\caffeine\cache\simulator\parser\lirs\loop.trace.gz
so this works fine.
Similarly, I created under \parser a sub-directory named "umass-storage", and downloaded there the file WebSearch2.spc.bz2, and then wrote in the .conf file:
paths = ["umass-storage:WebSearch2.spc.bz2"]
I tried also unzipping the file, and then use paths = ["umass-storage:WebSearch2.spc"]
as well as a few other combinations, but all of them give the error above.
To discover the trace files automatically they have to be placed in the same package as its trace reader. In this case it would be ../parser/umass/storage. However, since it is a large file you might not want to include it in you repository. Instead, you can specify the absolute path and keep the files in an external directory.
OK, thanks to Ben I solved it, and got the tiny trick here.
For most traces it's enough to write merely the format name (which is also the directory name), e.g.:
paths = ["lirs:loop.trace.gz"]
However, umass traces include 2 sub-cases (storage / network). Hence it works (at least for me) only when stating the file's full path, e.g.,
paths = ["umass-storage:/Users/ben/Documents/traces/umass/WebSearch2.spc.bz2"

Command Prompt: Move a file to an Unknownly named folder

So, is there a possible way to move Test.txt to C:\ProgramData\CsD2\Tools\("Unknown Folder Name")\data\per Using command prompt?
using foxidrives solution for your previous question for detecting the correct directory, then just
move test.txt "%folder%\"
Short answer: yes. Not quite sure what the situation is that has left only the middle part of your path unknown, and the need to use the comnand line, but I have encountered similar cases on Linux and expect the algoirthm can be adapted to Windows commands. It's possible to do this by hand rather than writing a shell script, but it's up to you and your skills.
Permissions matter. Make sure you elevate yours enough to read and write in Tools before continuing.
First, change directory to C:\ProgramData\CsD2\Tools\
Presumably there are many items here. Some may be "hidden," so list the contents of this directory and be sure to include an option to show hidden files and folders. If you can, restrict the search to directories only.
It's tempting to display contents recursively in the above step. It's up to you, but I find it makes the output cluttered without a script to do the rest of the work.
Now it's time to search for the subfolder set that theoretically only exists in your target folder. Suppose Tools contains the directories fldr1, fldr2, and fldr3. Use your command to list a directory's contents with the path "fldr1\data\per", then use "fldr2\data\per", and so on until it doesn't return an error. Per may be empty, but that should look different from the path not found error.
Now you've found the name of your mystery folder. Write it down for future reference.
At thus point, you know the path to Test.txt, and the full path to the destination directory. Do a move command to relocate Test.txt, and you're done. I like to relist the contents of the target directory after to be comfortable that it arrived.

How to browse for file (Win7/64bits)

I need to quickly write a simple GUI over a command line application. Two steps are required:
Specify an input file path,
Specify an output file path (non existing)
I found out a previous post, however trying to get the above (1) to work seems like an insane task.
Indeed BrowseForFolder seems to only work in some weird cases, you can use BIF_BROWSEINCLUDEFILES for only *.pdf and/or *.txt (trial and errors). I can get an error if I select a *.dll and/or a *.jpg (don't ask).
So instead, I gave up this approach and followed another one, in this case (objIE.Document.all.FileSelect), only the name of the selected file is returned the path seems to be always set to "c:/fakepath" for some reason. So again I am missing the full path to be able to pass that to the command line app.
Is there any sane way (<10 lines of codes) to get (1) and (2) working on Win7/64bits (VBS, HTA...)?
Don't know if people are still interested in the BrowseForFolder file selection issue, but here's what I've found.
I had the same issue selecting files with BrowseForFolder using &H4000 / BIF_BROWSEINCLUDEFILES. I could get a return with .docx but not .doc files and as you say .pdf files.
For me .txt wouldn't return anything, as didn't WMI Backup .rec files that I needed for a script I'm writing, resulting in this error information:-
Error: Unspecified error
Code: 80004005
Source: (null)
After looking at other solutions I came back to this one as my preferred choice, plus it was doing my head in that it didn't want to work. So at the bitter end it seems to be this easy.
To get my .rec files recognized I add this to the registry:-
[HKEY_CLASSES_ROOT\.rec]
#="WMI.Backup"
[HKEY_CLASSES_ROOT\WMI.Backup]
#="WMI Backup"
"BrowseInPlace"="1"
To get .txt files recognized I add this to the registry:-
[HKEY_CLASSES_ROOT\txtfile]
"BrowseInPlace"="1"
So "BrowseInPlace"="1" seems to be the nugget.
Seems so unbelievably easy that I'm sure this solution is out there somewhere but I never came across it so thought I'd put it online.
I would be interested to find that it works for others as I fear that this issue may of sent me mad, still can't believe it seems to work.
Hope this helps.
Here are 3 different ways to do what you want:
http://www.robvanderwoude.com/vbstech_ui_fileopen.php

How do I know which include path will be used in PHP?

When I run phpinfo() and look by the Configuration category under PHP Core, I see a directive titled include_path, with a local value and a master value.
In this case, my local value is set to
.:
./include:
../include:
/usr/share/php:
/usr/share/php/smarty:
/usr/share/pear
and my master value is set to
.:
/usr/share/php:
/usr/share/pear:
/usr/share/php/pear:
/usr/share/php/smarty
The reason I am trying to learn how this works is because there is a file in the system I am working on titled Smarty.class.php, which I'm sure sounds very familiar to anyone who uses Smarty Templating Engine.
One of the PHP files has the following includes:
require_once("Smarty.class.php");
require_once("user_info_class.inc");
The file user_info_class.inc is in the same directory as the file making the include, which makes perfect sense to me, and is the way that I've always referenced files. I decided that I wanted to open up the Smarty.class.php file and had assumed it would be in the same directory, but it was not.
After doing a bit of digging, I discovered those php_ini variables, and was finally able to locate the file in the directory usr/share/php/smarty/.
So it would seem that when making an include, it follows some sort of order between the Local and Master values for the include_path.
Assuming that my deductions were correct thus far, can someone explain the order in which PHP searches for the files to be included?
The global value is basically what's set in php.ini. The local value is what's currently being used. The local value completely overwrites the master value.
According to the manual, PHP checks the paths in the order that they are specified in the include_path setting: http://php.net/manual/en/ini.core.php#ini.include-path

Dynamically saving file location

I have an asp.net app and I am trying to save a text file to a folder that changes with each client. How can I write it to save the files to a folder that changes. For example one customer might be C:\inetpub\wwwroot\site1\ another might be C:\inetpub\wwwroot\site2.
Relative paths don't seem to work, and I've tried GetCurrentDirectory but it kept giving me the wrong directory.
Thanks
You should try :
In the *.aspx.cs file :
string currentPath = Server.MapPath("~");
I don't have the tools to test here, but I think the code is right.
Take a look at Path.GetDirectoryName(Request.ServerVariables("SCRIPT_NAME")).
You should add a value to the web.config file which is set to the path where the file is saved.
Then, in you code, retrieve this value from the documentation, and use that path when saving.

Resources