We often output many divisions of a job to a single Xyascii text file, and process that text file with Perl. In some cases we need the division name in that text file when the output changes to that division. I've looked through the help screen for fromxsf with no results. On our old Linux XPP I had this output at the top of each division in the text file:
(Xyascii stuff, of one or more pages)
(many Xyascii pages of products)
I did this using a shell script and an array of division names to output and concat to a single text file. But now on Windows Server 2012 I cannot get arrays to work in a batch file. If anyone can get the division name output to a text file with multiple divisions, I would be very grateful.
The reason for the division name is we need to process some divisions differently and we don't have another way to do ID different divisions. We cannot rely on operators entering special codes for this by hand.
Our current cmd.exe batch file to export a group of divisions is this: set outfile=output.txt fromxsf %outfile% +m -nbs -dos -Rep -nofrills -xyp 4 -job -div DIV_05-wall,DIV_06-base,DIV_07-tall,DIV_08-office,DIV_09-vanity,DIV_10b-filler_spread -cat
would the fromxsf option of
give you what you need?
It seems to from the wording in the XPP manual - Transforming Data XPP … see example at the top of page 2-7
That just seems to put a "D" at the top of the output Xyascii file. It doesn't do what I would like.
Here's the command line I'm using: fromxsf %outfile% +m -nbs -dos -Rep -nofrills -xyp 4 -job -HDR %D -div DIV_one,DIV_two -cat
I tried many variations of that switch like:
None of them worked.
You can only use the %d thing in combination with the lowercase -hdr option.I tried a -hdr "Prestring: %d" on my system in combination with a -all instead of the -div option and it worked.
Sounds like the '%' is being dropped. Is your script a .bat file? If so, then the %D is being seen as a windows batch file argument I suspect. I agree with Bart, Perl is better for scripting as it has many more features and less 'weirdness'. IMHO
I have to use the -div option. I don't have a choice in this. Some divisions are backup divisions or intro matter and I don't want those in the resulting Xyascii file.
Yes, I think you nailed it. It is the .bat file that creates the problem.
So try with:fromxsf %outfile% +m -hdr "%%d" -nbs -dos -Rep -nofrills -xyp 4 -job -div DIV_05-wall,DIV_06-base,DIV_07-tall,DIV_08-office,DIV_09-vanity,DIV_10b-filler_spread -cat
Yes it's a windows .bat file in cmd.exe.
It should work with the -div option as well. I just wanted to be a complete as possible with what I tried.
Anyhow, Mark just found the reason for your problem
Here we go, you have to escape a % with another % sign in a .bat file. Here's what worked:
-hdr "Name %%d"
at the very end of the command line. Here's the whole command .bat file:
set outdir=c:\perlprogs\chuck\nof\159886createseat-20190617set outfile=%outdir%\159886some.txtif not exist "%outdir%" ( echo ERROR: %outdir% not found goto noparam )del %outfile%
fromxsf %outfile% +m -nbs -dos -Rep -nofrills -xyp 4 -job -div DIV_one,DIV_two -cat -hdr "Name %%d"
I just searched for "How to use % in .bat file".