IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

S0C7 when converting to Zoned Decimal in DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
steves

New User


Joined: 26 Feb 2007
Posts: 30
Location: chicago

PostPosted: Thu Jun 03, 2010 8:29 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jun 03, 2010 8:47 pm
Reply with quote

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
View user's profile Send private message
steves

New User


Joined: 26 Feb 2007
Posts: 30
Location: chicago

PostPosted: Thu Jun 03, 2010 8:50 pm
Reply with quote

so how do I convert it? I tried BI,TO=ZD, that didn't work
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jun 03, 2010 9:03 pm
Reply with quote

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
View user's profile Send private message
steves

New User


Joined: 26 Feb 2007
Posts: 30
Location: chicago

PostPosted: Thu Jun 03, 2010 9:08 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jun 03, 2010 9:10 pm
Reply with quote

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
View user's profile Send private message
steves

New User


Joined: 26 Feb 2007
Posts: 30
Location: chicago

PostPosted: Thu Jun 03, 2010 9:11 pm
Reply with quote

thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jun 03, 2010 10:17 pm
Reply with quote

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
View user's profile Send private message
Alexis Sebastian

New User


Joined: 04 Mar 2010
Posts: 38
Location: DC

PostPosted: Fri Jun 04, 2010 10:24 am
Reply with quote

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
View user's profile Send private message
Vishwamurthy

New User


Joined: 11 Mar 2008
Posts: 57
Location: India

PostPosted: Thu Mar 31, 2011 5:44 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Mar 31, 2011 5:58 pm
Reply with quote

Search for SFF in this Forum.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 31, 2011 11:23 pm
Reply with quote

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
View user's profile Send private message
Vishwamurthy

New User


Joined: 11 Mar 2008
Posts: 57
Location: India

PostPosted: Fri Apr 01, 2011 4:58 pm
Reply with quote

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 icon_smile.gif

U guys r awesome lot..
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top