IBM Sterling Transformation Extender

 View Only

 Wanted to write entire record to error file in case of invalid Initiator found

Sirisha Mudumbai's profile image
Sirisha Mudumbai posted Tue June 10, 2025 07:13 AM

I have a map converting Flat file to X12 format. I have different record types called HEADER, TERMS, DETAIL, INSTALL etc. 
I have created input type tree with initiator for each record type. 
My question here is in case of invalid record type in my input I wanted to write the entire set into a file instead of failing my map. 
I don't have a field that identifies each record type. I am not sure how to handle it.

Thanks in advance!!  


Steve Arbo's profile image
Steve Arbo

We map flat files to X12 also and when we don't want to fail the entire file, we use the REJECT function to write the bad records to an error file.

Sirisha Mudumbai's profile image
Sirisha Mudumbai

Hi
Thanks for your response!!
My records get written into BAD file in case of error. But only in this case (I mean when the record type is not in the list of records listed) its not writing to BAD file instead the map is failing

Lisa Edwards's profile image
Lisa Edwards

If you need the whole input file put to error when there is an invalid initiator you can use ISERROR(Input) | CONTAINSERRORS(Input) to check for and create your error file or your good input.  So in your card creating the good input use IF(NOT(ISERROR(Input)) | NOT(CONTAINSERRORS(Input)), f_build_good_stuff(Input), NONE)  then create an error output card and use IF(ISERROR(Input) | CONTAINSERRORS(Input), PACKAGE(Input), NONE) and have the cards set to CreateOnContent.  That way you get no good stuff and you can send the bad stuff to a error directory of your choosing.

If you can reject partial transactions within the file - ex. keep/create good and throw out bad, then use REJECT as Steve suggests.

Happy Mapping!