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

JCL SORT & MERGE


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
janmejay
Warnings : 1

New User


Joined: 22 Jun 2007
Posts: 85
Location: bangalore

PostPosted: Thu Jun 20, 2013 8:06 pm
Reply with quote

HI

I have an requirement ,where the 2 input file needs to be merged based on matching key

here key is V00034D20110701


my requirement is to merge the file 1 records into one row and file2 records in 2nd row if key matches.


FILE 1

V00034D20110701 0450
V00034D20110701 0451
V00034D20110701 0452
V00034D20110701 0456
V00034D20110701 0459


FILE2

V00034D20110701 0092T
V00034D20110701 0095T
V00034D20110701 0098T
V00034D20110701 0157T
V00034D20110701 0158T



The output should be like
V00034D20110701 01 0450 0452 0456 0459
V00034D20110701 02 0092T 0095T 0098T 0157T 0158T

The row no should be printed to for each row as shown 01 02 (middle column)
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Jun 20, 2013 8:11 pm
Reply with quote

Please run this step

Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN   DD   *
  OPTION COPY
/*


and copy us the SYSOUT message which will help all in knowing your sort product and function level

Also where did 451 flew away from file1?

How much records do you expect for each keys ?
Back to top
View user's profile Send private message
janmejay
Warnings : 1

New User


Joined: 22 Jun 2007
Posts: 85
Location: bangalore

PostPosted: Fri Jun 21, 2013 1:39 pm
Reply with quote

I got below in my sysout.

Code:
SYSIN :                                                                       
   OPTION COPY                                                           0004000
 WER276B  SYSDIAG= 10215492, 11977331, 11977331, 1752900                       
 WER164B  6,904K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,             
 WER164B     0 BYTES RESERVE REQUESTED, 272K BYTES USED                         
 WER146B  12K BYTES OF EMERGENCY SPACE ALLOCATED                               
 WER108I  SORTIN   : RECFM=FB   ; LRECL=    80; BLKSIZE=    80                 
 WER110I  SORTOUT  : RECFM=FB   ; LRECL=    80; BLKSIZE=    80                 
 WER410B  5,876K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,       
 WER410B     0 BYTES RESERVE REQUESTED, 156K BYTES USED                         
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
 WER416B  BSAM WAS USED FOR SORTIN                                             
 WER416B  BSAM WAS USED FOR SORTOUT                                             
 WER054I  RCD IN          1, OUT          1                                     
 WER169I  RELEASE 1.3 BATCH 0506 TPF LEVEL 2.2



I mistakenly removed the 451. it should be present.
Maxium of 500 records can be expected for eack keys.

The output should like

Code:
V00034D20110701 01 0450 0451 0452 0456 0459 .
V00034D20110701 02 0092T 0095T 0098T 0157T 0158T


Code'd
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Jun 21, 2013 2:19 pm
Reply with quote

janmejay


You have SYNCSORT so should be posted on JCL forum as this forum is for DFSORT questions only you might need to think of solution in "SPLICE" but gonna be tiresome for 500 records ;)
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Jun 21, 2013 4:19 pm
Reply with quote

You might want to write some code to do this sort of thing.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Jun 21, 2013 4:46 pm
Reply with quote

But again to understand TS why do you need this to be done and did you trouble your boss for lack of work icon_lol.gif ?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 21, 2013 6:58 pm
Reply with quote

Hello,

If you search in the forums, this has been "solved" a few times. Keep in mind that Much of the DFSORT control statements work with Syncsort. . .

Quote:
I got below in my sysout.
But you did not post the putput form the sort process provided. . . In the sysout you posted, you left out the version/release information.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Jun 21, 2013 8:03 pm
Reply with quote

Hi dick,

But combining 500 records into one, wont it be too much of control statements...
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 21, 2013 11:31 pm
Reply with quote

Hi Arun,

I don't know - i remember the question before, but not the syntax of the solution(s).

If i wanted to do something like this, i'd probably write a bit of code as in code it is rather trivial to do. . .

Maybe someone will have a sort solution that would not take so many control statements.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Jun 22, 2013 12:03 am
Reply with quote

Hi dick,

Here is a similar one, this might help to format one file by squeezing the multiple records having same key value into a single one. There the max number of occurrences was just 25.
ibmmainframes.com/viewtopic.php?p=312247&highlight=#312247

I totally agree with writing code for this, unless someone else has a Syncsort not exceeding too many lines.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Sat Jun 22, 2013 12:54 am
Reply with quote

Yes totally agree with Arun

Much simpler in Cobol using arrays just populate and write
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top