"Merge" two files in a special way

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
cmkatz
Member
Posts: 8
Joined: Tue Nov 18, 2008 12:05 am

"Merge" two files in a special way

Post by cmkatz » Tue Nov 18, 2008 12:18 am

Hi there,

I hope you can help me!

I have two input-files with following records:

File A (LRECL=8000, variable length, first two bytes have the information of the recordlength, Sortkey on Byte 58, Length = 6 Bytes):

Code: Select all

..text1...... ABC6DEF BLABLA...
..text3...... CFHGSTZ TEXT...
..text4...... I4GHD5G TEXTB...
..text5...... 3BCDEFA TEXTC...
..text6...... 9IJGREE TEXTD...
File B (LRECL=6, Sortkey as in File A):

Code: Select all

CFHGSTZ
3BCDEFA
9IJGREE

Now I want to write the record of file A into a new outputfile C (LRECL=1200), if the key in file B matches a key in file A, so that file C looks like this:

Code: Select all

CFHGSTZ TEXT...
3BCDEFA TEXTC...
9IJGREE TEXTD...
Thank you!!
cmkatz

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 Nov 18, 2008 2:09 am

What is the RECFM of FileA? What is the RECFM of FileB? What is the RECFM of FileC?

Can FileA have duplicate keys within it?

Can FileB have duplicate keys within it?
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

cmkatz
Member
Posts: 8
Joined: Tue Nov 18, 2008 12:05 am

Post by cmkatz » Tue Nov 18, 2008 2:20 am

Sorry, I forgot to mention:

File A: RECFM=VB
File B: RECFM=FB
File C: RECFM=FB

No, none of the files have duplicate keys, and the keys are in ascending order

Thank you for your answer!
cmkatz

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 Nov 18, 2008 2:37 am

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed when you said the Sortkey starts on byte 58, you were counting the RDW in positions 1-4 (so the first data byte starts in position 5). If not, then use 62,1200 instead of 58,1200.

Code: Select all

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (VB/8000)
//IN2 DD DSN=...  input file2 (FB/6)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/1200)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,6,CH) FIRSTDUP
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=OUT,VTOF,BUILD=(58,1200)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(1200:X)
/*
Last edited by Frank Yaeger on Wed Nov 19, 2008 1:47 am, edited 1 time in total.
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

cmkatz
Member
Posts: 8
Joined: Tue Nov 18, 2008 12:05 am

Post by cmkatz » Tue Nov 18, 2008 2:42 am

Thank you very much!!

I'll try tomorrow (I'm from Germany, now it's 10:43 pm local time) and give a feedback asap.

cmkatz

cmkatz
Member
Posts: 8
Joined: Tue Nov 18, 2008 12:05 am

didn't work, but I found a work around

Post by cmkatz » Wed Nov 19, 2008 12:31 am

So, here's my feedback...

it didn't work, I always got an error messages saying that cntlout is missing or can not be allocated (I can't recall the correct message).

I searched the internet and found some information, that the reason for this message may possibly be a missing T1 dataset, so I defined a dataset, but that also didn't work.

But I found a "work around" using DFSORT. It had some more steps but i worked.

I can post the JCLs I've tried an the error message tomorrow. Maybe you or some other users can give hints or tell me what mistakes I've made.

Never the less: Thank you!!! =D

cmkatz

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 Nov 19, 2008 1:46 am

You just need to change:

Code: Select all

  OUTFIL VTOF,BUILD=(58,1200) 
to

Code: Select all

  OUTFIL FNAMES=OUT,VTOF,BUILD=(58,1200) 
You don't need FNAMES=OUT with the latest DFSORT PTF (July, 2008) which I'm running with. You do need it if you don't have the latest DFSORT PTF, which you apparently don't.

Ask your System Programmer to install z/OS DFSORT V1R5 PTF UK90013 (July, 2008). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTFs, see:

www.ibm.com/servers/storage/support/sof ... /mvs/peug/

I've updated my previous post to include FNAMES=OUT to avoid confusion.
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

cmkatz
Member
Posts: 8
Joined: Tue Nov 18, 2008 12:05 am

Post by cmkatz » Wed Nov 19, 2008 2:42 am

ok, I'll give it a try, thank you.

But:
It could be difficult to ask our System Operator to update our system, because we're a big and worldwide company. It's a loooong way (and needs many instances to say "yes") for a "simple developers" to get suggestions realized.

(I hope you can understand what I'm trying to say, because it has been a long time ago since I spoke and written English!)

Greets
cmkatz

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 Nov 19, 2008 4:19 am

Yes, I understand the problem with getting things changed in a worldwide company (your English is much better than a lot of what we see here).

For this particular job you can just add FNAMES=OUT. Unfortunately, if you want to use other new DFSORT functions that are only available with the July, 2008 PTF like FINDREP, WHEN=GROUP, DATASORT, SUBSET, etc, you'll be out of luck if you can't get the PTF installed.
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:34 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