View previous topic :: View next topic
|
Author |
Message |
ganeshn987
New User
Joined: 17 Feb 2010 Posts: 5 Location: United States
|
|
|
|
Hi,
I need to rename a file within a NDM card using the command prompt. There are a couple of things to be noted –
1. I am trying to send the file to a specific path within the NDM server (it is not the default location where files are transferred, I am overriding the default path)
2. I am trying to concatenate the name of the file using the SYMBOL parameter and the concatenation operator ||
I have provided the code used for concatenation and renaming the file. I am not able to rename the file successfully using this code. Please let me know the possible modification which I need to do to rename the file from the .TXT format to .XLS format.
TESTNDM -
PROCESS -
PNODE=Primary node location -
SNODE=Target servers name -
CLASS=1 -
&DSNIN1=Physical sequential file in mainframes -
&DATE=%SUBDATE3 -
SYMBOL &A=SERVER -
SYMBOL &B=FOLDER1 -
SYMBOL &C=FOLDER2 -
SYMBOL &D=TEST_FILE_ -
SYMBOL &E=.TXT -
SYMBOL &F=.XLS -
SYMBOL &G=\'\ || \\\\\\ || &A || \\\\ || &B || \\\\ || &C || -
\\\\ || &D || &DATE || &E \'\ -
SYMBOL &H=\'CMD(REN \ \\\\\\ || &A || \\\\ || &B || \\\\ || &C || -
\\\\ || &D || &DATE || &E || -
&D || &DATE || &F)'\ -
RETAIN=NO
STEP01 RUN TASK (PGM=WINNT) SNODE -
SYSOPTS=&H
EXIT
Thank you ! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Why do you believe you want to rename the file to .xls? Renaming the file will not change the content to be a spreadsheet.
Assuming the text fle is actually a delimited file, Excel will open/import the file directly. |
|
Back to top |
|
|
ganeshn987
New User
Joined: 17 Feb 2010 Posts: 5 Location: United States
|
|
|
|
Thank you sir for your response!
I am able to physically change the extension of the file in the target location and the attribute of the file also changes.
When I try to login to the command prompt and perform this operation also the attribute of the file changes, the extension of the file is modified and the textpad is converted to an excel spreadsheet
Command used to rename the file in the server
(C:\>rename \\SERVER\FOLDER1\FOLDER2\TEST_FILE_DATE.TXT TEST_FILE_DATE.XLS)
However using this logic in the NDM process is not giving the expected result which I am looking for . |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I am able to physically change the extension of the file in the target location and the attribute of the file also changes.
When I try to login to the command prompt and perform this operation also the attribute of the file changes, the extension of the file is modified and the textpad is converted to an excel spreadsheet |
Which "attributes" are changed? A RENAME does just that - causes the file to have a "newname". Nothing is done with/to the contents of the file (unless someone has installed a new magic-bullet "rename" utility on your system. . .) |
|
Back to top |
|
|
ganeshn987
New User
Joined: 17 Feb 2010 Posts: 5 Location: United States
|
|
|
|
What I meant was that the textpad is converted into a spreadsheet. The contents still remain the same. My requirement is to do this change in the NDM process.
Any pointers on getting this done through the NDM process would be appreciated. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
What I meant was that the textpad is converted into a spreadsheet. |
Sorry, but no it isn't. All that is done is that the file is renamed - there is no conversion.
None of my sites currently use NDM, but why can you not cimply create the file with the extension you want rather than renaming it?
On the other hand, why not try importing the .txt file directly into the spreadsheet. This is done by my users hundreds of times a day. . . |
|
Back to top |
|
|
ganeshn987
New User
Joined: 17 Feb 2010 Posts: 5 Location: United States
|
|
|
|
Sir,
This was just an example which I had provided, my actual requirement is to convert a '.tmp' file to '.dat' file. There are chances that the version of the file created in '.tmp' may not be readable because of the way the file is created. I will not be able to create the file in the '.dat' format. This is the reason why I am trying to rename the file into another format after creation.
I have already figured out the way to rename a file using the NDM card when the name of the file is hardcoded. Since I am trying to concatenate a few parameters and obtain the file name, I am facing a problem with this rename step in the NDM card. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Please let me know the possible modification which I need to do to rename the file from the .TXT format to .XLS format. |
There are products which can be purchased to change sequential (text) files into Excel spreadsheets. Depending upon the product and the size of your machine, these products can cost many thousands of dollars. Or, you can read the entire 1000+ pages of the Excel file format specification, write your own program to convert your data from text to Excel, and use it -- but that'll probably take some experienced programmers between 6 and 24 months to accomplish.
As Dick repeatedly told you, merely changing the file extension from .txt to .xls does absolutely nothing to the contents of the file -- when opened, Excel must still convert the contents to something Excel can handle. The only thing changing the extension does on Windows systems is change the default program to open the file -- and you can open Excel, use File -> Open and put the .txt file name into the dialogue box, and Excel will do the exact same thing (convert the contents to something Excel can handle), so you're not gaining a whole lot by changing the .txt to .xls at some point. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
This was just an example which I had provided, my actual requirement is to convert a '.tmp' file to '.dat' file. |
To get the most useful replies here, one needs to post information about their actual question/requirement - not something unrelated. As nothing in your situation has anything to do with either a .txt file or a .xls file, why even mention them? Let alone the misinformation about the rename "converting" the file.
If, in your real world, you rename a .tmp file to a .dat file, there will still be no data conversion.
I believe you have more to deal with than merely changing the name of the file.
I realize this is not the answer you asked for, but i believe this will have to be addressed before your process will work correctly (with or without a rename).
Good luck |
|
Back to top |
|
|
|