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

Converting PD having no sign byte


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

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Thu Nov 29, 2012 11:43 pm
Reply with quote

Hi , Here is my sysin

Code:
//SYSIN DD *                                                         
  JOINKEYS FILE=F1,FIELDS=(01,08,A)                                 
  JOINKEYS FILE=F2,FIELDS=(01,08,A)                                 
  REFORMAT FIELDS=(F2:01,18,F1:17,02,19,04)                         
  INREC BUILD=(1:1,20,21:19,3,24:X'0F')                             
  OUTREC FIELDS=(1,18,19,2,BI,EDIT=(TTTTTT),LENGTH=6,X,26:21,4,PD,
                                           EDIT=(TTTTTT),LENGTH=6)               
  OPTION COPY                                                       
/*   


In my F1 Inputfile (VSAM - VB ) position (19,3) is PD but not having sign byte. when am seeing in HEX ON I can see

1 1 2
2 1 3

In a SAS program this field is defined as

@19 JSD_STRY PK1.
@20 JSD_STRM PK1.
@21 JSD_STRD PK1.

I have to convert this PD to Displayable numeric using EDIT as in OUTREC FIELDS .Since it is not having the signbyte I tried to append X'0F' in INREC BUILD.This is giving me SOC 7 abend.I believe its because of this this PD conversion.. Please help me to find where I am wrong??
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 30, 2012 12:33 am
Reply with quote

Hello,

First - those are not actually Packed-Decimal, so using PD won't work.

Months ago Frank Yeager (former DFSORT Moderator) posted a way to do what i believe you want. I do not recall the subject and do not have the time now to treasure hunt icon_smile.gif

Hopefully, someone else will recall this . . .
Back to top
View user's profile Send private message
Simone Salzmann

New User


Joined: 26 Nov 2012
Posts: 17
Location: Switzerland

PostPosted: Fri Nov 30, 2012 12:41 am
Reply with quote

Please regard the VB format of your VSAM file.
I guess you are simply checking the wrong position in it.
Make sure you process both your files in the right way.

There is a lot of documentation around for Sort and Joinkeys, for instance
here.

Please look for the handling of variable length files especially.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Nov 30, 2012 12:51 am
Reply with quote

Arunkumar Chandrasekaran,

Your control cards are a mess. If your 1 byte PD fields do not have a sign and you want readable data , just use HEX function to get the values.

use the untested control cards.
Code:

//SYSIN DD *
  JOINKEYS FILE=F1,FIELDS=(01,08,A)
  JOINKEYS FILE=F2,FIELDS=(01,08,A)
  REFORMAT FIELDS=(F2:01,18,F1:17,5)
  INREC BUILD=(1,18,19,2,BI,EDIT=(TTTTTT),X,21,3,HEX)
//*
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 30, 2012 1:47 am
Reply with quote

Hello,

@Simone - i suspect the issue is neither about packed-decimal nor "wrong positions" in the file.

The input data is x'121123' and the wanted output is x'F1F2F1F1F2F3' (if i understand the question), so that the final output can be shown as 121123.


@Kolusu
I'm not sure about the 19,2,BI . . icon_confused.gif
My bad if i've only added clutter - it can be removed.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Nov 30, 2012 2:23 am
Reply with quote

dick scherrer wrote:
@Kolusu
I'm not sure about the 19,2,BI . . icon_confused.gif
My bad if i've only added clutter - it can be removed.


I am guessing that this topic is an extension of an earlier topic by OP who wanted to match and convert a binary field to readable format as mentioned in here.

ibmmainframes.com/viewtopic.php?p=304975#304975

So I left the conversion part as is and showed the conversion of PD field without a sign.
Back to top
View user's profile Send private message
Simone Salzmann

New User


Joined: 26 Nov 2012
Posts: 17
Location: Switzerland

PostPosted: Fri Nov 30, 2012 2:36 pm
Reply with quote

Hi, Dick

you're possbily very right. *smile*

I saw the date as well in positions 19-21 but I believed Arunkumar when he mentioned a "packed" field. And as the three bytes he referred to aren't packed I thought of a position mess.
I should know better, though, than to believe such statements.

Arunkumar - you wouldn't really change the data you have to reformat just to make them fit your ideas, would you?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 30, 2012 8:23 pm
Reply with quote

Hello,

Right now, i'm not sure exactly what we have or where we are icon_confused.gif

Possibly some clarification will be posted . . .
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Nov 30, 2012 8:30 pm
Reply with quote

If Arun-kun's initial description is correct (and we've been here long enough to know that there is a non-trivial probability that it isn't), then it would seem that someone got cute and tossed in a BCD (binary coded decimal) field.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 30, 2012 8:55 pm
Reply with quote

Quote:
tossed in a BCD (binary coded decimal) field.
Yup, and iirc, Frank (or someone) posted a way to deal with this a while back . . .

Also posted (again, iirc) was a way to retrieve the digits and not the sign from an actual packed-decimal value.

Been too long . . .

d
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Nov 30, 2012 9:17 pm
Reply with quote

Hmm. We had a related situation a few months back; our users had to use a date manipulation routine that, for some reason lost in the mists of time, wanted the date supplied as a 3-byte BCD number. Our response, though, was to write a bit of PL/I to do the conversion, as it had to be done on-line with the users supplying dates as EBCDIC tokens.
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: Fri Nov 30, 2012 9:20 pm
Reply with quote

Quote:
Your control cards are a mess


What was meant by that, I believe, is that the starting position of the data got confused between the original source record, where it is 19,3 and the REFORMAT record, where is is 21,3 but is used as 19,3.

With the correct position, the attempt at the solution by appending with X'0F' should have been successful, given that the mandatory trailing zero would have to be removed from the output as well.

Code:
//BCDPRT   EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD *
DATE-VALUE,X'121123'
//SORTIN   DD *
                                                         
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INREC OVERLAY=(1:DATE-VALUE,X'0F',1:1,4,PD,ZD,LENGTH=7)


Output is:

Code:
1211230


Kolusu's HEX solution saves any further messing. If What You See (in hex) is What You Want (to see displayed in human-readable form) then HEX is your man.

The original source of the date seems to be three one-byte fields defined in SAS. Having nearly exhausted my SAS knowledge in spelling it, I'll leave someone else to explain how that works.
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Tue Dec 04, 2012 9:56 pm
Reply with quote

@Skolusu
I used the HEX and now I got what I need.Thank u somuch!!!!
Can you tell what are the different functions available like HEX.
I looked thru DFSORT manual .but not able to get it.

@Bill Woodger

Yes.I gave my positions wrongly as you said.I corrected then got the
correct output.But as you said HEX is very perfect for my requirement.
Thanks for your time.

Finally I have one doubt.whether my fields are packed?? if yes
how it is treated as packed without sign byte??

If not what is the meaning of the definition here in SAS

@19 JSD_STRY PK1.
@20 JSD_STRM PK1.
@21 JSD_STRD PK1.
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: Tue Dec 04, 2012 10:33 pm
Reply with quote

BCD is Binary Coded Decimal.

X'121123' could be BCD for the 23rd November 2012.

Packed-decimal would look like this:

X'0121123F' where the F might also be C. The F or C indicates the sign as unsigned (F) or positive (C).

If you notice, due to the need to keep the sign in the packed-decimal, the field is half-a-byte longer. Since you can't have "half-bytes", it is a byte longer than strictly necessary.

DFSORT has a PD0 field definition which can effectively treat a packed-decimal as BCD. That, along with HEX, are well-documented in the DFSORT manuals and publications.

If you have X'11' and you want it to be 11 not 17, then it is BCD (although it doesn't really matter about what it is called).

You can find more with google for BCD, Binary Coded Decimal.

For how the SAS works, give it a day, and if no-one has answered, post a new question in Other Mainframe Topics which seems to be where SAS questions live.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Dec 05, 2012 3:16 am
Reply with quote

Arunkumar Chandrasekaran wrote:
@Skolusu
I used the HEX and now I got what I need.Thank u somuch!!!!
Can you tell what are the different functions available like HEX.
I looked thru DFSORT manual .but not able to get it.


Can you tell me which DFSORT manual you searched? A Simple search for HEX in the DFSORT Application Programming Guide yields 26 topics have matches for: HEX
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 Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts Converting fixed length file to excel... IBM Tools 7
Search our Forums:

Back to Top