GAMS: Filename cannot be used as valid UEL - replace

I trying to merge a large data set in gams. The file should consist of multiple gdx files with several names. The programme merges the files as I would like them to however: it replaces the names of the file to be merged with File_1, File_2, File_3 and so on. I would like to see the name of the gdx file in the merged file (and so far the script I wrote worked fine).
I'm receiving the following error for each line:
***Filename cannot be used as a valid UEL
Existing name: ImpactYesPGTNoLDViolation-D1-PG10-LDI-LDE0.001-LB0.0045-PDC0-D10
Replaced with File_1
Why does this happen? Could it be that the existing name is too long? I tried finding out more about this error but so far have not found any information on it. And is there anyway to fix it? I need the information of the existing name in order to further process the output.

You are right. This name is too long to be used as UEL (aka label). You can only use up to 63 characters. You can read more about this and other limitations for UELs here

Related

Rename files sequentially keeping "connected" file names pattern using regular expressions

I'm trying to reorganize photo library that contains edited files as well as originals. I already achieved desired folder structure using Exif Sorter, i.e %UserProfile%\Photos\%year%\%month%\%day%.
Each %day% folder contains photo image files with a little bit different name pattern:
IMG_0001.jpg
ZMGM00002.jpg
ZMGM00003 (Edited).jpg
ZMGM00003.jpg
IMG_0002 (Edited).jpg
IMG_0002.jpg
IMG_0004.jpg
I'd like files to be named sequentially but keeping relevant " (Edited)" suffix:
DSC_0001.jpg
DSC_0002.jpg
DSC_0002 (Edited).jpg
DSC_0003.jpg
DSC_0004 (Edited).jpg
DSC_0004.jpg
DSC_0005.jpg
So far I came up with regular expression to rename "*.jpg" and "* (Edited).jpg" preserving it's "suffix" part when it's there (" (Edited)") (sorry I use RegexRenamer because I'm beginner):
match string ^(\D+)(_)?(\d+)(Edited)?
replace string DCS_$#$4
However I get sequential numbering across all files and thus the relevance of edited files is lost:
DSC_0001.jpg
DSC_0002.jpg
DSC_0003 (Edited).jpg
DSC_0004.jpg
DSC_0005 (Edited).jpg
DSC_0006.jpg
DSC_0007.jpg
Is there any way I can rename files and preserve filename "connection" pattern between them, i.e. so I get DSC_0002 (Edited).jpg & DSC_0002.jpg instead of DSC_0002 (Edited).jpg & DSC_0003.jpg?
Since I've got thousands of folders, the renaming should be recourse & sequence should restarted with each new folder. I believe this requires PowerShell or batch scripting that will determine required condition but I'm not sure where to start. I am open to ideas like maybe I could process file names via Excel first and then batch-rename from TXT/CSV file.
P.S. I've got like 80000 family photos since late 90's, it would take ages to process by hand. I can run anything in Windows and macOS to solve this (would prefer Windows though).

i have headers separately, how to import it to informatica target

I have source and target in an informatica powercenter developer. I heed some other header name to be imported in the target file automatically without any manual entry. How can I import customized headers to informatica target.
What have you tried?
You can use a header command in the session configuration for the target, I haven't used it, and couldn't find any documentation on it (i.e. what is possible and how, whether parameters can be used or not, etc.). I did test using (on Windows) an ECHO command to output its text to the header row, but it didn't seem to recognize parameters.
Or you can try to include the header as the first data output row. That means your output will have to be all string types and length restrictions may compound the issue.
Or you can try using two mappings, one that truncates the files and writes the header and one which outputs the data specifying append in the session. You may need two target definitions pointing to the same files. I don't know if the second mapping would attempt to load the existing data (i.e. typecheck), in which case it might throw an error if it didn't match.
Other options may be possible, we don't do much with flat files.
The logic is,
In session command, there is an option called user defined headers. Type echo followed by column name separated by comma delimited
echo A, B, C

Creating users for game(reading and parsing CSV file)

So I am working on a planets vs zombies type mock up game for class, and am using Qt Creator GUI with C++. One of the things that we are required to do is, on start-up, the game window will attempt to read two files: "pvz_levels.csv" and "pvz_players.csv" from a pre-specified home directory.
The levels file is of the form "level:sequence:rows:start:interval:decrement" and "sequence" itself is a comma separated list of the form (1,1,1,2,3,1,3,1,3,3) which is the sequence in which zombies appear. If this file does not exist in the directory, the program exits with an error.
The players file is of the form "timestamp:player:level"; the time of last play, name of player, and last attempted level, respectively. If this file does not exist, the program silently skips this operation and starts as a new player. If it does exist, the file must be read and parsed, and then used in the program for calculations and such.
So, I am having much trouble with reading and parsing these files. Furthermore, we are required to save the user data in these files, and on the next start-up the user should have the option to continue their game by selecting their respective user from a drop-down list. They should also be able to delete any users.
I am proficient enough with c++ basics but this is my first GUI experience and my prof did not go over it in much detail, so I require quite a bit of help with this project.
Thank you to anyone who is able to help!
Look up the code to an available "csv parser" which stands for "comma separated variable". You need is almost identical, except you use a semi-colon instead of a comma. It seems that by changing one character you parsing is done for you.
You may be able to find a csv parser that accepts the character to be used as the parsing character (I've seen them before).
If you wish I can find a suitable csv parser for your use, but now that you know what you're looking for "csv parser c++ code" it should be a quick Google away.
Also, most csv parsers expect strings to be enclosed to double quotes (") but that is easily modifable.
Some hints:
Just open the File using QFile. Set up a QTextStream and use QTextStream::readLine() to read all Lines into QStringList. Now use QString::split() on the QString saved in the list to get the single values stored in this line. From there you can easily use QString::to* functions to cast the values into your desired type.
For saving just reverse the procedure.
Set up a line using: QString("%1,%2,%3").arg(timestamp).arg(player).arg(level) and put it into your QTextStream. If the stream is connected to a file, this will be written into the file.
I've implemented successfully the CSV reading like this:
std::unique_ptr<QFile> csv_worker(new QFile(resource_path));
QTextStream input_csv(csv_worker.get());
QList<QStringList> data
while(!input_csv.atEnd())
{
//removes the carriage return symbol and splits the elements
QStringList line = input_csv.readLine().remove(QRegExp("\r")).split(","); //replace here with :
data << line;
}
csv_worker->close();
It reads the complete file, each line generates a QStringList.
For the second element in the QStringList, let's say (1,1,1,2,3,1,3,1,3,3}, you have to additionally split that in a sub-QStringList, removing then brackets with something like this:
QStringList sequence = data[i][1].remove(QRegExp("{")).remove(QRegExp("}")).split(",");

Name exported files with names list from txt-file using command prompt

I have a tons of files and I want to convert them to other format using command prompt.
After exporting each of converted files program needs to name it.
I have a txt-documnet, that contains a list of future file-names.
So, I really need to name exported files one by one using first string name, then second string name, then third and so on.
EXAMPLE I have files to import in the directory
00001.umg
00002.umg
00003.umg
00004.umg
00005.umg
00006.umg
00007.umg
(and so on)
I have a txt document looking like this
Great name.brt
Wonderful.brt
Most beautiful.brt
Beautiful File.brt
Random File.brt
Define.brt
Excellent file.brt
...
(and so on)
So, after convertion I need to have exported files named like string in txt document in proper direction. First file must take first TXT string name, second - second string.....
Thank you!

Specifying Source file name using parameter variables in informatica 9?

I have a mapping like
SA-->SQ--->EXPR--->TGT
The source will be of the same structure and the tartget also.
There are a bunch of files(with the same structure) which will go through this mapping .
So i want to use a parameter file through which i will give the file names for every run manually.
How to use the param file in session for Source filename attribute
Please suggest..
you could use indirect source type, wherein your source file is basically a list of files, and in turn the session reads each of the files one by one.
the parameter file could reference a source file name (the list) as
$InputFile_myName=/a/b/c.list
In line with what Raghav says, indicate the name of a file that will hold a list of input files in the 'Source filename' property box for the SQ in question in the Mapping tab, making the file 'Source filetype' be 'Indirect', specified in the Session Properties. If you already know ahead of time the names of the input files, you can specify them in that file and deploy that file with the workflow to the location you indicate in the 'Source file directory' property box. However if you won't know the names of the input files until run-time but know the files' naming standard (e.g: "Input_files_name_ABC_" where "" represents variable text, such as a numeric value incremented per input file generated by some other process), then one way to deal with that is to use a Pre-Session Command specifiable in the 'Components' tab of the Session. Create one that will build a new file at the location and with the name specified for the Indirect input file referenced above by using the Unix shell (or if running on Windows, the cmd shell) to list the files conforming to the naming standard for them and redirect the listing output to that file.
Tricky thing is that there must be one or more files listed in that Indirect type of input file. If that file is empty, the workflow will fail (abend). An Indirect file type must have in it listed at least one file (even if that file is empty) and that file must exist. The workflow fails if the indirect file reader gets no files to read from or if a file listed in it is not present on the server to be read from. One way to get around this is to make sure an empty file is present at all times that conforms to the naming standard. This can be assured by creating a "touchfile" before executing the listing command to build the Indirect file type listing file. In Unix, you'd use the 'touch {path}/{filename}' command ({filename} could be, for example, "Input_files_name_ABC_TOUCHFILE"), or on Windows you'd redirect an empty string to a file likewise named via cmd shell process. Either way, that will help you avoid an abend. Cleaning up that file is easy to do: a Post-Session command can be used to delete the empty touchfile. Likewise, you can do the same for the Indirect type of file if desired.