cancel
Showing results for 
Search instead for 
Did you mean: 

reading fixed width cobol file in snaplogic using python script

venkat475
New Contributor II

hi Team,

i am currently using this copybook layout in datastage and reading the content in the file.now i am trying to read this content using snaplogic script snap using python script.but i am not getting the expected output as datastage process.so could you please help me to get this done.

i am attaching the existing cobol file copybook layout which i am using in datastage and the python script which i am using for snaplogic process.

attachments added

1.python code_1

2.python code_2

3.cobol layout file

4.output for the datastage and python script in output.txt file

5.sample data input data

3 REPLIES 3

rdill
Admin Admin
Admin

If this is a valid copybook file, we have a COBOL Copybook parser that would do this with one snap, Ref: https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/2386591995/Copybook+Snap+Pack

Other snaps of interest would be the transcoder and fixed width parser snaps

 

venkat475
New Contributor II

Hi rdill,

We don't have the copybook parser snap.so that's why I am trying to read this cobol file using this python script and passing the output as Json.

 

Sp could you please help me how to execute this python script in script snap 

venkat475
New Contributor II

this is my copybook layout and sample file how to convert this into csv using the python script