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

SYNCSORT No matched records


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

New User


Joined: 29 Jan 2007
Posts: 33
Location: chennai

PostPosted: Tue Mar 10, 2009 6:41 pm
Reply with quote

Hi I'm just comparing two files using join keys. If the records are matched I'm writing into o/p file1, if not matched i'm writing into o/p file2.

There is a case, if there are no matched records found at all, then I need to write into the o/p file1 as " No records are matched ".. How can i do this ? Please help !!
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Mar 10, 2009 8:10 pm
Reply with quote

Hi,

Please show the sort card you are using along with some sample input records, rules & expected output - someone will be around with a suggestion.
Back to top
View user's profile Send private message
bamohan

New User


Joined: 29 Jan 2007
Posts: 33
Location: chennai

PostPosted: Tue Mar 10, 2009 8:42 pm
Reply with quote

Code:
//SYSIN    DD  *                                                 
  JOINKEYS FILES=F1,FIELDS=(1,9,A)                               
  JOINKEYS FILES=F2,FIELDS=(1,9,A)                               
  REFORMAT FIELDS=(F1:1,54,F2:10,8)                               
  JOIN UNPAIRED,F1                                               
  OUTFIL FILES=1,INCLUDE=(55,7,CH,NE,C' '), 
         OUTREC=(1:1,9,10:2X,12:55,7,19:44X),REMOVECC,           
         HEADER1=(1:'DATE';2X,&DATE=(DMY/);17:14X;               
         31:'DEL OPTION CUSIPS HAVING HOLDERS',/,                 
         1:'CUSIP';6X;12:'ACCTNO';45X,/,                         
         1:18'-')                                                                       
  OUTFIL FILES=2,INCLUDE=(55,7,CH,EQ,C' '),                       
                 OUTREC=(1:C'P',2:1,9,11:191X)                   
  SORT FIELDS=COPY                   


My question is -- If the include condition in OUTFIL FILES 1 is not at all matched then I need to write "No Records " in the o/p file1
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Mar 11, 2009 2:09 am
Reply with quote

bamohan,

Give this untested SORT application a try and let me know if you get the desired results:
Code:

//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=...
//SORTJNF2 DD DSN=...
//SORTOF1 DD DSN=&&TEMP1,DISP=(NEW,PASS),...
//SORTOF2 DD DSN=UNPAIRED.REPORT,DISP=(NEW,CATLG),...
//SYSIN    DD  *                                                 
  JOINKEYS FILES=F1,FIELDS=(1,9,A)                               
  JOINKEYS FILES=F2,FIELDS=(1,9,A)                               
  REFORMAT FIELDS=(F1:1,54,F2:10,8)                               
  JOIN UNPAIRED,F1                                               
  OUTFIL FILES=1,INCLUDE=(55,7,CH,NE,C' '), 
     OUTREC=(1:1,9,10:2X,12:55,7,19:44X),NULLOFL=RC4                                     
  OUTFIL FILES=2,INCLUDE=(55,7,CH,EQ,C' '),                       
     OUTREC=(1:C'P',2:1,9,11:191X)                   
  SORT FIELDS=COPY   
//************************************************
//* STEP2 WILL EXECUTE WHEN SORTOF01 CONTAINS DATA
//************************************************
//STEP2 EXEC PGM=SORT,COND=(4,EQ,STEP1)
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&TEMP1,DISP=SHR
//SORTOUT DD DSN=MATCHED.RECORDS.REPORT,DISP=(NEW,CATLG),...
//SYSIN DD *
   SORT FIELDS=COPY
   OUTFIL REMOVECC,           
      HEADER1=(1:'DATE';2X,&DATE=(DMY/);17:14X;               
      31:'DEL OPTION CUSIPS HAVING HOLDERS',/,                 
      1:'CUSIP';6X;12:'ACCTNO';45X,/,                         
      1:18'-'),OUTREC=(1,62)
//***************************************************
//* STEP3 WILL EXECUTE WHEN SORTOF01 CONTAINS NO DATA
//***************************************************
//STEP3 EXEC PGM=SORT,COND=(0,EQ,STEP1)
//SYSOUT DD SYSOUT=*
//SORTIN DD *
NO MATCHES
//SORTOUT DD DSN=MATCHED.RECORDS.REPORT,DISP=(NEW,CATLG),...
//SYSIN DD *
   SORT FIELDS=COPY 
   OUTFIL REMOVECC,           
      HEADER1=(1:'DATE';2X,&DATE=(DMY/);17:14X;               
      31:'DEL OPTION CUSIPS HAVING HOLDERS',/,                 
      1:'CUSIP';6X;12:'ACCTNO';45X,/,                         
      1:18'-'),OUTREC=(1,62)
/*                         
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 Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top