make a output file from two input files on certain condition

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
vikash58
Member
Posts: 3
Joined: Tue Oct 30, 2007 9:37 am
Location: Pune

make a output file from two input files on certain condition

Post by vikash58 » Wed Dec 31, 2008 5:00 pm

Hi All,

I have two input file and I want a output file as below:

1st Input:

XXXX 1234 HGKKJKKJGJ.......
XXXX 2424 BGYUOJLLKH.......
XXXX 8474 YFTFFJYGIKLJ......

here col 6-9 is key.

2nd Input:
AAAA 7347 A H 32.....
AAAA 1234 B G 54.....
AAAA 6456 C D 76.....

here also 6-9 is key.

I want the output file in the format of 1st input file excluding the duplicate keys. Means if the key is present in 2nd file don't write the record for this key.

Output expected as
XXXX 2424 BGYUOJLLKH.......
XXXX 8474 YFTFFJYGIKLJ......
Vikash kumar
09922611854

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

Post by Frank Yaeger » Wed Dec 31, 2008 9:39 pm

You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code: Select all

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD *
XXXX 1234 HGKKJKKJGJ.......
XXXX 2424 BGYUOJLLKH.......
XXXX 8474 YFTFFJYGIKLJ......
/*
//IN2 DD *
AAAA 7347 A H 32.....
AAAA 1234 B G 54.....
AAAA 6456 C D 76.....
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(6,4,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'1')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
/*
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

vikash58
Member
Posts: 3
Joined: Tue Oct 30, 2007 9:37 am
Location: Pune

Post by vikash58 » Fri Jan 02, 2009 10:50 am

Thanks for reply.

I want the output in a file, then what changes need to be done.
Also My file is not fixed of 80.
Vikash kumar
09922611854

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

Post by Frank Yaeger » Fri Jan 02, 2009 8:19 pm

I want the output in a file, then what changes need to be done.
Just change the //OUT DD statement to point to your output file. For example:

Code: Select all

//OUT DD DSN=myfilename,DISP=(NEW,CATLG,DELETE),
//  SPACE=(CYL,(5,5)),UNIT=SYSDA 
Also My file is not fixed of 80
Am I supposed to read your mind to figure out the actual RECFM and LRECL of your file, or could you possibly, I don't know, TELL ME the actual RECFM and LRECL? Sheesh.

And please DON"T post the same question on multiple help boards!
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

vikash58
Member
Posts: 3
Joined: Tue Oct 30, 2007 9:37 am
Location: Pune

Post by vikash58 » Tue Jan 06, 2009 11:24 am

Hi,

the Actual RECFM=FB and LRECL=600 for INP1 and
RECFM=FB and LRECL=900 for INP2.

Also,I need to seperate the control statement in some other member. And then use this member in our PROC or JCL.

So that I don't have to write the control statement in all JCLs or PROC. Just use the member.
Vikash kumar
09922611854

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 Jan 06, 2009 9:56 pm

Here's a DFSORT/ICETOOL job that will do what you asked for using PDS members for the control statements. Just make sure that the PDS has RECFM=FB and LRECL=80.

Code: Select all

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/600)
//IN2 DD DSN=...  input file2 (FB/900)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/600)
//TOOLIN DD DSN=pds(M1),DISP=SHR
//CTL1CNTL DD DSN=pds(M2),DISP=SHR
//CTL2CNTL DD DSN=pds(M3),DISP=SHR
//CTL3CNTL DD DSN=pds(M4),DISP=SHR
pds(M1):

Code: Select all

COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(6,4,CH) NODUPS USING(CTL3)
pds(M2):

Code: Select all

  INREC OVERLAY=(601:C'1')
pds(M3):

Code: Select all

  INREC BUILD=(1,600,601:C'2')
pds(M4):

Code: Select all

  OUTFIL FNAMES=OUT,INCLUDE=(601,1,CH,EQ,C'1'),BUILD=(1,600)
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

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Jan 25, 2016 10:35 pm

<< Content deleted By Admin >>

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