View previous topic :: View next topic
|
Author |
Message |
Arunkumar Chandrasekaran
New User
Joined: 01 Jun 2010 Posts: 63 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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
Hopefully, someone else will recall this . . . |
|
Back to top |
|
|
Simone Salzmann
New User
Joined: 26 Nov 2012 Posts: 17 Location: Switzerland
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 . .
My bad if i've only added clutter - it can be removed. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
dick scherrer wrote: |
@Kolusu
I'm not sure about the 19,2,BI . .
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 |
|
|
Simone Salzmann
New User
Joined: 26 Nov 2012 Posts: 17 Location: Switzerland
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Right now, i'm not sure exactly what we have or where we are
Possibly some clarification will be posted . . . |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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:
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 |
|
|
Arunkumar Chandrasekaran
New User
Joined: 01 Jun 2010 Posts: 63 Location: India
|
|
|
|
@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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
|