View previous topic :: View next topic |
Author |
Message |
madisand Beginner
Joined: 29 Aug 2005 Posts: 19 Topics: 7
|
Posted: Thu Dec 22, 2005 12:14 am Post subject: Problem with repro when one of the key is PD & has negat |
|
|
Hi
I am reporing from a flat file into a VSAM . But it is failing after writing first & fifth record. This is how my input file's key looks like
Field1(X) : Field2(PD) : Field3(PD) : Field4(PD): Field5(PD)
AB : 58 : 92 : 601 : -20050702
AB : 58 : 92 : 601 : -20050602
AB : 58 : 92 : 601 : -20050502
AB : 58 : 92 : 601 : -20050402
AB : 58 : 159 : 601 : -20050702
I am getting records out of sequence from 2nd record onwards.
Can any one help me as from the data we can see that input file is in ascending order on the key & therefore data should be reproed
Thanks |
|
Back to top |
|
 |
Vinodch Beginner
Joined: 23 Dec 2002 Posts: 80 Topics: 32 Location: Chennai, India
|
Posted: Thu Dec 22, 2005 12:36 am Post subject: |
|
|
Madisand
What is the key length of a VSAM file ?
Can you sort the flat file based on the full length of the file ?. After that
please try to repro the file. _________________ Thanks,
Vinod. |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Dec 22, 2005 12:40 am Post subject: |
|
|
Madisand,
Though -20050602 is greater than -20050702 from a pure numeric perspective, it turns false for Packed Decimal representation. Just open the flat file in view mode and try issuing SORT on the entire key field (field 1 to field5), you will see that Record 2 gets re-positioned before record 1.
This how the data looks like in HEX mode. Now if you look at column 12, you have the value X'70' in first record and X'60' in the second. So when you sort, the second record is moved up as all other characters remain same except column 12.
[code:1:9710689f4e]
Command ===>
****** ***************************** Top of Data ****
-----------------------------------------------------
=COLS> ----+----1----+----2----+----3----+----4----+-
----+----F----+----F----+----F----+----F----+-
----+----1----+----2----+----3----+----4----+-
-----------------------------------------------------
000001 AB |
|
Back to top |
|
 |
madisand Beginner
Joined: 29 Aug 2005 Posts: 19 Topics: 7
|
Posted: Thu Dec 22, 2005 1:00 am Post subject: |
|
|
Thanks phantom,
You have always helped in this forum.
Numerically first key is lower than second key. I want to retain the same sequence in VSAM. How do I do it. You know any method? |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Dec 22, 2005 1:08 am Post subject: |
|
|
Madisand,
You are welcome
As explained by Cogito, try to convert the PD fields to pure numeric or if you want to save space then go for Binary (Comp). You can insert a SORT step before your REPRO to do this convertion and then change your program/copybook layout appropriately.
Or, you can probably sort the flat file on entire key using BI format (SORT FIELDS=(key_start, key_length, BI, A)) and then repro it to VSAM but this is not advisable as your program may not find the matching key (it happened to me !).
So, talk to your team and try to convert the fields from PD to someother format.
Thanks,
Phantom |
|
Back to top |
|
 |
|
|