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

Comparing 2 Files using Current time


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arunsoods

New User


Joined: 13 Jul 2016
Posts: 35
Location: India

PostPosted: Fri Sep 22, 2017 6:00 pm
Reply with quote

Hi Team,

I need to compare below 2 files:-

<-- File 1 -->
Code:
JOBNAME    DATE
G7D204MM 09212017
G7D201MM 09212017
G7D203MM 09212017
G7D809MM 09212017
G7D327MM 09212017

<-- File 2 -->
Code:
JOBNAME    TIME
G7D204MM 0645
G7D201MM 0605
G7D203MM 0610
G7D809MM 0253
G7D327MM 0641


1) I need to compare JOBNAME in both the file.
2) If JOBNAME matches I need to compare the date in file 1 with current date.
3) If date matches then write in output file "JOBNAME ran fine. "
4) If date is not current date then pick details from File2 and write in output file "JOBNAME should run before TIME."
5) If JOBNAME in File 2 not found in File 1 then write JOBNAME have no entry or never ran."
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Fri Sep 22, 2017 8:08 pm
Reply with quote

If you NEED to do something, what prevents you from doing this???

This is not forum to assign your own job to others.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Fri Sep 22, 2017 8:54 pm
Reply with quote

Hint: DFSORT JOINKEYS.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Sat Sep 23, 2017 4:40 pm
Reply with quote

Don't use colour tags - use code tags.
Don't use files - use data sets.
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Sun Sep 24, 2017 5:26 am
Reply with quote

Assuming LRECL=80.

Code:

//S1   EXEC  PGM=SORT               
//SYSOUT DD SYSOUT=*               
//SYMNAMES DD *                     
HDATE,S'&MON.&DAY.&YR4'             
//SORTJNF1 DD *                     
G7D204MM 09232017                   
G7D201MM 09232017                   
G7D203MM 09212017                   
G7D809MM 09212017                   
G7D327MM 09212017                   
//SORTJNF2 DD *                     
JOBNAME                             
G7D204MM 0645                       
G7D201MM 0605                       
G7D203MM 0610                       
G7D809MM 0253                       
G7D327MM 0641                       
//SORTOUT DD SYSOUT=*               
//SYSIN    DD *                     
  JOINKEYS FILE=F1,FIELDS=(1,08,A) 
  JOINKEYS FILE=F2,FIELDS=(1,08,A) 
  REFORMAT FIELDS=(F1:1,17,F2:1,8,10,4,?)                           
  OPTION COPY                                                       
  JOIN UNPAIRED,F2                                                   
  OUTREC IFTHEN=(WHEN=(30,1,CH,EQ,C'B',AND,                         
                       10,8,CH,EQ,HDATE),                           
                 BUILD=(1,8,C' RAN FINE',80:X)),                     
                                                                     
         IFTHEN=(WHEN=(30,1,CH,EQ,C'B',AND,                         
                       10,8,CH,NE,HDATE),                           
                 BUILD=(1,8,C' SHOUD RUN BEFORE ',26,4,80:X)),       
                                                                     
         IFTHEN=(WHEN=(30,1,CH,EQ,C'2'),                             
                 BUILD=(18,8,C' HAVE NO ENTRY OR EVER RAN',80:X)),   
                                                                     
         IFTHEN=(WHEN=NONE,                                         
                 BUILD=(18,8,C' UNHANDLED CONDITION',80:X))         
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Sun Sep 24, 2017 5:34 am
Reply with quote

Nic,

I have seen in many post you have quoted not use files.

Nic wrote:

Don't use files - use data sets.


Please advise why DFSORT has "file" in their code, or DFSORT team needs to correct it ?

Code:

JOINKEYS FILE=F2,FIELDS=(1,08,A) 
Back to top
View user's profile Send private message
arunsoods

New User


Joined: 13 Jul 2016
Posts: 35
Location: India

PostPosted: Mon Sep 25, 2017 1:18 pm
Reply with quote

Hi Magesh/Team,

Thanks for the responses while running above sort card I am getting below error. I have searched web but didn't found any appropriate solution.

Code:
JOINKEYS FILE=F1,FIELDS=(1,08,A)                             
JOINKEYS FILE=F2,FIELDS=(1,08,A)                             
REFORMAT FIELDS=(F1:1,17,F2:1,8,10,4,?)                       
JOIN UNPAIRED,F2                                             
SORT FIELDS=COPY                                             
WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED
WER274A  CONTINUATION STATEMENT ERROR FOUND                   
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                 
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE 


Regards
Arun
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Sep 25, 2017 2:24 pm
Reply with quote

Magesg
On the mainframe 'file' can be directly related to the 'DDNAME' which then relates to the data set. Within the program the DDNAME is referred to as FILE:
In PL/1..
Code:
DCL infile FILE ....


JCL:
Code:
//INFILE DD DSN=data.set.name


and this relationship is clearly explained in one of the (PL/1) manuals.
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Mon Sep 25, 2017 9:08 pm
Reply with quote

arunsoods wrote:
Hi Magesh/Team,

Thanks for the responses while running above sort card I am getting below error. I have searched web but didn't found any appropriate solution.

Code:
JOINKEYS FILE=F1,FIELDS=(1,08,A)                             
JOINKEYS FILE=F2,FIELDS=(1,08,A)                             
REFORMAT FIELDS=(F1:1,17,F2:1,8,10,4,?)                       
JOIN UNPAIRED,F2                                             
SORT FIELDS=COPY                                             
WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED
WER274A  CONTINUATION STATEMENT ERROR FOUND                   
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                 
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE 


Regards
Arun


Can you give us complete sysout log.

Moderator,

Please move this to syncsort.
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Mon Sep 25, 2017 9:09 pm
Reply with quote

Nic Clouston wrote:
Magesg
On the mainframe 'file' can be directly related to the 'DDNAME' which then relates to the data set. Within the program the DDNAME is referred to as FILE:
In PL/1..
Code:
DCL infile FILE ....


JCL:
Code:
//INFILE DD DSN=data.set.name


and this relationship is clearly explained in one of the (PL/1) manuals.


Thanks Nic.
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 -> SYNCSORT

 


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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts To get the the current time DFSORT/ICETOOL 13
Search our Forums:

Back to Top