View previous topic :: View next topic
|
Author |
Message |
Aneesh
New User
Joined: 30 Sep 2006 Posts: 60
|
|
|
|
Hi,
A question on FILEAID available options.
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.
Regards,
Aneesh. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
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. |
|
Back to top |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
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. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 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.
You could also use a huge STRING in COBOL. |
|
Back to top |
|
|
Aneesh
New User
Joined: 30 Sep 2006 Posts: 60
|
|
|
|
Thanks Dick, Ed and Bill for your suggestions.
Dick,
I would prefer not to create more copybooks as maintenance will become more.
Ed,
It definitely was not useless. Thanks for confirming there is no automagic option.
Bill,
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.
Thanks all for your time and help.
Thanks,
Aneesh. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
There is a sample REXX program to take a COBOL copybook and turn it into SORT symbols. Worth the effort to get it working.
Having included your symbols, copy them, chop them about with the editor (or REXX, or SORT) until you've got just a list of the names, starting after column one, with a trailing comma:
A-COMMA-DELIMITER,C','
Make a liine with
Put a C(opy) line command on that, and use AK line command on each of your actual data-name lines except the last,
[code] THIS-NAME,
THAT-NAME,
THE-OTHER-NAME [/code
So you get this:
[code] THIS-NAME,
A-COMMA-DELIMITER,
THAT-NAME,
A-COMMA-DELIMITER,
THE-OTHER-NAME [/code
Then just
[code]INREC BUILD=(THIS-NAME,
A-COMMA-DELIMITER,
THAT-NAME,
A-COMMA-DELIMITER,
THE-OTHER-NAME) [/code
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. |
|
Back to top |
|
|
|