Need amount difference + remarks while using JOINKEYS



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Need amount difference + remarks while using JOINKEYS

Postby vikas.sharma » Mon Dec 27, 2010 8:39 pm

My SORT STEP:
//SORT1    EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                                 
//SORTJNF1 DD DISP=SHR,DSN=INFILE1   
//SORTJNF2 DD DISP=SHR,DSN=INFILE2   
//SORTOF01 DD DSN=OUTFILE1,               
//            DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE)
//SORTOF02 DD DSN=OUTFILE2,               
//            DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE)
//SORTOF03 DD DSN=OUTFILE3,               
//            DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE)
//SYSIN    DD *                                             
  JOINKEYS FILE=F1,FIELDS=(8,8,A)                           
  JOINKEYS FILE=F2,FIELDS=(8,8,A)                           
  JOIN UNPAIRED                                             
  REFORMAT FIELDS=(F2:1,31,F1:1,31)                         
  SORT FIELDS=COPY                                         
  OUTFIL FILES=03,INCLUDE=(1,1,CH,EQ,C' '),BUILD=(32,31)   
  OUTFIL FILES=02,INCLUDE=(32,1,CH,EQ,C' '),BUILD=(1,31)   
  OUTFIL FILES=01,SAVE,BUILD=(1,31)                         
/*                                                         
//*

This works perfectly fine but I have got thru only part of my requirement.

My Input Data (not showing in hex format, confusing!!, so giving the equivalents here)
Both file 1 and file 2 has same layout
fields defined as follows
file no 1-13 (packed decimal) - Occupies 1,7 bytes
pol seq 14-21(char) - Occupies 8,8 bytes
amount 22-32 (packed decimal, 2 decimals) - Occupies 16,6 bytes
tran date 34-42 (char) - Occupies 22,10 bytes

File1:
0000000012345AZ0000010000002935010\12\2009
0000000012346AZ0000020000001935010\12\2010
0000000012347AZ0000030000000935010\12\2011
0000000012348AZ0000040000000835010\12\2012
File2:
0000000012346AZ0000020000001935010\12\2010
0000000012347AZ0000030000000935010\12\2011
0000000012348AZ0000040000001835010\12\2012
0000000012349AZ0000050000000735010\12\2013

What I have arrived so far is the 3 output files
a) present in file 1 but not in file 2
b) present in file 2 but not in file 1
c) present in both files

Output required (although the current LRECL I have given as 31, It will be in total 61 bytes for my remarks field)

a) present in file 1 but not in file 2 (additional remark at 32,30 - 'PRESENT only in file1')
b) present in file 2 but not in file 1 (additional remark at 32,30 - 'PRESENT only in file2')
c) present in both files (additional remark at 32,30 - 'DIFF AMOUNT'- numeric value of difference between amount fields file1-file2)

sample output 1:
0000000012346AZ0000020000001935010\12\2010 DIFF AMOUNT : 000000000.00
0000000012347AZ0000030000000935010\12\2011 DIFF AMOUNT : 000000000.00
0000000012348AZ0000040000001835010\12\2012 DIFF AMOUNT :-000000100.00

Anyhelp on letting me to commands or ways I could use to achieve this is much appreciated!!
vikas.sharma
 
Posts: 5
Joined: Mon Dec 27, 2010 4:22 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need amount difference + remarks while using JOINKEYS

 

Re: Need amount difference + remarks while using JOINKEYS

Postby vikas.sharma » Mon Dec 27, 2010 8:48 pm

:) I was able to get one more step clear.. please see my changed SYSIN

added remarks successfully. I used OUTREC instead of BUILD. I couldnt bring the amount difference.. not getting a clue on how to do it. :?

//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(8,8,A)
JOINKEYS FILE=F2,FIELDS=(8,8,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F2:1,31,F1:1,31)
SORT FIELDS=COPY
OUTFIL FILES=03,INCLUDE=(1,1,CH,EQ,C' '),
OUTREC(1:1X,2:32,31,33:1X,C'PRESENT ONLY IN FILE2')
OUTFIL FILES=02,INCLUDE=(32,1,CH,EQ,C' '),
OUTREC(1:1X,2:1,31,33:1X,C'PRESENT ONLY IN FILE1')
OUTFIL FILES=01,SAVE,OUTREC(1:1X,2:1,31,33:1X,C'DIFF :')
/*
vikas.sharma
 
Posts: 5
Joined: Mon Dec 27, 2010 4:22 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need amount difference + remarks while using JOINKEYS

Postby Frank Yaeger » Mon Dec 27, 2010 9:33 pm

What is the RECFM and LRECL of the input files?

Please run this job and post the //SYSOUT messages you receive:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DUMMY
//SYSIN    DD    *
    OPTION COPY
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: Need amount difference + remarks while using JOINKEYS

Postby vikas.sharma » Tue Dec 28, 2010 12:45 pm

hooray! I got it.. :D

OUTFIL FILES=01,SAVE,
OUTREC(1:1X,2:1,31,33:1X,34:C'DIFF AMOUNT: ',
47:16,6,PD,SUB,47,6,PD,M4,LENGTH=15)

I am using a SUB keyword and a M4 edit (formatting purpose)

@frank thanks for you, I got to know SUB keyword from one of your earlier posting in a website.
Although it looks simple now, I was not knowing the keyword and how to use it before. Simple things trouble me the most..

anyways, my LRECL is 31 and RECFM is FB.. My syncsort version is 1.3.1 (If that is the reason u have asked me for a SYSOUT)

Thanks for anyone who attempted to try a solution for me..
vikas.sharma
 
Posts: 5
Joined: Mon Dec 27, 2010 4:22 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need amount difference + remarks while using JOINKEYS

Postby NicC » Tue Dec 28, 2010 12:51 pm

If you are using SYNCSORT then this should have been posted in the SYSNCSORT section of the forum and Frank could have continued his holiday in peace.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2702
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Need amount difference + remarks while using JOINKEYS

Postby vikas.sharma » Tue Dec 28, 2010 1:15 pm

Oh! mine. I didnt know that there is a separate section for SYNCSORT. scrolled and stopped at the first SORT word I saw and posted there. My bad!!

Thanks for pointing out NicC. Will be great if someone can move this to SYNCSORT section.
vikas.sharma
 
Posts: 5
Joined: Mon Dec 27, 2010 4:22 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post