Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

JCL SORT & MERGE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
janmejay
Warnings : 1

New User


Joined: 22 Jun 2007
Posts: 81
Location: bangalore

PostPosted: Thu Jun 20, 2013 8:06 pm    Post subject: JCL SORT & MERGE
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

Moderator


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

PostPosted: Thu Jun 20, 2013 8:11 pm    Post subject:
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: 81
Location: bangalore

PostPosted: Fri Jun 21, 2013 1:39 pm    Post subject:
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

Moderator


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

PostPosted: Fri Jun 21, 2013 2:19 pm    Post subject:
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: 2161
Location: @my desk

PostPosted: Fri Jun 21, 2013 4:19 pm    Post subject:
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

Moderator


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

PostPosted: Fri Jun 21, 2013 4:46 pm    Post subject:
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

Site Director


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

PostPosted: Fri Jun 21, 2013 6:58 pm    Post subject:
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: 2161
Location: @my desk

PostPosted: Fri Jun 21, 2013 8:03 pm    Post subject:
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

Site Director


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

PostPosted: Fri Jun 21, 2013 11:31 pm    Post subject:
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: 2161
Location: @my desk

PostPosted: Sat Jun 22, 2013 12:03 am    Post subject:
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.
http://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

Moderator


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

PostPosted: Sat Jun 22, 2013 12:54 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us