Matrix logic using ICETOOL.

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
kunnu
Member
Posts: 18
Joined: Sat Jan 08, 2011 12:38 am
Location: Mumbai

Matrix logic using ICETOOL.

Post by kunnu » Sat Jul 23, 2011 5:45 pm

Hi,

Could you please help me in getting the desired output through ICETOOL.

Explanation:
The records from both the input files should be matched based on the field EMPNO and needs to be written in the fashion as shown below. The output should written as a matrix form which you will be able to exactly understand by looking at the output structure.

In the input file-1 if it has one record for e.g take a record with EMPNO = 100 and the fie-2 has 2 records then it will write the output as 2 occurences of the EMPNO giving 2X1 matrix keeping the LOC field as same of the above for both the records in the output. Similarly the same thing happens for all the records with different EMPNO.

There is one more logic as you can see in the structure the input file-2 has one more field NAME. The name field will be overlayed in the output file as shown.

The length of each field EMPNO, LOC and NAME can assumed as 10 bytes. Input files can have RECFM=FB and LRECL=80,

Please refer to the below output structure for more clarity.

Code: Select all


Input:
File-1

EMPNO   LOC 
100     MUM-A      
200     DEL-B 
200     DEL-C
300     COI-A 
300     COI-B 
300     COI-C
400     KOL-P
400     KOL-Q
600     CHE-Z
 
File-2

EMPNO   LOC       NAME
100     MUM-P   
100     MUM-Q 
200     DEL-R
300     COI-S
300     COI-T     BECKY
300     COI-U
300     COI-V
400     KOL-E     RONAL3
400     KOL-F     RONAL2

500     NOI-G

Output:

100     MUM-A
100     MUM-A
200     DEL-B
200     DEL-C
300     COI-A
300     COI-B
300     COI-C
300     COI-A     BECKY
300     COI-B     BECKY
300     COI-C     BECKY
300     COI-A
300     COI-B
300     COI-C
300     COI-A
300     COI-B
300     COI-C
400     KOL-P     RONAL3 
400     KOL-Q     RONAL3
400     KOL-P     RONAL2
400     KOL-Q     RONAL2


Note:
If the BECKY would have been on this record "300 COI-U BECKY" then the output would be as below. I have shown the below output only for EMPNO = 300 and so on.

Code: Select all


Input

300     COI-S
300     COI-T
300     COI-U     BECKY
300     COI-V

Output:

300     COI-A
300     COI-B
300     COI-C
300     COI-A
300     COI-B
300     COI-C
300     COI-A     BECKY
300     COI-B     BECKY
300     COI-C     BECKY
300     COI-A
300     COI-B
300     COI-C

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Jul 26, 2011 1:37 am

You can use a DFSORT job like the following to do what you asked for:

Code: Select all

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
100       MUM-A
200       DEL-B
200       DEL-C
300       COI-A
300       COI-B
300       COI-C
400       KOL-P
400       KOL-Q
600       CHE-Z
//IN2 DD *
100       MUM-P
100       MUM-Q
200       DEL-R
300       COI-S
300       COI-T
300       COI-U     BECKY
300       COI-V
400       KOL-E     RONAL3
400       KOL-F     RONAL2
500       NOI-G
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  JOINKEYS F1=IN2,FIELDS=(1,10,A),SORTED
  JOINKEYS F2=IN1,FIELDS=(1,10,A),SORTED
  REFORMAT FIELDS=(F2:1,20,F1:21,60)
  OPTION COPY
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others