I have a mainframe sequential file (PS) and its corresponding copy book layout. The objective is to create a new sequential file with the fields separated by a tab/comma (the field definition is as per copybook) - so that the file can be ftped and end user able to import into excel.
As of now, we are using a sort card to insert tab/comma at desired positions - but we are having more and more files to do this and copy book changes have also happened needing to change sort cards.
Tried the xmlgen option and importing as xml table to excel. Wanted to check if there was a more easier option to generate a csv/tab delimited file.
Joined: 23 Nov 2006 Posts: 19251 Location: Inside the Matrix
One easy way is to clone the copybook inserting a filler with a value x'05' after each field. The new copybook would have a new name but all of the fields hae the names of the original. Then just do a move corresponding and all of the fields will be copied and the "new record" will have the tab delimeters.
This may seem useless to say, but I've really put some thought into this and can't think of a way.
The best I could come up with was to create a set of copybooks with that match the original, except with fields for the tab character inserted. Then use the File-Aid convert option.
The problem is, it's not much less work that what you're already doing.
I have a REXX that reads a formatted copybook print from FileAid for another purpose. You could write one like that and have it build your sort cards automatically. That would save some work. It's not fancy, and doesn't work with redefines or occurs.
Joined: 09 Mar 2011 Posts: 7312 Location: Inside the Matrix
What your problem with xmlgen route?
If you generate symbols for your SORT from the COBOL copybooks, each time the copybook changes, and use them in your Sort Control Cards, then you have no changes to code when the copybook changes. Just submit, and it's done.
I would prefer not to create more copybooks as maintenance will become more.
It definitely was not useless. Thanks for confirming there is no automagic option.
XMLGEN output - importing the xmlfile to excel is not working (excel ends up hanging) when there are a lot of records (50000+ records). It works for small to medium sized files. Also, say there are 50 fields as per copybook definition, each record in input file gets split into 50 xml tag records in xmlgen output - causing increased ftp time and excel import issues for large files.
The option to create a sort card based on symbols from copybook seems a good option. I will give that a try.
And you're good-to-go. Re-generate the symbols when the copybook changes. Have the symbols in a PDS/PDSE. Submit each of the 40, 50, 93 SORTs each time. Nothing else to do, if you've been accurate with the timing of the generation.
Yes, it is simple enough to generate the SORT Control Cards as well.