Page 1 of 1

How to join 2 packed fields ?

PostPosted: Fri Feb 17, 2012 2:05 pm
by SMain
Hi ,

I have to join 2 files on the feilds which are packed .
One field has signed positive packed number and the other has unsigned positive packed number . Will I get a match if I'm able to join the files

Re: How to join 2 packed fields ?

PostPosted: Fri Feb 17, 2012 2:18 pm
by BillyBoyo
Which sort product are you using? Sizes of fields? DCB and RECFM?

Have you looked at your product's documentation? The answer will be there. Look at the definitions of data types.

Re: How to join 2 packed fields ?

PostPosted: Fri Feb 17, 2012 2:58 pm
by SMain
I have 2 fields, 1 is of 10 packed and other is 20 ZD ,So I've converted the 2nd field in PD and now I'm trying to join using Syncsort
JOINKEYS FILE=F1,FIELDS=(1,10,A)
JOINKEYS FILE=F2,FIELDS=(2,10,A)
But the probme I'm facing is that since I converted a ZD to PD , I have 'F' in my last nibble whereas in the other file I have 'C' in the last nibble .

Re: How to join 2 packed fields ?

PostPosted: Fri Feb 17, 2012 3:03 pm
by enrico-sorichetti
unlike ibmmainframes.com where syncsort issues are discussed in the JCL section
this forum has dedicated sections for both <sort> flavors

good manners dictate to post questions in he proper section.
after You have discovered the <sort> product You are using
WER.... messages ==> SYNCSORT
ICE.... messages ==> DFSORT

Re: How to join 2 packed fields ?

PostPosted: Fri Feb 17, 2012 3:15 pm
by SMain
Haven't gone through the forum completely ,saw jcl and thought this is where my query fits in .

Re: How to join 2 packed fields ?

PostPosted: Fri Feb 17, 2012 4:04 pm
by Akatsukami
SMain wrote:Haven't gone through the forum completely ,saw jcl and thought this is where my query fits in .

Please learn that this type of task is performed by a utility program, most likely either DFSORT or Syncsort, not by JCL, which in fact does nothing but establish environments and execute the programs that use them.

Re: How to join 2 packed fields ?

PostPosted: Sat Feb 18, 2012 1:19 am
by BillyBoyo
You haven't even shown or told us how you are doing the conversion. You haven't said which sort package you use.

If you are doing the conversion with Sort control cards, look at the effect of PDC instead of PD. Confirm by following my previous suggestion, so you don't have to ask each time (and proudly ask in the wrong place) you come across a new data type.

Re: How to join 2 packed fields ?

PostPosted: Sat Feb 18, 2012 1:28 pm
by Anuj Dhawan
SMain wrote:I have 2 fields, 1 is of 10 packed and other is 20 ZD ,So I've converted the 2nd field in PD and now I'm trying to join using Syncsort
JOINKEYS FILE=F1,FIELDS=(1,10,A)
JOINKEYS FILE=F2,FIELDS=(2,10,A)
But the probme I'm facing is that since I converted a ZD to PD , I have 'F' in my last nibble whereas in the other file I have 'C' in the last nibble .
I'm not sure if you are showing us exactly what you are doing because in above Sort-statements, for F1 you've the key of length of 9-bytes while for F2 it's 9-bytes. May be a typo but that's what posted on this Forum & one can refer to.

1. I've not verified but conversion from ZD to PD and compare can be done in one step.
2. If now you're dealing with "C" and "F" for the sign nibble, try the below sort:

/STEP0100 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                     
//PDF      DD DSN=Your PDF input file1,DISP=SHR
//PDC      DD DSN=Your PDC input file1,DISP=SHR
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                           
  OPTION COPY                             
  JOINKEYS F1=PDF,FIELDS=(1,10,A)         
  JOINKEYS F2=PDC,FIELDS=(1,10,A)         
  JOIN UNPAIRED                           
  REFORMAT FIELDS=(F1:1,80,?,F2:1,80)     
//JNF1CNTL DD *                           
  INREC OVERLAY=(1:1,10,PD,TO=PDC,LENGTH=10) 
//JNF2CNTL DD *                           
  INREC OVERLAY=(1:1,10,PD,TO=PDC,LENGTH=10) 
//*

Re: How to join 2 packed fields ?

PostPosted: Sat Feb 18, 2012 1:29 pm
by Anuj Dhawan
And they are DFSort control cards... .