I am trying to convert an XML message (Input Message) to a COBOL copybook (Output message) using a Compute node. As most of you know, a COBOL copybook is a fixed length file format.
If I directly assign an element in the XML message (Input) to a COBOL copybook field (Output), the COBOL copybook field is nullified when the XML element is null (eg: <middlename\>). This is causing the next field in the COBOL copybook to take the space of the current element thus disrupting the Message format. I can use COALESCE function to avoid this situation but then I have to use it for every COBOL copybook field that is getting its value from the Input XML element because there is a potential for any of the XML elements in the Input to be null.
Using COALESCE function for every COBOL copybook field doesn't seem to me like a elegant solution. I also tired using the Nillable property in the DFDL message when creating the Message Model for the COBOl copybook. Below are my Nillble properties I set in the DFDL.
Nillable -> True
Nil Kind -> literalCharacter
Nil Value -> %SP
Use Nil for Default -> no
But that didn't work either. I am wondering if anyone came across a similar situation and if so please let me know if there is a better way to handle this.