- What is the difference between AnyToAny and AnyToXML Format Converter Engines?
- Does Redix AnyToAny Format Converter Engine support X12 version 5010 and its later releases?
- How do I fix the EXCEPTION_STACK_OVERFLOW error in JAVA?
- I need to pass the data to an existing OFD. Is there a way for me to achieve such?
- How can I extract error information from a Redix error file?
- How can I transfer my license?
- How do I improve engine performance?
- How do I program a user-defined procedure?
- Can I use VB.Net to interface with the Redix engine?
- Can I use VB 6 to interface with the "redix" command line?
What is the difference between AnyToAny and AnyToXML Format Converter Engines?
If the conversion is from an EDI or flat file to an XML message, you can choose to use either one of the two engines. The criteria to determine which engine to use is based on the layout of the output file. If the data sequence order of the output file is identical to that of the input file, you can use the AnyToXML Converter Engine. However, if the data sequence order is different, i.e,. the data in the input file will be manipulated, mapped, reformulated, or rearranged in the output file, you will need to use the AnyToAny engine. Another difference between the two engines is that the Redix AnyToXML Format Converter Engines does not need an OFD file, whereas the Redix AnyToAny XML Converter Engine requires one.
Does Redix AnyToAny Format Converter Engine support X12 version 5010 and its later releases?
Yes, the Redix AnyToAny Format Converter Engine supports all X12 transactions in version 3040, 4010, 4020, 4030, 5010, 5020, 5030, 5040, and 5050.
How do I fix the EXCEPTION_STACK_OVERFLOW error in JAVA?
The EXCEPTION_STACK_OVERFLOW error is a JAVA stack error, which may occur in any version of the JAVA JDK. This error will hang some applications, such as JCreator or JBuilder. If the user is using the JAVA command-line executable, an error message will be shown, similar to the following:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_STACK_OVERFLOW occurred at PC=0x8fa3477
Function name=(N/A)
Library=(N/A)
NOTE: We are unable to locate the function name symbol for the error just occurred. Please refer to release documentation for possible reason and solutions.
Current Java thread:
at Redix.redix_app_ext(Native Method)
at Redix.main(Redix.java:13)
Dynamic libraries:
0x7D2A0000 - 0x7D2CD000 C:\WINDOWS\SYSTEM\DBGHELP.DLL
Local Time = Tue May 29 12:12:28 2001
Elapsed Time = 0
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.3.1-b24 mixed mode)
#
To correct this problem, the user must use a binary editor to modify the stack size of the executable, java.exe. In the Windows environment, this editor is the "editbin.exe". During the installation (Redix XML GUI Mapper Version 4.10 or above), the file "editbin.exe" and its related files will be installed into your system. The user needs to locate the executable "java.exe". Most of the time, this file is found in the Java working directory, e.g., JDK 1.4.0; it can also be found in the Java Runtime Environment or windows\systems\ directories. Open the Command Prompt, and redirect the path to the directory in which the executable, java.exe is located; then, type the following:
editbin /STACK:1000000 java.exe
Once you have entered the above, the stack size should have been changed to 1 MB. At this point, the user should try to run the application once again, and this error should then be resolved.
I need to pass the data to an existing OFD. Is there a way for me to achieve such?
Many users wish to modify the OFD information in a map after the map has already been created. For example, a user may wish to modify the ISA (Interchange Header) information, i.e. ReceiverID, ReceiverQualifier, etc., in an X12 message. In another example, a user may wish to modify a map's separators based on his trading partner's needs. The user can use the user_data parameter in the API function redix_app_extA to pass the user's external data into an OFD. The external data must be represented in a delimited string, with the delimiter being the element separator (",").
DataElement1,DataElement2,DataElement3
The above example passes three data elements (DataElement1, DataElement2, DataElement3) into the Redix AnyToAny Format Converter Engine, separating each element with a comma (","). After the data string has been passed into the engine, it can be referenced with the userdata OFD function (different from the similarly-named parameter in the API function redix_app_extA). The data elements are numbered from 0 to a maximum of 100. The following OFD calls would retrieve the values shown below:
OFD | Retrieved Value |
userdata(0) | DataElement1 |
userdata(1) | DataElement2 |
userdata(2) |
DataElement3 |
The parameter user_data in the API function redix_app_extA can contain one or more data strings. If multiple strings are used, then each string must be separated by the element separator, as specified in the parameter element_separator in the API function redix_app_extA.
How can I extract error information from a Redix error file?
The OFD function geterrorinfo is designed to extract the error information from a Redix error file. In order to extract the error information and write it to a SQL Server database, the filename of the Redix error file, the filename of the original input file that generated the error file, the SQL Server database name, the database's user name, and the database's password are required. These pieces of information can be passed to the OFD through the userdata parameter.
A typical Redix error file looks like the following:
Warning: Element Error occurs at Line Number = 7; Segment Name = PER; Element Position = 1; Invalid data = (); Element Number = 366; Error Number = 1: Mandatory data element missing; Warning: Element Error occurs at Line Number = 9; Segment Name = NM1; Element Position = 3; Invalid data = (); Element Number = 1035; Error Number = 10: Exclusion Condition Violated; F(01020^02015^02250^02500,0,3); The element (3) must be used.
Warning: Element Error occurs at Line Number = 30; Segment Name = N4; Element Position = 2; Invalid data = (); Element Number = 156; Error Number = 1: Mandatory data element missing; Warning: Element Error occurs at Line Number = 30; Segment Name = N4; Element Position = 3; Invalid data = (); Element Number = 116; Error Number = 1: Mandatory data element missing; Warning: Element Error occurs at Line Number = 51; Segment Name = HI; Element Position = 1; Invalid data = (BL); Element Number = 1270; Error Number = 7: Invalid code value.;
Warning: Composite Data Element Error occurs at Line Number = 51; Segment Name = HI; Element position = 1; Composite position = 2;
Invalid data = (); Element Number = C022; Error Number = 1: Mandatory data element missing; Warning: Element Error occurs at Line Number = 64; Segment Name = SBR; Element Position = 1;
Invalid data = (Ssfsfsfsf f ); Element Number = 1138; Error Number = 5: Data element too long.;
The key pieces of error information in the above file include the line number, segment name, element position, original error data, and error description. To capture all of the above pieces of information, we designed a table named "RedixError" with the following fields:
Field Name | Data Type | Size |
OriginalFileName | nvarchar | 128 |
OriginalLineNo | int | 4 |
ErrorNo | int | 4 |
Segment | navchar | 128 |
ElementPos | int | 4 |
CompositePos | int | 4 |
OriginalData | nvarchar | 1024 |
ElementNo | nvarchar | 64 |
CompositeNo | nvarchar | 64 |
ErrorDescription | nvarchar | 1024 |
Below is an OFD example that uses the geterrorinfo function with the userdata parameter. The filename of the OFD file is "RER_to_SQLServerDB.ofd".
output
# USERDATA Explanation ----------------------------------------------------;
# 0 = Redix Error File Name [and Path] ;
# 1 = Original Input File In Which the Errors where found [and Path] ;
# 2 = SQL Server Server Name ;
# 3 = SQL Server Database Name ;
# 4 = SQL Server Login ID ;
# 5 = SQL Server Password ;
# END USERDATA Explanation ------------------------------------------------;
# Error Code Return Explanation ----------------------------;
# -1004 = Unable to insert error ;
# END USERDATA Explanation ---------------------------------;
deb := fopen("debug.txt");
conn := mstrcat(userdata(2), "@", userdata(3));
pw := userdata(5);
db1 := sqlconnect (conn, userdata(4),userdata(5));
line := getlinecount (userdata(0)); # Retrieve # of Lines in the Redix error file;
of1 := openfiletoread(userdata(0)); # Open the Redix error file to read;
# turn on the following statement for debug
#writeln(deb, mstrcat("total line no=", line), 0,0, LEFT," ");
kerror :=0;
for i:=1 to atoi(line) do # Cycle Through all the Errors;
kerror := kerror + 1;
linedata := readline(of1);
RERinfo := geterrorinfo(linedata);
# turn on the following statement for debug
#writeln(deb, RERinfo, 0,0,LEFT," ");
array := split("|",RERinfo);
lineNo := array[0];
seg := array[1];
elemcomp := split(":",strcat(array[2],":"));
elemPos := elemcomp[0];
compPos := assignvalues(elemcomp[1],"0");
data := array[3];
elemNo := array[4];
compNo := "";
if (strsub(elemNo,1,1) = "C") then
elemNo := "";
compNo := array[4];
endif;
descErrNo := split(":",mstrcat(array[5],":::"));
description := lrtrim(chkquote(descErrNo[1]));
errorNo := strsub(lrtrim(descErrNo[0]),16,20);
originalErrorLine := chkquote(RERinfo);
SQL := mstrcat("INSERT INTO RedixError (OriginalFileName, OriginalLineNo, ErrorNo,
Segment, ElementPos, CompositePos, OriginalData, ErrorDescription, ElementNo, CompositeNo)
VALUES ('",userdata(1), "',", lineNo, ",", errorNo, ",'", seg, "',", elemPos, ",", compPos,
",'", data, "','", description, "','", elemNo, "','", compNo, "')");
# turn on the following statement for debug
#writeln(deb, SQL, 0,0,LEFT," ");
ret := sqlsqlcmd(db1, SQL);
if (strsub(ret,1,2) != "1|") then
a := exitno(-1004); # Unable to insert error;
endif;
endfor;
f := closefile(of1); # Close Redix error file
fclose("debug.txt");
endoutput;
You can run the above OFD file by typing the following command in Command Prompt:
redixscr RER_to_SQLServerDB.ofd "837_I.rer|H_TP_837i.edi||DQAv2|||||" "|"
You may want to refer to redixscr for information on how to use the executable. The information passed by the userdata parameter is as follows:
Redix Error File Name: 837_I.rer
Original Input File: H_TP_837i.edi
SQL Server Server Name:
SQL Server Database Name: DQAv2
SQL Server Login ID:
SQL Server Password:
If you prefer to write the error information to an SQL Server database through an API call, you can use the API function redix_scrA(). Below is an example of the function call using Visual C++:
int = redix_scrA("RER_to_SQLServerDB.ofd", "837_I.rer|H_TP_837i.edi||DQAv2|||||", "|");
How can I transfer my license?
If you have a Redix GUI Mapper license, then you should run the GUI Mapper and select the "Transfer the license" menu item in the "Help" menu. See the screenshot below.
Selecting the "Transfer the License" menu item will cause the following warning message to appear:
If you have a Redix engine license, then you should run the Redix License Manager (or "enginelic.exe"). See the screenshot below:
In the Redix License Manager screen, pressing the "Transfer License" button will cause the following warning message to appear:
If you choose "Yes" in the "Transfer License?" screen, then the license file will be deleted and you will no longer be able to run the Redix GUI Mapper or engine on that system. If your system has an Internet connection, then internally, transfer data will be sent to the Redix License Internet server via the Internet, and the server will increment the available activations by one.
If your system does not have an Internet connection or if the Internet connection fails for some reason, then the following screen will appear.
You will need to send an email to support@redix.com with the above transfer code.
On the system to which the Redix license will be transferred, the user simply needs to install the Redix GUI Mapper or engine files using the Redix installation program and activate the Redix GUI Mapper or engine on that system.
How do I improve engine performance?
Often, users ask how to improve the performance of the Redix engine. This topic suggests several possible approaches to help the user improve the performance of the Redix engine.
Reduce the size of the message definition
To understand why the size of a message definition plays an important role in the performance of a conversion, we first need to provide you with some of the engine's basic design concepts. The Redix engine will first read an IFD (Input File Descriptor) so that an internal tree structure may be built; the engine will later parse input data strings based on the IFD tree. Once the input data tree has been built, the Redix engine will traverse the input tree, in a manner based on the OFD, to generate the output(s). Therefore, if the user can reduce the size of a tree structure by reducing the size of the IFD, then the number of traverses will be reduced, and thus the performace can be improved. The following example presents some real-world data to show how the engine's performance can be improved by reducing the size of the message definition.
We will use an X12 Version-4010 850 Purchase Order as our example. Using the Redix GUI Mapper, we can build the EDI message X12_4010_850 using the X12 standard Version 4010. Without modifying the message definitions, we can build the corresponding maps for the conversions in both directions, i.e. X12_4010_850 -> 850_XML and 850_XML- > X12_4010_850, using the GUI Mapper. The first map uses the Redix AnyToXML Engine, whereas the second map uses the AnyToAny Engine. To illustrate the performance improvements one might gain by using the AnyToAny Engine, we can use the second map, i.e. X12_4010_850_XML -> X12_4010_850. The input file for this map was generated from the first map, i.e. X12_4010_850 -> XML. The file size of the input file (X12_4010_850_XML) is 36KB, and its contents can be viewed here. The output EDI (size 7.5KB) file can be viewed here.
Using a Linux system, we observed the following performance:
System | Total Elapsed Time |
Linux: Pentium 2.800 GHz, 512 MB RAM | 0.196 seconds |
Now, we are going to reduce the size of the message definition. The most commonly-used way to modify a message definition is based on the "Trading Partner's Guide" or the "Implementation Guide" offered by the trading partner. In general, in the Trading Partner's Guide, quite a few of the 850 segments and loops are marked as "not used". For example, the "CUR" segment at the "01" table and "040" position in our example is not used. We can verify this by checking the testing file. We then used the Redix GUI Mapper to delete this segment in the Editing Message Definition screen. By following this guide, approximately 50 un-used segments and loops were deleted in the message definition. We then used the GUI Mapper to re-generate the maps and a new IFD/OFD. Using the same file but with the new IFD/OFD, the performance has now improved as follows. Note that the input file and output file are identical in both cases.
System | Total Elapsed Time |
Linux: Pentium 2.800 GHz, 512 MB RAM |
0.061 seconds |
As is shown, by merely reducing the size of the message definition by deleting the un-used segments and loops (and creating a new IFD/OFD), we can improve the performance by 300%. The following table shows the size of the IFD/OFD before and after the modification:
IFD/OFD Size Before | IFD/OFD Size After |
IFD: 196KB, OFD: 47 KB |
IFD: 41 KB, OFD: 8 KB |
Modify OFD
If the message definition cannot be modified, the user should look into the possibility of modifying the OFD to improve the engine's performance. The idea is to eliminate the unnecessary traverses. Take the following OFD example:
writeEDIseg(of1, "N1", N10103620_01, N10203640_01, N10303660_01, N10403680_01, N10503700_01, N10603720_01);
The above statement will traverse six elements from the tree structure, i.e. N10103620_01, N10203640_01, etc. If all of the six elements are not present, then the "N1" segment will not be generated because of characteristics of the writeEDIseg function. One possible way to reduce the number of traverses is to use the following modified OFD:
if (len(N10103620_01) > 0) then
writeEDIseg(of1, "N1", N10103620_01, N10203640_01, N10303660_01, N10403680_01,
N10503700_01, N10603720_01);
endif;
The above modified OFD statement will compare the value of the elements, e.g. N10103620_01. Based on the value of the element, those six elements can be avoided if the element does not exist. One should be aware that the above OFD statements can also slow down the engine's performance if the if-condition is always true (if the N10103620_01 element is always present). In such a worst-case scenario, instead of six elements, seven elements would be traversed. In summary, the user needs to carefully evaluate each situation and decide if and how to modify an OFD.
When using the "A" type of code checks, put the most commonly-used codes in front
Having code checks in validation are usually necessary. The Redix engine supports several types of code checks. The most commonly-used code check is of type "A". Setting the code check to type "A" puts all of the valid codes directly in the IFD. When using code checks of type "A", it is important that the most commonly-used codes be placed in front so that un-necessary checks are avoided. In case all of the codes are commonly used, then the user should consider using code checks of the "D" type. Code checks of type "D" use the Redix codebase engine, which can provide much better performance at the expense of some ease-of-use.
When using the "D" type of code checks, use only one codebase file
When using the "D" type of code checks, make sure only one codebase file is used to reduce the unnecessary open/close of the codebase files. In the codebase file, the user can use the combination of the element number and code values. That is, the data stored in the codebase file will have the following format:
ElementNumber:CodeValue
Note that there is a ":" between the element number and the code value. In the fifth field of the EMTDEFS section, the user can use the following format to refer to the "D:" type of the codebase file:
D:CodebaseFileName:ElementNumber
How do I program a user-defined procedure?
Let us use the following example. The following example verifies an Identification Number. The algorithm behind the verification is as follows:
- The rightmost digit is a check digit.
- The low-order digit is verified by multiplying each digit of the high-order numbers, beginning with the digit to the left of the low-order (check) digit, by the numbers 2,3,4,5,6,7,2,3,4.
- Add the results of the previously-multiplied products together and divide by 11.
- Get the remainder and subtract the remainder from 11.
- Compare the result with the low-order (check) digit. If the digits are equal, the number is valid. If the digits are unequal, the number is invalid.
- The Identification Number can also be an alphabetic character. Each alphabetic character is assigned a numeric equivalent, so the same check-digit routine is performed. Below are the assigned values for each alphabetic character:
A=1 | J=1 | S=2 |
B=2 | K=2 | T=3 |
C=3 | L=3 | U=4 |
D=4 | M=4 | V=5 |
E=5 | N=5 | W=6 |
F=6 | O=6 | X=7 |
G=7 | P=7 | Y=8 |
H=8 | Q=8 | Z=9 |
I=9 | R=9 |
Example 1: 125-00-00037
1*4+2*3+5*2+0*7+0*6+0*5+0*4+0*4+3*2 = 26
Remainder of 26/11 is 4
11-4=7
Compare 7 with the check digit 7.
Valid since they are the same.
Example 2: XY0-33-00426
7*4+8*3+0*2+3*7+3*6+0*5+0*4+4*3+2*2 = 107
Remainder of 107/11 is 8
11-8=3
Compare 6 with 8.
Invalid.
Below are the steps to program checkID1 in C/C++. Assume you are using Visual C++ 5.0/6.0.
- Step 1 Create a new project, users32.
- Step 2 Add trav_upr.cpp to the project. The trav_upr.cpp should be located in the Redix folder.
- Step 3 Locate the checkid1 routine and copy the following function.
- Step 4 Compile the DLL and copy the users32.dll to the Redix folder. The new users32.dll will overwrite the original one.
- Step 5 The checkid1 will return 1, if the check digit is valid. Otherwise, 0 will be returned, if invalid.
- Step 6 Make sure the user-defined procedure is "1" for the field to be verified. That is, fill in the 6th field of the Identification Number with "1".
EXPORT BOOL WINAPI checkID1(char *s)
{
// MediCAID last digist edit
int Ret;
int TotalSum;
int DigitToBeChecked;
int Remainder;
int i, j, mul;
int NumChar;
char EvalStr[20];
// first, let us take out the dash and underscore
j = 0;
EXPORT BOOL WINAPI checkID1(char *s)
{
// MediCAID last digist edit
int Ret;
int TotalSum;
int DigitToBeChecked;
int Remainder;
int i, j, mul;
int NumChar;
char EvalStr[20];
// first, let us take out the dash and underscore
j = 0;
break;
case 'S':
Ret = 2* mul;
break;
case 'T':
Ret = 3* mul;
break;
case 'U':
Ret = 4* mul;
break;
case 'V':
Ret = 5* mul;
break;
case 'W':
Ret = 6* mul;
break;
case 'X':
Ret = 7* mul;
break;
case 'Y':
Ret = 8* mul;
break;
case 'Z':
Ret = 9* mul;
break;
case '1':
Ret = 1* mul;
break;
case '2':
Ret = 2* mul;
break;
case '3':
Ret = 3* mul;
break;
case '4':
Ret = 4* mul;
break;
case '5':
Ret = 5* mul;
break;
case '6':
Ret = 6* mul;
break;
case '7':
Ret = 7* mul;
break;
case '8':
Ret = 8* mul;
break;
case '9':
Ret = 9* mul;
break;
default:
Ret =0;
break;
}
#ifdef DEBUG
cout << "Char = " << EvalStr[i] << ", mul = " << mul << ", Ret = " << Ret << endl;
#endif
TotalSum = TotalSum +Ret;
}
Remainder = 11 - TotalSum %11;
#ifdef DEBUG
cout << "Remainder = " << Remainder << ", DigitToBeChecked = " << DigitToBeChecked << endl;
#endif
Remainder = (Remainder >9) ? 0: Remainder;
// Return 1, if validation is successful
Ret = (Remainder==DigitToBeChecked) ? 1 : 0;
#ifdef DEBUG
cout << "TotalSum = " << TotalSum << ", Remainder = " << Remainder << ", DigitToBeChecked =
" << DigitToBeChecked << ", Ret = " << Ret << endl;
#endif
return Ret;
}
{
// MediCAID last digist edit
int Ret;
int TotalSum;
int DigitToBeChecked;
int Remainder;
int i, j, mul;
int NumChar;
char EvalStr[20];
// first, let us take out the dash and underscore
j = 0;
EXPORT BOOL WINAPI checkID1(char *s)
{
// MediCAID last digist edit
int Ret;
int TotalSum;
int DigitToBeChecked;
int Remainder;
int i, j, mul;
int NumChar;
char EvalStr[20];
// first, let us take out the dash and underscore
j = 0;
break;
case 'S':
Ret = 2* mul;
break;
case 'T':
Ret = 3* mul;
break;
case 'U':
Ret = 4* mul;
break;
case 'V':
Ret = 5* mul;
break;
case 'W':
Ret = 6* mul;
break;
case 'X':
Ret = 7* mul;
break;
case 'Y':
Ret = 8* mul;
break;
case 'Z':
Ret = 9* mul;
break;
case '1':
Ret = 1* mul;
break;
case '2':
Ret = 2* mul;
break;
case '3':
Ret = 3* mul;
break;
case '4':
Ret = 4* mul;
break;
case '5':
Ret = 5* mul;
break;
case '6':
Ret = 6* mul;
break;
case '7':
Ret = 7* mul;
break;
case '8':
Ret = 8* mul;
break;
case '9':
Ret = 9* mul;
break;
default:
Ret =0;
break;
}
#ifdef DEBUG
cout << "Char = " << EvalStr[i] << ", mul = " << mul << ", Ret = " << Ret << endl;
#endif
TotalSum = TotalSum +Ret;
}
Remainder = 11 - TotalSum %11;
#ifdef DEBUG
cout << "Remainder = " << Remainder << ", DigitToBeChecked = " << DigitToBeChecked << endl;
#endif
Remainder = (Remainder >9) ? 0: Remainder;
// Return 1, if validation is successful
Ret = (Remainder==DigitToBeChecked) ? 1 : 0;
#ifdef DEBUG
cout << "TotalSum = " << TotalSum << ", Remainder = " << Remainder << ", DigitToBeChecked =
" << DigitToBeChecked << ", Ret = " << Ret << endl;
#endif
return Ret;
}
Can I use VB.Net to interface with the Redix engine?
Below is an example to use VB.Net to interface with the Redix engine. The API function used in this example is redix_app_extA.
1) Create a Redix.class
Public Class Redix
' Declare Redix DLL Function
Private Declare Function redix_app_extA Lib "rfcx.dll" (ByVal InputFile As String, ByVal
IFDFile As String, ByVal OFDFile As String, ByVal ACKFile As String, ByVal ERRFile As
String, ByVal OutputFile As String, ByVal CONVFlag As Byte, ByVal SEGMENT As Byte, ByVal
ELEMENT As Byte, ByVal COMPOSITE As Byte, ByVal Release As Byte, ByVal UserData As String,
ByVal WarningLevel As Integer, ByVal TA1File As String) As Integer
Private _infile As String
Private _ifd As String
Private _ofd As String
Private _ack As String
Private _err As String
Private _out As String
Private _convflag As Byte
Private _seg As Byte
Private _elem As Byte
Private _comp As Byte
Private _release As Byte
Private _userdata As String
Private _ret As Integer
Private _warn As Long
Private _ta1 As String
Public Property InputFile()
Get
Return _infile
End Get
Set(ByVal Value)
_infile = Value
End Set
End Property
Public Property IFDFile()
Get
Return _ifd
End Get
Set(ByVal Value)
_ifd = Value
End Set
End Property
Public Property OFDFile()
Get
Return _ofd
End Get
Set(ByVal Value)
_ofd = Value
End Set
End Property
Public Property ACKFile()
Get
Return _ack
End Get
Set(ByVal Value)
_ack = Value
End Set
End Property
Public Property ERRFile()
Get
Return _err
End Get
Set(ByVal Value)
_err = Value
End Set
End Property
Public Property OutputFile()
Get
Return _out
End Get
Set(ByVal Value)
_out = Value
End Set
End Property
Public Property CONVFlag()
Get
Return _convflag
End Get
Set(ByVal Value)
_convflag = Value
End Set
End Property
Public Property SEGMENT()
Get
Return _seg
End Get
Set(ByVal Value)
_seg = Value
End Set
End Property
Public Property ELEMENT()
Get
Return _elem
End Get
Set(ByVal Value)
_elem = Value
End Set
End Property
Public Property COMPOSITE()
Get
Return _comp
End Get
Set(ByVal Value)
_comp = Value
End Set
End Property
Public Property Release()
Get
Return _release
End Get
Set(ByVal Value)
_release = Value
End Set
End Property
Public Property UserData()
Get
Return _userdata
End Get
Set(ByVal Value)
_userdata = Value
End Set
End Property
Public Property WarningLevel()
Get
Return _warn
End Get
Set(ByVal Value)
_warn = Value
End Set
End Property
Public Property TA1File()
Get
Return _ta1
End Get
Set(ByVal Value)
_ta1 = Value
End Set
End Property
Public Function convert()
Try
Return redix_app_extA( _
InputFile, _
IFDFile, _
OFDFile, _
ACKFile, _
ERRFile, _
OutputFile, _
CONVFlag, _
SEGMENT, _
ELEMENT, _
COMPOSITE, _
Release, _
UserData, _
WarningLevel, _
TA1File _
)
Catch ex As Exception
Return -299 ' exception error
End Try
End Function
End Class
2) VB.Net program:
Dim redix As New Redix
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim ret As Integer
redix.ACKFile = "837.ack"
redix.COMPOSITE = Asc(":")
redix.CONVFlag = Asc("x")
redix.ELEMENT = Asc("*")
redix.ERRFile = "837.err"
redix.IFDFile = "Hipaa_a1_837_prof.ifd"
redix.InputFile = "testwpc_837p.edi"
redix.OFDFile = "pdf_1500_view.ofd"
redix.OutputFile = "pdf_1500.pdf"
redix.Release = Asc("?")
redix.SEGMENT = Asc("0")
redix.TA1File = ""
redix.UserData = ""
redix.WarningLevel = 2
ret = redix.convert()
MsgBox("Ret=" + CStr(ret))
End Sub
Can I use VB 6 to interface with the "redix" command line?
The user can use VB to interface with the “redix” command line. Following is a VB example that calls the redix command line.
VB code in the Module1.bas:
Option Explicit
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Const SW_HIDE& = 0
Public Const STARTF_USESHOWWINDOW& = &H1
Private Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret&
' Initialize the STARTUPINFO structure:
start.cb = Len(start)
start.dwFlags = STARTF_USESHOWWINDOW
start.wShowWindow = SW_HIDE
' Start the shelled application:
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&,
vbNullString, start, proc)
' Wait for the shelled application to finish:
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
Private Function commandLine(strConfigFile As String) As Integer
Dim slashPos As Integer
Dim retval As Long
On Error GoTo ErrHandler
retval = ExecCmd("redix " & strConfigFile)
commandLine = retval
GoTo EndOfFunc
ErrHandler:
'/Log message and prompt
LogToTextFile Err.Description
commandLine = -69
EndOfFunc:
End Function
Public Function runInboundRedixConversion(ByVal FileID As Long, ByVal inputfile As String,
ByVal IFDFile As String, _
ByVal OFDFile As String, ByVal ackfile As String, _
ByVal ERRFile As String, ByVal outputfile As String, _
ByVal convflag As Byte, ByVal SEGMENT As Byte, ByVal ELEMENT As Byte, _
ByVal COMPOSITE As Byte, ByVal Release As Byte, ByVal userdata As String, _
ByVal WarningLevel As Long, ByVal TA1File As String) As Integer
'------------------------------------------------------------------------------------------
'-- Run the inboundfile through redix command line
'-- MK 1/17/2007
'------------------------------------------------------------------------------------------
Dim intRedixReturn As Integer
Dim strConfigName As String
Dim strFolderPath As String
Dim slashPos As Long
Dim fsObj As New Scripting.FileSystemObject
Dim writeObj As Scripting.TextStream
On Error GoTo ErrorHandler
'//-- Create config file -----------------------------------
slashPos = InStrRev(outputfile, "\")
strFolderPath = Mid(outputfile, 1, slashPos)
strConfigName = strFolderPath & FileID & "_" & Format((Timer * Rnd(9)), "000000######") &
".cfg"
LogToTextFile "Creating : " & strConfigName
Set writeObj = fsObj.OpenTextFile(strConfigName, ForAppending, True)
writeObj.WriteLine "INFILE = " & inputfile
writeObj.WriteLine "IFD = " & IFDFile
writeObj.WriteLine "OFD = " & OFDFile
writeObj.WriteLine "ACKFILE = " & ackfile
writeObj.WriteLine "ERRFILE = " & ERRFile
writeObj.WriteLine "OUTFILE = " & outputfile
writeObj.WriteLine "CONVFLAG = " & Chr(convflag)
writeObj.WriteLine "SEGSEP = " & Chr(SEGMENT)
writeObj.WriteLine "ELEMSEP = " & Chr(ELEMENT)
writeObj.WriteLine "COMPSEP = " & Chr(COMPOSITE)
writeObj.WriteLine "RELCHAR = " & Chr(Release)
writeObj.WriteLine "USERDATA =" & userdata
writeObj.WriteLine "WARNINGLEVEL = " & CStr(WarningLevel)
writeObj.WriteLine "TA1FILE = " & TA1File
writeObj.Close
'//-- END Create config file --------------------------------
'--run redix
runInboundRedixConversion = commandLine(strConfigName)
GoTo EndOfFunc
ErrorHandler:
runInboundRedixConversion = -99
LogToTextFile Err.Description
EndOfFunc:
On Error Resume Next
fsObj.DeleteFile strConfigName
Set fsObj = Nothing
On Error GoTo 0
End Function
Public Sub LogToTextFile(ByVal strMessage As String)
Dim fsObj As New Scripting.FileSystemObject
Dim writeObj As Scripting.TextStream
Dim strLogName As String
If Not fsObj.FolderExists(App.Path & "\Logs") Then
fsObj.CreateFolder (App.Path & "\Logs")
End If
strLogName = Replace(App.Title, " ", "")
Set writeObj = fsObj.OpenTextFile(App.Path & "\Logs\" & strLogName & Format(Now, "mmddyy")
& ".LOG", ForAppending, True)
writeObj.WriteLine Now() & " - " & strMessage
writeObj.Close
Set fsObj = Nothing
End Sub
'//-----------------------------------------
'// END
'//-----------------------------------------
VB code in the Form1.frm:
Private Sub Command1_Click()
ChDir "d:\dev\src\db"
ret = runInboundRedixConversion(1111, "h_a1_837p.edi", "HIPAA_A1_837_Prof_to_1500_IMG.ifd",
_
"HIPAA_A1_837_Prof_to_1500_IMG.ofd", "837p.ack", "837p.err", "1500_img.txt", _
Asc("x"), Asc("0"), _
Asc("{"), Asc("}"), Asc("?"), "", 1, "837p.ta1")
MsgBox "Return = " & ret
End Sub
Corporate Headquarter
265 Davidson Avenue
Suite 142
Somerset, NJ 08873
Sales
888.850.8088
Sales Office available M-F 8:00 - 5:00 US Pacific Time
sales@redix.com
Support
888.850.8088
support@redix.com