Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How do I Compare two records and set Return Code in SORT?
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: 1703
Location: Australia

PostPosted: Tue Mar 06, 2012 8:13 am    Post subject:
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    Post subject:
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    Post subject: Reply to: How do I Compare two records and set Return Code i
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: 1703
Location: Australia

PostPosted: Tue Mar 06, 2012 9:32 am    Post subject:
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    Post subject: Reply to: How do I Compare two records and set Return Code i
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us