C++ Unified API

Requirements

Please see the readme.txt file that accompanies Instream for Instream requirements information.

You also need:

Files

Note: If you plan to make changes to the sample code, copy the project to a different directory. Sample files are reinstalled with each release.

UNIX Files

API\C++Sample Directory

File

Location / Purpose

InStreamAPISample.h

Sample header file that funnels the detailed results and summary results to your program one line at a time.

InStreamAPISample.cpp

Sample source code that you can edit.

 

Required Files

 

FSInStreamunix.h

Instream’s API \ Include directory

Defines the classes, procedures, and constants needed to interface to the Instream Validation Engine. Include it in your C++ source file. The main class needed (and contained in this file) is FSInStream, which is described in the next section.

Note: Do not modify this file. This object is passed to the validation engine and might be changed when you upgrade to a newer version.
 

FSInStreamunix.cpp

 

Instream’s API/ Source directory

File that actually calls the validation engine. Add FSInStream to you own project that calls the Validation engine.

Note: Do not change this file. This object is passed to the validation engine and may be changed with the next installation.
 

libHVInStream.so/sl

Instream’s Bin directory

The Instream dynamic-link library.

Include the Bin directory is the system’s Path.

Windows Files

Instream’s API\InStreamAPISample Directory

File

Location / Purpose

InStreamAPISample.h

Sample header file that funnels the detailed results and summary results to your program one line at a time.

InStreamAPISample.cpp

Sample source code that you can edit.

 

Required Files

 

FSInStream.h

 

Instream’s API \ Include directory

Defines the classes, procedures, and constants needed to interface to the Instream Validation Engine. Include it in your C++ source file. The main class needed (and contained in this file) is FSInStream, which is described in the next section.

Note: Do not change this file. This object is passed to the validation engine and may be changed with the next installation.
 

FSInStream.cpp

 

Instream’s API \ Source directory

File that actually calls the validation engine. Add FSInStream to your own project that calls the Validation engine.

Note: Do not change this file. This object is passed to the validation engine and may be changed with the next installation.
 

Visual Studio Version Specific Files in Instream's API/InStreamAPISample/VS201x Directories

There are two versions of the Windows C++ API Sample for use with different versions of Microsoft's Visual Studio. The Visual Studio 2010-specific files are found in the folder VS2010, while the Visual Studio 2015 (and later)-specific files are found in the folder VS2015.

 

InStreamAPISample_VS201x.sln

Visual Studio solution file for sample project.

 

InStreamAPISample_VS201x.vcxproj

Visual Studio project file for sample project.

 

HVInStreamD_VS201x.dll

