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

How do I Compare two records and set Return Code in SORT?


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

New User


Joined: 16 Oct 2008
Posts: 7
Location: USA

PostPosted: Tue Mar 06, 2012 7:44 am
Reply with quote

Hello Seniors:

I've two sequential file of LRECL=80. Each file will always have one record with 'any possible' valid date on it from Col 1 to 8 in YYYYMMDD format. I just need to compare 'month' portion of each dates and set return codes. Possibly two return codes - one for same month scenario or another for different months scenario

Case-1
For example FileOne and FileTwo have following date records. This case month is same and so set return code, say RC=0.

FileOne
20110301

FileTwo
20110331

Case-2
For example FileOne and FileTwo have following date records. This case month is different and so set a different return code, say RC=4.

FileOne
20110301

FileTwo
20110401

I wish I could get this done in SORT rather than writing a new program to do this.

Could someone please suggest a simplest and best way in SORT resulting into 'single JCL step' if possible?

FYI...I would verify these return codes in downstream steps of JCL to perform business processing depends on how RC is. Let's not worry about business processing now.

Thanks!
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Mar 06, 2012 8:13 am
Reply with quote

Hi,

try this
Code:
//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//INA      DD *                                             
20110301                                                   
//INB      DD *                                             
20110431                                                   
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  JOINKEYS F1=INA,FIELDS=(05,2,A)                           
  JOINKEYS F2=INB,FIELDS=(05,2,A)                           
  JOIN UNPAIRED                                             
  REFORMAT FIELDS=(F1:1,08,?,F2:1,8)                       
  OUTFIL INCLUDE=(9,1,CH,EQ,C'B'),NULLOFL=RC4               
//*                                                         



Gerry
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Tue Mar 06, 2012 8:14 am
Reply with quote

Hi,

Please use below mentioned SORT card.

Code:
//STEP01  EXEC PGM=SORT                       
//SYSPRINT  DD SYSOUT=*                       
//SYSOUT    DD SYSOUT=*                       
//INPUT1    DD *                             
20110301                                     
/*                                           
//INPUT2    DD *                             
20110431                                     
/*                                           
//SORTOUT   DD SYSOUT=*                       
//SYSIN    DD *                               
   OPTION COPY,NULLOUT=RC4                   
   JOINKEYS F1=INPUT1,FIELDS=(5,02,A)         
   JOINKEYS F2=INPUT2,FIELDS=(5,02,A)         
   REFORMAT FIELDS=(F1:1,80)                 
/*                                     
Back to top
View user's profile Send private message
renzreny

New User


Joined: 16 Oct 2008
Posts: 7
Location: USA

PostPosted: Tue Mar 06, 2012 9:23 am
Reply with quote

I'm getting following syntax error. Any thoughts would be of much help

Code:
SYSIN :                                                                       
   OPTION COPY,NULLOUT=RC4                                                     
   JOINKEYS F1=INPUT1,FIELDS=(5,02,A)                                         
            *                                                                 
   JOINKEYS F2=INPUT2,FIELDS=(5,02,A)                                         
            *                                                                 
   REFORMAT FIELDS=(F1:1,80)                                                   
WER901I  **WARNING** SYNCSORT 1.3.2.1 WILL EXPIRE IN 36 DAYS                   
WER268A  JOINKEYS STATEMENT: SYNTAX ERROR                                     
WER268A  JOINKEYS STATEMENT: SYNTAX ERROR                                     
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000     
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Mar 06, 2012 9:32 am
Reply with quote

Hi,

you are using SYNCSORT and not DFSORT, solutions provided were for DFSORT.

Try this for SYNCSORT
Code:
//STEP01   EXEC PGM=SORT                                                                   
//SYSOUT   DD SYSOUT=*                                   
//SORTJNF1 DD *                                           
20110301                                                 
/*                                                       
//SORTJNF2 DD *                                           
20110431                                                 
/*                                                       
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
   OPTION COPY,NULLOUT=RC4                               
   JOINKEYS FILE=F1,FIELDS=(5,2,A)                       
   JOINKEYS FILE=F2,FIELDS=(5,2,A)                       
   REFORMAT FIELDS=(F1:1,8,F2:1,8)                       
/*


Gerry
Back to top
View user's profile Send private message
renzreny

New User


Joined: 16 Oct 2008
Posts: 7
Location: USA

PostPosted: Tue Mar 06, 2012 11:16 am
Reply with quote

Thank you gcicchet and saiprasadh. The suggested code worked well for me. icon_biggrin.gif This is the best and smartest way than writing via programming. You guys are amazing. Thanks again for your help and support.
icon_biggrin.gif


Regards, renz
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top