Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input Override

Status
Not open for further replies.

MPTC

MIS
Dec 12, 2003
22
0
0
US
I am using the following in a rule to run a compiled map.

=VALID(RUN("FtpPut.mmc", "-IE1S" + NUMBERTOTEXT(SIZE(RoutingData)) + " " + TEXT(RoutingData) + " -IF2 " + SUBSTITUTE(SUBSTITUTE(GETRESOURCENAME(RoutingData), GETDIRECTORY(RoutingData), ""), ".txt", ".837")), FAIL ( " Failure on RUN function for FtpPut.mmc. Return Code = " + TEXT ( LASTERRORCODE ( ) ) + ": " + LASTERRORMSG ( ) ) )

This works if I put the file specified by the file input override (IF2) in the directory of the compiled map, but I need to specify the directory in which the file exists. I have tried specifying the directory for IF2 in both UNC and using a drive letter but with no success. Below is one of the attempts to specify the directory.

=VALID(RUN("FtpPut.mmc", "-IE1S" + NUMBERTOTEXT(SIZE(RoutingData)) + " " + TEXT(RoutingData) + " -IF2 s:\Outgoing\" + SUBSTITUTE(SUBSTITUTE(GETRESOURCENAME(RoutingData), GETDIRECTORY(RoutingData), ""), ".txt", ".837")), FAIL ( " Failure on RUN function for FtpPut.mmc. Return Code = " + TEXT ( LASTERRORCODE ( ) ) + ": " + LASTERRORMSG ( ) ) )

The documentation says that I must specify the directory if the file is not in the directory of the compiled map but there is no example. Does anyone have any suggestions?

Thanks

Clint
 
A post in a different thread in this forum caused me to question the directory I have been using. The acutal directory I have been using contains some folders that contain a space. The directory is s:\Information Technology\Software Systems\EDI\Outgoing. Is there special syntax to handle the spaces?
 
From my experience using spaces in file and/or path names is likely to cause problems. We've simply made a standard of no spaces. Concatinate or use underscore. ie...

s:\InformationTechnology\SoftwareSystems\EDI\Outgoing

or

s:\Information_Technology\Software_Systems\EDI\Outgoing

Not a Java developer (and still think its a bug) but isn't there a similar issue with Java paths?

eyetry

PS: Also, keep in mind that, using Windows, there is a command line limit. Unneccessary bytes in a path could cause a run/put statement to fail. Shouldn't be an issue with what you have above but add some cards or variables......

Mercator claimed they were working on the issue. Not sure if Ascential has or can address it. Sounds like a DOS limitation.

 
put quotes round the path with spaces in it.
 
Thanks eyetry and janhes for your suggestions. Putting quotes around the directories with spaces makes sense because I have run into that before using the FILE adapter. However, it just doesn't seem to work in this case. I don't know if there is a confict with the RUN function and/or the input overrides. I have also run into problems with spaces using the Open PGP adapter. I'll post a solution if I find one. Thanks again.
 
=VALID(RUN("FtpPut.mmc", "-IE1S" + NUMBERTOTEXT(SIZE(RoutingData)) + " " + TEXT(RoutingData) + " -IF2 s:\Outgoing\" + SUBSTITUTE(SUBSTITUTE(GETRESOURCENAME(RoutingData), GETDIRECTORY(RoutingData), ""), ".txt", ".837")), FAIL ( " Failure on RUN function for FtpPut.mmc. Return Code = " + TEXT ( LASTERRORCODE ( ) ) + ": " + LASTERRORMSG ( ) ) )


Not sure your rule is correct. GETRESOURCENAME returns the full path of the file eg G:\Project Files\Current Projects\Regulation\Regulation 2003\KFI\Mercator\XXX999XEXTRACT1.OK

I think you need something like

=VALID(RUN("FtpPut.mmc", "-IE1S" + NUMBERTOTEXT(SIZE(RoutingData)) + " " + TEXT(RoutingData) + " -IF2 s:\Outgoing\" + WORD(REVERSEBYTE(word(REVERSEBYTE(getfilename(RoutingData)),"\",1)),".",1) + ".txt" + ".837"), FAIL ( " Failure on RUN function for FtpPut.mmc. Return Code = " + TEXT ( LASTERRORCODE ( ) ) + ": " + LASTERRORMSG ( ) ) )

This would give you a path of s:\Outgoing\filename.txt.837.
If you want the full path of the input file minus the drive letter you could do
reversebyte(word(reverersebyte(word(RoutingData,":\",2)),".",2))

That would give you s:\outgoing\full path without drive letter.txt.837

If you need quotes around the path use

=VALID(RUN("FtpPut.mmc", "-IE1S" + NUMBERTOTEXT(SIZE(RoutingData)) + " " + TEXT(RoutingData) + " -IF2 ""s:\Outgoing\" + WORD(REVERSEBYTE(word(REVERSEBYTE(getfilename(RoutingData)),"\",1)),".",1) + ".txt" + ".837"""), FAIL ( " Failure on RUN function for FtpPut.mmc. Return Code = " + TEXT ( LASTERRORCODE ( ) ) + ": " + LASTERRORMSG ( ) ) )


 
Oops forgot the getresourcename.

reversebyte(word(reverersebyte(word(getresourcename(RoutingData),":\",2)),".",2))
 
Thanks janhes, I'll give this a try and let you know how it works.
 
If you are using a current version of the product; dump the old 1.4.2 syntax and use ECHOIN. You need single quotes around filenames etc. with spaces, not quotes. Might be a lot easier to use resource registry for the directory path if you can't hard code it.



BocaBurger
<===========================||////////////////|0
The pen is mightier than the sword, but the sword hurts more!
 
BocaBurger, would that also apply to the IF as well as the IE command? It is the IF command that will not work with directories containing spaces. I tried single quotes and the map will not build because it thinks that directory is a type. The color changes from blue to green. I have also tried single quotes inside double quotes but no success there.

I have been in touch with Ascential support and their first response was that this issue has been reported before. They wanted to know which version of the software I am using (6.7.1(306)). I have not yet received a response from this yet. I will pass on what they have to say.

Thanks for the input.

Clint
 
If you are in contact with Ascential support, you are in good hands (I work there too). :) Syntax for map rules where quotes and single quotes are needed is a big pain somtimes. The way I feel is, if the program is smart enough to know what you types is wrong, and it knows what it needs it should suggest a possible answer. It is like the phone company message "you must dial a 1 before this number", sheesh, if I forgot the 1 and they know it is required, then just add it and connect me.



BocaBurger
<===========================||////////////////|0
The pen is mightier than the sword, but the sword hurts more!
 
BocaBurger,

The response from Ascential has been that this problem has been reported before and it is a shortcoming in the software. Ascential is planning on putting a fix into a patch but I have not received a time estimate on its completion.

Other than the OpenPGP adapter and the input override commands for file properties (i.e. -IF) I don't know what this affects. I have not received any other information from Ascential on the scope.

I'll pass on any other info if I get it. Thanks for everyones' input.

Clint
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top