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!

Dynamic output file name

Status
Not open for further replies.

oscarse

Programmer
Apr 9, 2006
99
0
0
CA
Proplem; input file with multiple concatenated ISA's

I have no adapters for Mercator just Merc 6.7 Map and Tree Builder ... is it possible with only one map to split these ISA's into files with the ISA number as the file name? Or is it possible to run a second map as required from a main map with the output card output filename passed in as a paramater?

Currently I have 2 maps which I run using a batch script ... the first map creates a file with just the ISA numbers ... the script then iterates this file to split out the ISA's ... this works but would perfer Mercator to do this if possible.

I have gone through the Merc Tutorials and don't see any examples for this type of processing ... the Map output card definition requires a filename and it is not clear how to redirect it to use a variable ... or if that is even possible.
 
When you refer to ISAs are you refering to the segment or the entire loop?

Map Designer, Type Tree Maker and Type Designer are part of the Design Studio. If you have Design Studio you should have the related adapters.

If you have the Design Studio you could use a DB sequencer to generate your ISA numbers. Aside from that you should be able to gen a unique value with something like...

day + time or DDDHHMMSS

or using a functional map....

index + YYDDD

or several other methods depending on your restrictions.

Other than for internal tracking, if you are splitting the ISA loops into separate physical files you don't really have to have unique control numbers by file. They can be static. There are other ways to track data than just by ISA number.

You can use a put statement to create your physical file...

put("file", "path\"+text(ISA:CTL#)+".extention",
package(output))

or override runmap's output file name using the control number.

 
The ISA's are unique at this point as the file is a collection of outbound Mapped ANSI data for a specific Partner and Document ... the ISA numbers were already generated in enterprise database application ... so the data is already in properly formatted envelopes for the Partner ... the only issue is the partner(s) cannot receive multiple ISA segments in a single file ... The current process already works I was just hoping I could eliminate some of the added complexity for maintenance etc.

I purchased the Mercator software originally in 1999 while I was employed directly with the client I am working with ... the details of this purchase were lost after I left in 2001 ... all I have is what was installed from the Mercator 6.7 update disk ... I am not aware of any other software that installed on the work station other then the Map and Tree software. Could you maybe give me the exe names and or possibly the folder names of this other software.
 
dbedit Is the DBID letting you easily configure DB connections, queries and so on...

mapedit Is the Map Designer
typeedit Is the Type Designer.

You should have an array of dll files for FTP, HTTP, and DB connections. There are other files as well but if you have a licensed install they should all be there.

You really, probably want to use a runmap to create the output. Override the output file name with the control number as the name. depending on your maps out file override syntax is something like (n = card number)

..." -OFn path\'"+ text(isa:cntl#) + "'.extention"...


 
Hello,
Agree with 'eyetry' ....... to create dynamic file names / output, you have two options. Either do a PUT("FILE", ....) or a RUN("utility_map.mmc" ......). If you do not have adapters (??? you should), then you must revert to RUN. The "utility_map.mmc/mms" would be a simple map created to read a 'blob' of data and map the blob to output (no more, no less, no control characters - ie -- map, as is). Utility Type tree would be a Group definition with an Item that has no defined length. Use that TT for both input and output. Then your application map would read your ISA file (map to the specs - say Output card 1). If the input ISA file can be used directly, then no need for my Output Card 1. The next Output card would iterate over the ISA numbers, calling a function map. Function map (passing in each ISA number/data) would issue a RUN("utility_map.mmc","IF1 " + PACKAGE(what was passed into the FM) + " OF1 path/" + isa# + ".txt"). RUN should be wrapped with a VALID --- (VALID(RUN( ......)),FAIL("Error" + LASTERRORCODE() + LASTERRORMSG())). You will then have elminated the script need and another 'breaking point' in your current design.
Good luck. TR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top