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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Splitting files - Help required 1

Status
Not open for further replies.

mlapse

IS-IT--Management
Jun 30, 2005
82
US
I am trying to split a file into multiple smaller files.

A partner sends us data (X12) in the format below:

ISA
GS
ST
SE
ST
SE
GE
IEA
ISA
GS
ST
SE
GE
IEA

I need the output to be multiple files, each with one ST SE within one GS GE and one ISA IEA.

How do I do this? My map works when there is just one interchange (ISA) and one group (GS) in the input but not for multiple groups and interchanges in the same input file.
 
....My map works when there is just one interchange (ISA) and one group (GS) in the input but not for multiple groups and interchanges in the same input file..."

Is this by intent? If not and you are able to change your map..... This might help you process multiple transactions in single file...

1st level f_map could look like

----extract_transactions (ST_loop, GS_loop, ISA_loop)

Assuming for now you are processing an enrollment/834 file and you want to process everythng in one sweep instead of breaking the file up,the next f_map would be something like

----extract_ins (ins_loop, other_val1, other_val2...)

If you really need to split the file up there are at least two ways to do that.

1. If each ISA or GS has unique sender or receiver ids and you have Commerce Manager run the file thru it.

2. Or, and I haven't tested this....

f_map1 (st_loop, GS_Seg, GE_Seg, ISA_Seg, IEA_Seg, count(stloop_segs)+2, file_name, index($))

f_map1 rule =

put("file", path\new_filename(old name + index?),
seriestotext(ISA + GS + substitute(ST_loop, se01, count) + substitute(ge_seg, GE01, "1"), substitute(iea, iea01, "1"))

I haven't tested it but it might work. Also, you might need to account for terminators. Not sure. You'll have to play with it. Using runmaps theres several other ways to do this too.

Personally, I'd rather process the entire file once.

good luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top