View previous topic :: View next topic
|
Author |
Message |
rajithmuthan
New User
Joined: 04 Jun 2007 Posts: 2 Location: USA
|
|
|
|
This is my Challenge. I tried to search in this forum and could not get it.
1. I have 40 PS files with variable and fixed length
2. These 40 files have PD and ZD in them
3. I need to build one single program which takes in both variable and fixed length files , Identifies the PD and ZD and convert them to unpacked display format.
4. The output file should be fixed length file
5. Need a cobol program/Utility to do this
Let me know if someone as any insight in to it. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You need to more clearly explain your requirement.
For one thing, i believe ZD is "unpacked display format' unless you have something else in mind.
Fields are defined, not identified by or detected from the content. There is no way to look at data programmatically and determine how long a "field" is or what data format it is. You might detect the low-order byte of a packed-decimal field, but not with any guarantee - you would also not be able to guarantee finding the length from the data.
Who came up with this "need"
Quote: |
I need to build one single program which takes in both variable and fixed length files , Identifies the PD and ZD and convert them to unpacked display format. |
It is surely not a business requirement.
If these are files that have been in use in your environment, it is likely that they have cobol copybooks. If you take the existing copybooks, and clone them, you could define the needed output fieldsd in the "new" copybooks. You could use both copybooks in a program and move the old format data to the new, unpacked format data. These would be trivial programs and once one was running, the remainder would be even more trivial. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
Dick -
I would consider display format to require separate sign (trailing or leading), rather than as part of the rightmost byte. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Phil,
Yup, i'd go along with that
Quote: |
consider display format to require separate sign (trailing or leading) |
my bad
When i mentioned right-most (low-order) byte, i was thinking of packed-decimal and the ability to differentiate between a PD field that happened to be adjacent to a binary field.
I can think of no way to derive field type/length from say 300 bytes of data - which is the requirement if i understand correctly. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Dick,
Rajith didn't mention any other data types. If these are the only 2 types in the files, you may be able to separate them.
But he may be confusing ZD with binary. In that case it can't be done. |
|
Back to top |
|
|
|