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

Packed Decimal to Decimal using JCL SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
HK_Endeavour Forever

New User


Joined: 15 May 2012
Posts: 5
Location: INDIA

PostPosted: Mon May 28, 2012 12:39 am
Reply with quote

Hello,

I am trying to convert a packed decimal (S9(7)V99) value to decimal using JCL SYNCSORT. I have tried the EDIT= option and various other options but I am getting a S0C7 error.

In Image1, From Column 63 till Column 66, Data is in packed decimal format. (S9(7)V99)

Image 2 ==> Hex ON and Cols on. From Column 63 till Column 66.

In first record, I want the field to be converted to decimal format.
so as an example I want to format the record and change it to show the field value as 0000347.00

Similarly on the second record, I want to format the record and change it to show the field value as 0006695.00.

Is this possible through JCL and SYNCSORT? The sign value should be preserved while converting the data.

Can anyone please advise?

JPEG ATTACHMENTS DELETED, USE A PLAIN TEXT CUT AND PASTE WITH THE BBCODE TAGS !
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 28, 2012 2:10 am
Reply with quote

Quote:
packed decimal (S9(7)V99)


is 5 bytes not 4.

syncsort goes in JCL forum not icetool.

and stop with the jpg's.
uses much to much space and screws-up the page display.
learn about BBcode

you are a new member, read the faqs and learn about packed-decimal.

what did you think was in column 67? you left off the units and sign part of your numeric.
Back to top
View user's profile Send private message
HK_Endeavour Forever

New User


Joined: 15 May 2012
Posts: 5
Location: INDIA

PostPosted: Mon May 28, 2012 9:28 am
Reply with quote

Oops! My apologies! Yes, the data is of length 5 in packed format and starts at Column 63 till Column 67

ø
00370
0040C

Ñ&
00650
0690C

I am trying to reformat the record by changing this value to a decimal or displayable form 00003470.00 in first example and 00066950.00 in second example while at the same time preserving the sign value.

SORT FIELDS=COPY
OUTREC FIELDS=(1:1,62,63:63,5,PD,M2)

SORT FIELDS=COPY
OUTREC FIELDS=(1:1,62,63:63,5,PD,EDIT=($II,III,IT.TT))

SORT FIELDS=COPY
OUTREC FIELDS=(1:1,62,63:63,5,PD,EDIT=(IIIIIIIT.TT),SIGNS=(,-,,))

I am receiving a S0C7 error. Can you please help?
This is the message in abend report "A decimal digit or sign was invalid."
Back to top
View user's profile Send private message
rakesha.hg

Active User


Joined: 21 Mar 2008
Posts: 161
Location: bangalore

PostPosted: Mon May 28, 2012 6:14 pm
Reply with quote

hi,

How about using "To=ZD/PD/BI" & "length=" options in conjunction with your edit parameter ??
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 28, 2012 6:26 pm
Reply with quote

a Soc7 error is generated based on non-numerics in a source field.

redefinition of output field is a waste of time and shows an ignorance of the problem.

you should probably verify that the 'packed-decimal' field is numeric,
before you attempt to use it.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon May 28, 2012 6:29 pm
Reply with quote

You are showing correct packed-decimal data in your two examples.

Is your file VB? Have you allowed the the RDW, so added for for the start position of all fields?
Back to top
View user's profile Send private message
HK_Endeavour Forever

New User


Joined: 15 May 2012
Posts: 5
Location: INDIA

PostPosted: Thu May 31, 2012 5:35 pm
Reply with quote

Hello Dick,

The issue got fixed. Thank You for suggesting to check the data. I tried investigating all the records and found some records which were not in packed decimal format.

I removed those records and used the below sort card and it is working fine now.

SORT FIELDS=COPY
OUTREC FIELDS=(1:1,62,63:63,5,PD,EDIT=(SIIIIIIT.TT),SIGNS=(,-,,))

00370
0040C
Converted to 347.00
00650
0690C ==> 6695.00
Similarly
00588
0064D ==> -568.48

Thank You Everyone for your advises!!

However I have observed that spaces change to 4040404.04. Is there any way to overcome spaces changing to value 4040404.04?

Thank You!!
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu May 31, 2012 6:49 pm
Reply with quote

An IFTHEN and OVERLAY I guess.
Back to top
View user's profile Send private message
HK_Endeavour Forever

New User


Joined: 15 May 2012
Posts: 5
Location: INDIA

PostPosted: Thu May 31, 2012 7:19 pm
Reply with quote

Thanks Bill.. I will try!
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
Search our Forums:

Back to Top