MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Select the latest Record and Match 2 files & Generate Re

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
arvibala
Beginner


Joined: 12 Feb 2008
Posts: 142
Topics: 67

PostPosted: Wed Feb 22, 2012 5:40 am    Post subject: Select the latest Record and Match 2 files & Generate Re Reply with quote

1.
We have the below employee File that has the duplicate information of the employees as specified below. It is sorted on Employee Number field. We have to create a new employee file from this file without any duplicates and the information of the employee should be latest (based on date). Please propose some good solutions to accomplish this (Note : You can come up with as many solutions as you could)
Code:

01  WS-EMPLOYEE DETAILS.
     05 WS-EMP-NO              PIC 9(05).
     05 WS-EMP-NAME            PIC X(20).                 
     05 WS-EMP-DEPT            PIC X(20).
     05 WS-EMP-PROJECT         PIC X(20).
     05 WS-EMP-DESIGNATION     PIC X(20).
     05 WS-UPDATED-DATE        PIC X(10).                   
     05 WS-FILLER              PIC X(25).

I/P Sample File
Code:


0001 PETE PERSHING DP TEAM LEAD         01/01/2011
0002 JOHN BNYM        FMTS PROJECT LEAD 01/03/2011
0002 JOHN BNYM        AST  TEAM LEAD    01/01/2011
0003 DAVE BNYM        AST  DEVELOPER    01/01/2011


O/P Sample File
Code:
 
0001 PETE PERSHING DP TEAM LEAD         01/01/2011
0002 JOHN BNYM        FMTS PROJECT LEAD 01/03/2011
0003 DAVE BNYM        AST  DEVELOPER    01/01/2011


2.
An ABC financial company decides to reverse some of the transactions that happened today as it mistakenly processed an incorrect input file. So the management decides to compare today's transaction file with yesterday's transaction file and see if the transactions that have been added, modified or deleted today have to be reversed.

Below is the layout of the transaction file
Code:

01  WS-TRANSACTIONS
     05 WS-TRANSACTION-NR          PIC 9(05).
     05 WS-ACCOUNT-NR              PIC 9(13).
     05 WS-TRANSACTION-AMT         PIC S9(13)V9(2) USAGE COMP-3.
     05 WS-ACCOUNT-USER-NAME       PIC X(20).                   
     05 WS-TRANSACTION-TYPE        PIC X(10).
     05 WS-TRANS-DATE              PIC X(10).   
 

Please come up with solutions to compare today's and yesterday's file and produce the below reports

1. Modified Data Report
2. Added Data Report
3. Deleted Data Report

(Note : You can come up with as many solutions as you could)
_________________
Arvind
"You can make a difference with your smile. Have that with you always"
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Feb 22, 2012 11:40 am    Post subject: Reply with quote

arvibala,

IMHO, these questions can be answered by any one with very very little effort. I don't see them as challenges at all.

You need to be clear on the requirements.

1. What is the format of the WS-UPDATED-DATE in the first question. Is it DD/MM/CCYY or MM/DD/CCYY ? I assume it is DD/MM/CCYY as it is highly impossible to get promoted from asst team lead to project lead within 2 days. oh well even 2 months is kinda of far fetched idea.

2. You never mentioned anything in regards to the utilities to be used or the programming language to be used.

3. The second question is too vague. Are the transactions in yesterday's and today's file unique? How do you compare to get the modified data assuming that a particular account had 10 transactions yesterday and today's file had 15 transactions. What do you compare? transaction type? Transaction Amount? Transaction date?

PS : Use code tags to retain the spacing and readable
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
arvibala
Beginner


Joined: 12 Feb 2008
Posts: 142
Topics: 67

PostPosted: Thu Feb 23, 2012 4:36 am    Post subject: Reply with quote

Smile I was in a hurry getting this to Forum as I was facing problems with my internet connection.

1. Format is MM/DD/CCYY and may be on Jan 1st he was asst team lead and got a promotion on Jan 2nd or 3rd.
2. its using SORT
3. Key is WS-TRANSACTION-NR , WS-ACCOUNT-NR and WS-TRANS-DATE.