Debug build of the Instream dll located in the DLLs sub-folder under the VS201x folder. If you wish to use this build, copy it to the Instream/Bin directory and rename it to HVInStreamD.dll. (Be sure to include the Bin directory in the system's PATH.)

 

HVInStreamR_VS201x.dll

Release build of the Instream dll located in the DLLs sub-folder under the VS201x folder. If you wish to use this build, copy it to the Instream/Bin directory and rename it to HVInStream.dll. (Be sure to include the Bin directory in the system's PATH.)

FSInStream Class

The FSInStream class is the link between your C/C++ application and the Instream Validation Engine Library. An object of the FSInStream class is initiated, its input parameters initialized to the appropriate files, options, etc. and then the Analyze procedure is called to perform the validation.

Method Details
Analyze

Once you have called the necessary Set and Get methods, call the Analyze method to perform the actual validation. Return codes are listed in TIBCO Foresight® Instream® Validation Technical Manual

If a return code indicates an error, you can use the function GetLastErrorMessage to get a detailed description of the er

Example:

int retVal=myInStream.Analyze();

RespGen

Once you have called the necessary Set and Get methods, call the RespGen method to perform the actual generation of 997, 999, 824, 277, or custom text reports.

Return codes are listed in TIBCO Foresight® Instream® Response Generator

Example:

retVal=myInStream.RespGen();

Split

Once you have called the necessary Set and Get methods, call the Split method to perform the actual document splitting.

Return codes are listed in TIBCO Foresight® Instream® Document Splitter.

Example:

retVal=myInStream.Split();
Substitution

Once you have called the necessary Set methods, call the Substitution method to run Docsplitter.

Return codes are listed in TIBCO Foresight® Instream® Document Splitter.

Example:

retVal = myInStream.Substitution();
DocumentLevelOnly

This lets you process EDI data that has no enveloping. When set to true, the Interchange and Functional Group envelope is processed with the data in SetIntEnvelope and SetFGEnvelope (below).

Both SetIntEnvelope and SetFGEnvelope must be included if you want to use DocumentLevelOnly.If the incoming EDI data contain an Interchange and Functional Group Envelope, its enveloping will always be used regardless of DocumentLevelOnly.

Another method for document only processing is to use m_separator (see page C++ Unified API).

Example:

//Set Document Level Only Parameters

myInStream.DocumentLevelOnly(true);

myInStream.SetIntEnvelope("ISA*00* *00* *01*9012345720000 *01*9088877320000 *020108*1042*U*00200*000000001*0*T*:!");

myInStream.SetFGEnvelope("GS*HP*901234572000*908887732000*20020108*1615*1*T*004010X091!");

 

getDocReport (memory output only) Memory buffer for the Docsplitter report
 

Example:

p=myInStream.getDocReport();

getInValidEdi (memory output only) Memory buffer for the Invalid EDI file created by Docsplitter.
 

Example:

p=myInStream.getInValidEdi();

GetLastErrorMessage Returns the text of the last error encountered by Instream validation.
 

Example:

if(retVal != FSSUCCESS) printf("%s",myInStream.GetLastErrorMessage());

GetRGoutput997

GetRGoutput999

GetRGOoutput277

GetRGOoutput824

GetRGOoutputTA1

GetRGOoutputReport

(Response Generator memory output only)

These are the buffer names for the Response Generator output.

 

Example:

char * myInStream.GetRGOoutput277();

myInStream.m_RGReportItem.rg_999=true;

const char *p=myInStream.GetRGoutput999();

getValidEdi (memory output only) Memory buffer for the Valid EDI file created by Docsplitter.

Example:

char * myInStream.getValidEdi();

getVersion

Returns the version of Instream being used.

Example: 9.1.0

Example:

char * getVersion();

FSInStream * myObj=new dllDriver();

printf("HVInStream Version = %s",myObj->getVersion();

m_svrty.SUM_ severity

(File-based output only)

Returns count of errors of a particular severity:

IgnoreCount

InfoCount

WarningCount

ErrorCount

FatalCount

User1Count

User2Count

Example:

//*** Split the input EDI file, if there are errors ***

if( myInStream.m_svrty.SUM_FatalCount > 0 || myInStream.m_svrty.SUM_ErrorCount > 0 )

{ …

m_etype.SUM_ type

(File-based output only)

Returns count of errors of a particular type:

TypeZeroCount

SyntaxCount

TypeTwoCount

SituationCount

CodeSetCount

ProductCount

PayerCount

PartnerCount

Example:

if( myInStream.m_etype.SUM_SyntaxCount > 0 ||

myInStream.m_etype.SUM_TypeTwoCount > 0 )

{ …

m_originalFileInfo.mon

m_originalFileInfo.day

m_originalFileInfo.year

m_originalFileInfo.hour

m_originalFileInfo.min

m_originalFileInfo.sec

m_originalFileInfo.fsize

m_originalFileInfo.FilePathName

Specifies the month, day, year, hour, minute, second, size, and path of the original EDI file.

m_separator

For “document only” validation - when the data does not have ISA or GS enveloping, or when the enveloping is to be ignored.

m_separator.seg

m_separator.elm

m_separator.comp

Delimiters and separators for document only validation. They can be in these formats:

integer example: 29

hexadecimal example: 0x1E

character example: ~

m_separator.ignoreENV

Validation is to ignore ISA and GS enveloping and use the separators provided with m_separator.seg, m_separator.elm and m_separator.comp.

This requires that m_separator.seg, m_separator.elm and m_separator.comp be provided, and it must come AFTER them.

Another method for document only processing is to use DocumentLevelOnly (see page C++ Unified API).

Example:

myInStream.m_originalFileInfo.mon=2;

myInStream.m_originalFileInfo.day=25;

myInStream.m_originalFileInfo.year=2005;

myInStream.m_originalFileInfo.hour=14;

myInStream.m_originalFileInfo.min=12;

myInStream.m_originalFileInfo.sec=34;

myInStream.m_originalFileInfo.fsize = 9999989;

strcpy(myInStream.m_originalFileInfo. FilePathName,"C:\\Temp\\abc.txt");

myInStream.m_separator.seg='~';

myInStream.m_separator.elm='*';

myInStream.m_separator.comp=':';

myInStream.m_separator.ignoreENV=true;

rg_277

rg_824

rg_997

rg_999

rg_TA1

rg_text

(memory output only)

If set to true, these create the specific types of Response Generator output in memory.

Example:

myInStream.m_RGReportItem.rg_824=true;

myInStream.m_RGReportItem.rg_TA1=false;

Since RGReportItem.rg is set to true, this example creates 824 output in memory.

It does not create TA1 output.

setDocReportFormat

(memory output only)

Specifies the format of the Docsplitter report, one of these:

DocXMLFormat

DocDelimitedFormat

The XML format slows performance more than the CSV format.

Example:

myInStream.setDocReportFormat(DocXMLFormat);

SetDSOptions

Docsplitter options to create valid and/or invalid EDI files using one of these:

DOC_ReportBoth

DOC_ReportInvalidOnly

DOC_ReportValidOnly

SetDSReportInvalidFile

Gives the path and filename of the Docsplitter invalid EDI file.

SetDSReportValidFile

Gives the path and filename of the Docsplitter valid EDI file.

Example:

myInStream.SetDSOptions(DOC_ReportValidOnly);

//*** ValidFile filename ***

tempString = INSTREAMROOT;

tempString +="/Output/DocSplitter_835_Valid.txt";

myInStream.SetDSReportValidFile(tempString.c_str());

//*** InValidFile filename ***

tempString = INSTREAMROOT;

tempString +="/Output/DocSplitter_835_InValid.txt";

myInStream.SetDSReportInvalidFile(tempString.c_str());

SetDSplitEdiOutputOpt

Specifies that the Docsplitter valid and invalid EDI is to be output to memory. Settings can be: OutputByMemory

OutputByFile

Example:

myInStream.SetDSplitEdiOutputOpt(OutputByMemory);

SetDSplitReportOutputOpt

Specifies that the Docsplitter report is to be output to memory. Settings can be:

OutputByMemory

OutputByFile

Example:

myInStream.SetDSplitReportOutputOpt(OutputByMemory);

SetDSReportDebug

0 turns off debug Docsplitter messages

1 turns on debug Docsplitter messages Default is 0.

Example:

myInStream.SetDSReportDebug();

SetDSReportFile

0 turns off debug Docsplitter messages

1 turns on debug Docsplitter messages Default is 0.

Example:

myInStream.SetDSReportDebug();

SetDSReportFile Sets the path and filename of the Docsplitter report. It will contain XML if the filename ends with .xml. It will be a delimited report if the filename ends with .csv.

Example:

tempString = INSTREAMROOT;

tempString +="/Output/DocSplitter_835_Report.xml";

myInStream.SetDSReportFile(tempString.c_str());

SetDSubEDIInputSourceOption

Sets Docsplitter’s EDI input to memory or file; used when Docsplitter is being used in the mode that calls Instream.

Currently, Docsplitter can output to file, but not to memory.

It can input from memory if it calls Instream, but not if it accepts validation detail results as input.

This can be set to:

InputByMemory

InputByFile

Example:

myInStream.SetDSubEDIInputSourceOption(InputByMemory);

SetDSubEDIOutputFile Points to Docsplitter’s EDI output file. Must be set to strEDIOutputFile.

Example:

myInStream.SetDSubReportFile(“c:/output/nRep.txt”);

SetGuideline

Specifies the guideline to use for the validation.

If omitted, Instream uses the first guideline encountered that matches the data’s Version/Release Identifier code (GS08).

If you are using Docsplitter, be sure it is a GuidelinePlus or is based on a GuidelinePlus (one that starts with PD).

Example:

myInStream.SetGuideline("PDSA837I");

SetInputFile

When using InputByFile, this contains the full path name to the input EDI data file to be validated.

When using InputByMemory, this contains a name or title for the data to be output in the Start Message (see STRT record in TIB_fsp-instream_<n.n>_usersguide.pdf).

Be sure the directory already exists for the specified file.

Example:

myInStream.SetInputFile(“c:/demo/nEdi.txt”);

SetInputMemory

Location of the memory buffer for the EDI data being input to Instream.

This parameter is required when SetOutputSource is OutputByMemory and is ignored otherwise.

Example:

myInStream.SetInputMemory(pBuffer);

SetInputSourceOption InputByFile – Means the filename specified with SetInputFile is the source of the EDI data. InputByMemory – Must SetInputMemory to the memory location of the EDI data.

Example:

myInStream.SetInputSourceOption(InputByMemory);

SetIntEnvelope and SetFGEnvelope Defines the Interchange and Functional Group Envelopes when DocumentLevelOnly is set to true. If the EDI data contains an Interchange or Functional Group envelope, the ones in the file will be used even if SetIntEnvelope and SetFGEnvelope have been set.
Example:

//Set Document Level Only Parameters

myInStream.DocumentLevelOnly(true);

myInStream.SetIntEnvelope("ISA*00* *00* *01*9012345720000 *01*9088877320000 *020108*1042*U*00200*000000001*0*T*:!");

myInStream.SetFGEnvelope("GS*HP*901234572000*908887732000*20020108*1615*1*T*004010X091!");

SetOutputErrorFile

When using OutputByFile, this contains the full path name of the validation detail file to be generated.

When using OutputByMemory, this contains a filename in case problems occur and Validator needs a ‘last resort’ place to put output.

Example:

myInStream.SetOutputErrorFile(“path/name”);

SetOutputSourceOption

OutputByFile – (default) Detail and Summary validation results should go to the file indicated by SetOutputErrorFile. The summary file will have the same name with SUMMARY in front of it. OutputByMemory – The methods DetailMessage and SummaryMessage will get called as an output line is created.

Avoid OutputByMemory if you are feeding the validation output into Docsplitter or Response Generator.

DetailMessage / SummaryMessage

The default version of this routine sends the message to standard output. To perform something different, override these routines in the FSInStream derived object. If you wish to terminate processing from this routine, you can return false.

Otherwise, true should be returned to continue processing.

Example:

myInStream.SetOutputSourceOption(OutputByMemory)

SetProfileFile

Specifies the name of the profile file to be used for the validation. Please see TIB_fsp-instream_n.n.n_APF.pdf.

If the path is omitted, the Bin directory is assumed.

If SetProfileFile is omitted, the validation will use the default profile $fsdeflt.apf (in Bin directory of Instream).

Example:

InStream\Bin\ourusual.apf");

SetRespGenOutputOpt

Specifies that Response Generator output goes to memory or file. It can be set to: OUTPUTBYMEMORY

OUTPUTBYFILE

Example:

myInStream.SetRespGenOutputOpt(OutputByMemory);

SetRGOptions Response Generator options, which can include any options mentioned in TIBCO Foresight® Instream® Response Generator

Example:

myInStream.SetRGOptions("-ge -y");

This example specifies that group enveloping is to be included in the response documents and that Response Generator can overwrite files if they already exist.

Important: .

Note: When specifying Response Generator options via the API, leave no space between the option and its value. For example, use -er3 instead of -er 3. Spaces may cause the API response generator call to fail.

SetRGRep824File

SetRGRep997File

SetRGRep277File

SetRGRep999File

Gives the name of the EDI 824, 997, 277, or 999 to be created by Response Generator.

Example:

myInStream.SetRGRep824File(tempString.c_str());

myInStream.SetRGRep999File(999_output_filename);

SetRGReptextFile SetRGReptempFile

SetRGRepTextFile gives the name of a custom text report to be created by Response Generator.

SetRGRepTplFile gives the name of the template file to be used when creating the custom text report.

If you use one of these, use both.

Example:

myInStream.SetRGReptextFile(“path/name”);

myInStream.SetRGReptempFile(“path/name”);

SetUserMessage

Specifies free-form text to be inserted in a GEN record with number 15078.

Example:

GEN 015078 1 0Sock 2

Example:

myInStream.SetUserMessage("Sock 2");