web stats
Batch processing edi 834 files - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 07-17-2017, 08:28 AM
rav rav is offline
Mirth Guru
 
Join Date: Oct 2012
Posts: 258
rav is on a distinguished road
Default

Quote:
Originally Posted by kirbykn2 View Post
I did something similar for an X12 file. I set "Process Batch" to yes on the summary tab, then configured the "Batch Delimiter" in "Set Data Types".

I have similar set up with following code in batch script and it takes ages to run and it spits out just one message and after that I see heapspace error

var segDelim = '~';
var elementDelim = '*';
var subelementDelim = ':';
var infer = true;

var message = new java.lang.StringBuilder();
var ch;
while ((ch = consume(1)) != null) {
if (infer) {
elementDelim = consume(3);
subelementDelim = consume(101);
segDelim = consume(1);
consumeNewline();
infer = false;
continue;
} else if (ch == segDelim) {
consumeNewline();
reader.mark(3);
if (readChar() == 'I' && readChar() == 'N' && readChar() == 'S') {
reader.reset();
break;
}
reader.reset();
}
}

return message.toString();

function readChar() {
var c = reader.read();
return c == -1 ? null : java.lang.Character.valueOf(c);
}

function consume(num) {
var ch;
for (var i = 1; i <= num; i++) {
ch = readChar();
if (ch != null) {
message.append(ch);
}
}
return ch;
}

function consumeNewline() {
reader.mark(1);
var ch = readChar();
if (ch == '\r') {
message.append(ch);
reader.mark(1);
if ((ch = readChar()) == '\n') {
message.append(ch);
} else {
reader.reset();
}
} else if (ch == '\n') {
message.append(ch);
} else {
reader.reset();
}
}
Reply With Quote
 

Tags
batch process, edi 834, javascript

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:00 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation