I'm trying to convert some old data for a client to comma delimited files. I've used DFSORT to do this many times, but I'm not understanding the results I'm getting with this file. The fields are defined as
PIC 9(8) COMP.
PIC 9(8) COMP.
PIC 9(4) COMP.
although to be honest this client has poor documentation and no version control so there is no guarantee that the copybooks I find really match the data.
In the first record, for instance, the data looks like this:
X'0021998E'
X'005E064E'
X'03BC'
If I code:
330:296,4,PD,TO=ZD,LENGTH=8, or 330:296,4,PD,TO=ZD,LENGTH=7,
and then 330:296,4,PD,TO=ZD,LENGTH=4, or 3 for the 3rd field I get
this output:
,0002199Y,0005Ú06U,003ô
I tried 330:296,4,BI,TO=ZD,LENGTH=8 and got 0220199H,0616199H,003ô ( didn't expect that to work)
I tried 330:296,4,PD,EDIT=(TTTTTTTT), and got a S0C7
You are absolutely correct.
But Steve used PD for COMP variables. Since the PD,TO=ZD is an UNPacK which does not produce a data exception (S0C7) it did not fail then.
It should be BI. Thats the problem.
It was only in the EDit attempt (PD,EDIT=) that the S0C7 occured since ED will produce a data execption.
Guys,
I've used this: 330:296,4,BI,EDIT=(TTTTTTTT), to convert Binary to ZD
This works when the value is positive. But when it is negative, it generates a complement.
Like 1 displays as 1 and 3 displays as 3 whereas -1 displays as 945***98 and -3 as 945***96.
Could someone educate me if there's a way to tackle this? The above works great with PD
If I could first convert BI to PD and then to ZD and be able to display the sign in the same OUTREC for that field, it should be great. Any other ideas welcome
There's like 2M+ records which need to be corrected..
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Vish,
BI is unsigned binary (e.g. X'FFFFFFFF' = 4294967295). FI is signed binary (e.g. X'FFFFFFFF' = -1). If you are dealing with signed binary, use FI, not BI.
If you are dealing with some other type of value like -3, you need to explain more clearly what type of values you are dealing with and include an example of the input and expected output.
BI is unsigned binary (e.g. X'FFFFFFFF' = 4294967295). FI is signed binary (e.g. X'FFFFFFFF' = -1). If you are dealing with signed binary, use FI, not BI.
If you are dealing with some other type of value like -3, you need to explain more clearly what type of values you are dealing with and include an example of the input and expected output.