|
View previous topic :: View next topic
|
| Author |
Message |
steves
New User
Joined: 26 Feb 2007 Posts: 30 Location: chicago
|
|
|
|
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
Any thoughts?
thanks |
|
| Back to top |
|
 |
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
| steves wrote: |
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ô |
Your input is binary not packed decimal.
| Quote: |
| I tried 330:296,4,BI,TO=ZD,LENGTH=8 and got 0220199H,0616199H,003ô ( didn't expect that to work) |
Why not?
| Quote: |
| I tried 330:296,4,PD,EDIT=(TTTTTTTT), and got a S0C7 |
Because your input is binary not packed decimal. |
|
| Back to top |
|
 |
steves
New User
Joined: 26 Feb 2007 Posts: 30 Location: chicago
|
|
|
|
| so how do I convert it? I tried BI,TO=ZD, that didn't work |
|
| Back to top |
|
 |
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
| steves wrote: |
| so how do I convert it? I tried BI,TO=ZD, that didn't work |
Wouldn't "330:296,4,BI,EDIT=(TTTTTTTT), " work? |
|
| Back to top |
|
 |
steves
New User
Joined: 26 Feb 2007 Posts: 30 Location: chicago
|
|
|
|
Ah HA!, it does, thank you.
Final question, I've never seen data defined as just 'COMP', usually its something COMP-3. Does COMP mean binary?
thanks |
|
| Back to top |
|
 |
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
| steves wrote: |
Ah HA!, it does, thank you.
Final question, I've never seen data defined as just 'COMP', usually its something COMP-3. Does COMP mean binary?
thanks |
Very good, and yes.
Double check the difference between BI and FI........ |
|
| Back to top |
|
 |
steves
New User
Joined: 26 Feb 2007 Posts: 30 Location: chicago
|
|
|
|
| thanks |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
steves,
TO=ZD,LENGTH=8 would work correctly with DFSORT.
For example, if we have X'0021998E' in positions 1-4, and we use:
| Code: |
INREC BUILD=(1,4,BI,TO=ZD,LENGTH=8)
|
it would give the output as:
02201998
I'm not sure what you did to get the value you say you got, but you did something incorrectly.
For more information on DFSORT formats vs COBOL formats, see:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA40/C.3?DT=20090527161936 |
|
| Back to top |
|
 |
Alexis Sebastian
New User

Joined: 04 Mar 2010 Posts: 38 Location: DC
|
|
|
|
Frank,
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. |
|
| Back to top |
|
 |
Vishwamurthy
New User
Joined: 11 Mar 2008 Posts: 57 Location: India
|
|
|
|
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..
Thanks in advance,
Vish |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
| Search for SFF in this Forum. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

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. |
|
| Back to top |
|
 |
Vishwamurthy
New User
Joined: 11 Mar 2008 Posts: 57 Location: India
|
|
|
|
| Frank Yaeger wrote: |
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. |
It does work wonders. Thanks Frank
U guys r awesome lot.. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|