Sorry abt that

Thanks
Arvind
_________________
Arvind
"You can make a difference with your smile. Have that with you always"
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Feb 23, 2012 12:28 pm    Post subject: Reply with quote

As I said earlier , it is quite simple.

1. Use select with FIRST option and sort on the date descending
Code:

//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//IN       DD DSN=Your input file,DISP=SHR                           
//OUT      DD SYSOUT=*                                   
//TOOLIN   DD *                                           
  SELECT FROM(IN) TO(OUT) ON(1,5,CH) FIRST USING(CTL1)   
//CTL1CNTL DD *                                           
  SORT FIELDS=(01,5,CH,A,       $ EMP-ID                 
               92,4,CH,D,       $ YEAR                   
               86,2,CH,D,       $ MONTH                   
               89,2,CH,D)       $ DAY                     
//*


2. The details are still murky. How do you decide if the record is modified? do You compare the entire record from both files?

Either way it here is a joinkeys job which will produce 3 reports.
Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//INA      DD DSN=Yesterday's file,DISP=SHR                               
//INB      DD DSN=today's file,DISP=SHR                               
//ADDRPT   DD SYSOUT=*                                         
//DELRPT   DD SYSOUT=*                                         
//MODRPT   DD SYSOUT=*                                         
//SYSIN    DD *                                               
  OPTION COPY                                                 
  JOINKEYS F1=INA,FIELDS=(1,18,A,57,10,A)                     
  JOINKEYS F2=INB,FIELDS=(1,18,A,57,10,A)                     
  JOIN UNPAIRED                                               
  REFORMAT FIELDS=(F1:1,66,?,F2:1,66)                         
  OUTFIL FNAMES=ADDRPT,INCLUDE=(67,1,CH,EQ,C'2'),BUILD=(68,66)
  OUTFIL FNAMES=DELRPT,INCLUDE=(67,1,CH,EQ,C'1'),BUILD=(01,66)
  OUTFIL FNAMES=MODRPT,BUILD=(1,66,/,68,66),                   
  INCLUDE=(67,1,CH,EQ,C'B',AND,(1,66,CH,NE,68,66,CH))         
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
arvibala
Beginner


Joined: 12 Feb 2008
Posts: 142
Topics: 67

PostPosted: Tue Feb 28, 2012 2:10 am    Post subject: Reply with quote

Thanks Kolusu ..

But for 2, I am getting error when I make file reference like above and "?" too is not being recognized. S?YNCSORT Version I have is "SYNCSORT FOR Z/OS 1.3.2.0R" ... is that to do with this??

Code:

  OPTION COPY                                                   
  JOINKEYS F1=INA,FIELDS=(1,18,A,57,10,A)                       
           *                                                   
  JOINKEYS F2=INB,FIELDS=(1,18,A,57,10,A)                       
           *                                                   
  JOIN UNPAIRED                                                 
  REFORMAT FIELDS=(F1:1,66,?,F2:1,66)                           
                          *                                     
  OUTFIL FNAMES=ADDRPT,INCLUDE=(67,1,CH,EQ,C'2'),BUILD=(68,66) 
  OUTFIL FNAMES=DELRPT,INCLUDE=(67,1,CH,EQ,C'1'),BUILD=(01,66) 
  OUTFIL FNAMES=MODRPT,BUILD=(1,66,/,68,66),                   
  INCLUDE=(67,1,CH,EQ,C'B',AND,(1,66,CH,NE,68,66,CH))           
WER161B  ALTERNATE PARM USED                                   
WER268A  JOINKEYS STATEMENT: SYNTAX ERROR                       
WER268A  JOINKEYS STATEMENT: SYNTAX ERROR                       
WER268A  REFORMAT STATEMENT: SYNTAX ERROR                       

_________________
Arvind
"You can make a difference with your smile. Have that with you always"
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Feb 28, 2012 11:42 am    Post subject: Reply with quote

arvibala,

The Job works fine with DFSORT. Your Error messages indicate you are using syncsort. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.

bonk It has turned out to be a another regular help thread. I am going to move these 2 topics to Sort/utilities forum.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group