cancel
Showing results for 
Search instead for 
Did you mean: 

Handling Flat files from mainframe

Former Member
0 Kudos

Hi,

I have a scenario. Mainframe application uploads a flat file to a FTP server(based on UNIX). Uploading is being done in BINARY mode.

Data on mainframe looks like below (Record length is 80 characters)

H004981429001015544655526    trailing spaces for every record

H004981328001019383824047

H0049813790010000455933

When we look into the file that is uploaded the data looks like below:

Èððôùøñôòùððñðñõõôôöõõõòö@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ðððððñððÈððôùøñóòøððñðñùóøóøòôðô÷@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ðððððòððÈððôùøñó÷ùððñððððôõõùóó@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ðððððóðð

I requested mainframe people to send in in ASCII format for testing purposes and the data looks similar to how it looks on mainframe and using the below File content conversion when the file was picked up it was processed properly.

But when I picked the Binary file this all what i got:

<?xml version="1.0" encoding="utf-8" ?> 

- <ns:MT_INTF3_S xmlns:ns="http://**/in/xmlto_ffile">
- <Record>
- <Header>
<REC_TYPE>È</REC_TYPE> 
<DOC_NUM>ððôùøñôòù</DOC_NUM> 
<DIST>ððñðñõõô</DIST> 
<PO_NUM>ôöõõõòö</PO_NUM>

</Header>

</Record>

</ns:MT_INTF3_S>

Only One record was picked up. Thought formatting could be handled in Mapping. But as it is reading only one record I am unable to proceed.

When i checked in web, no CR, LF characters will be inserted while uploading in binary format.

Please help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sreedhar,

I have worked on mainframe integration in my last project. You need to contact the mainframe team and ask for an ASCII encoded flat file ...that file may be tab/coma/pipeline delimited or a fixed length file. In mainframe term they call it 'dataset' as there is no file system in mainframe. Then you can use 'RACF' id of any mainframe user to connect to the mainframe directly and pull the data.

In this process, you can treat the file same as any tab/coma/pipeline delimited or a fixed length flat file and use file content conversion to convert it into XML.

Or you can ask the mainframe team for a tab/coma/pipeline delimited or a fixed length flat file and use file content conversion to convert it into XML.

There is a technique to use the RACF id to connect to the mainframe directly, the mainframe team can help you in this.

Hope it helps!

Thanks,

Partha

Former Member
0 Kudos

Hi Partha,

   Well for test purposes, they did provide sample data which i have put here in ASCII format itself. But they are not ready to send data in ASCII mode in real time as they have been told by Client to send data in Binary format only!!

After first record, there is no CR(Carriage Return) or Line Feed(LF), hence no record shows up in the second line.. Its continuous. If I can break record by length at adpater lever and convert to XML and send to mapping, probably I can convert the data there..

Please advise.

Former Member
0 Kudos

Hi Sreedhar,

1)If you have no chance to change the sender application, then you could write an adapter module.

2) You can handle this in the mapping itself.If the record is breaking because of carriage return, you will receive a new record.Write an UDF to check the length of each record. If it is less than the Fixed Length that you are expecting then combine these 2 records into one.

Still less than the Fixed length append 3rd one also....so on.You can go for one extra graphical mapping for this.And then other mapping which you will use noramaly.In Operation Mapping specify them in sequence.

3)Secondly, you can use ConvertCRLFfromToLF bean for the converting CRLF pf windows to LF of unix and viceversa.

You can follow the link to do so...

http://help.sap.com/saphelp_nw04/helpdata/en/96/f04142099eb76be10000000a155106/content.htm

Thanks

Partha

anupam_ghosh2
Active Contributor
0 Kudos

Hi Sreedhar,

                       When they are sending data in non-ascii or binary format and you open it with notepad , how do you see the data? Is it looking like this "Èððôùøñôòùððñðñõõôôöõõõòö@@@@@@@@@@@@@@@@@@@@@@@@@@@" ?

Or you can simply read the data like any other flat file??

Regards

Anupam


Former Member
0 Kudos

Hi Anupam,

   Information security officer of client insists that data be sent in Binary format so that its readable by people.

Ya the data in the binary text file looks like

"Èððôùøñôòùððñðñõõôôöõõõòö@@@@@@@@@@@@@@@@@@@@@@@@@

Its not readable like nay other file..

And the data is present as a single line. If there three records then length is 3 x 80 =240

if its 25 records, then length is 25 x 80 = 2000


anupam_ghosh2
Active Contributor
0 Kudos

Hi Sreedhar,

                      You can't apply FCC in this data as it will invalidate the XML. There are certain steps to be followed in these situations

1. ask for the mainframe binary file format information. :- Generally such file comes in blocks of 256 bytes.

2. After you get the file format create a adapter module or java mapping code to convert the same to ascii format(human readable). Writing this code needs expertise in java low level programming.

3. You have not explained the entire scenario. Thus after conversion to ASCII format you can send the same to target server.

Regards

Anupam

Former Member
0 Kudos

Hi Anupam,

  I dont have experience with Java, so we are thinking of getting someone from other projects to write a custom adapter.

We have received the Record Layout from mainframe.

Each record is of length 80 Characters. So the primary function would be to pick first 80 characters, convert to ASCII and write to a temp file or buffer, havent decided. Once that is done, read the next 80 characters and do the same operation but write to second line and the process continues.

Once its done, we will be converting it into format specific to JDEdwards, that is again in text format.

Thanks for all your inputs. I have not worked till now on custom adapters, hopefully someone guide me in the right direction.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Sreedhar,

                       You can achieve the same using java mapping. In case you need further guidance please check this thread https://scn.sap.com/thread/1983926 on the same. The file mentioned in the thread was also from mainframe.

Regards

Anupam

Answers (3)

Answers (3)

ambrish_mishra
Active Contributor
0 Kudos

Try the Text option in adapter and try and enforce the encoding there.

Ambrish

ambrish_mishra
Active Contributor
0 Kudos

Try the Text option in adapter and try and enforce the encoding there.

Ambrish

anupam_ghosh2
Active Contributor
0 Kudos

Hi Sreedhar,

                     you wrote

"Data on mainframe looks like below (Record length is 80 characters)

H004981429001015544655526    trailing spaces for every record

H004981328001019383824047

H0049813790010000455933"

How is this file being viewed in Mainframe? Is there some specialized program in Mainframe to read such files? or you opened them in Notepad in your local system?

Regards

Anupam

Former Member
0 Kudos

Hi,

  I think Mainframe has its own way of opening flat files, I am not sure. But when they transferred the file in FTP ASCII mode, i opened it up in notepad and the data looks how i mentioned above, like any flat file.