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

How to merge 2files using sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sandybadam

New User


Joined: 09 Oct 2006
Posts: 14

PostPosted: Thu Feb 07, 2013 4:44 pm
Reply with quote

Hi,

I want to merge 2 files using sort.

File1 is a header file with below records
Code:
 Customerno   name   amount 


File2 is a record file with some hexadecimal feilds in it. 3300000033 is a hexadecimal value.
Code:

123456789  ABCDEFGHIJ  3300000033
   


I am fomatting the hexadecimal values using sort and in the same sort step i want to concatenate the above 2 files.

OUTREC FIELDS=(64,8,PD,TO=ZD,X)
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 07, 2013 8:14 pm
Reply with quote

So, concatenate in the JCL. What problem does that give you?
Back to top
View user's profile Send private message
sandybadam

New User


Joined: 09 Oct 2006
Posts: 14

PostPosted: Fri Feb 08, 2013 9:30 am
Reply with quote

I don't want to format the header file and only want to format the record file.
But as per the below code it will format both the files and header file is having only charcter data hence it is throwing S0C7.

Both the files is having record length of 124.

Code:

//SORT1    EXEC PGM=SORT                                               
//SORTIN   DD DISP=SHR, DSN= Header File
//              DD DISP=SHR, DSN= Record file                             
//SORTOUT  DD DSN=output,  DISP=SHR                     
                                                   
//SYSIN DD *                                                           
  SORT FIELDS=COPY                                                     
  OUTREC FIELDS=(1,10,C';',                                           
                 11,40,C';',                                           
                 51,10,C';',                                           
                 61,3,C';',                                           
                 64,8,PD,EDIT=(SIIIIIIIIIIIIIII),SIGNS=(,-),C';',     
                 72,8,PD,EDIT=(SIIIIIIIIIIIIIII),SIGNS=(,-),C';',     
          64,8,PD,SUB,72,8,PD,EDIT=(SIIIIIIIIIIIIIII),SIGNS=(,-),C';',
          80,3,PD,EDIT=(TTTTT),C';')     

                             
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 Feb 08, 2013 9:49 am
Reply with quote

If I understand your requiremet please think of using DATASORT
Back to top
View user's profile Send private message
sandybadam

New User


Joined: 09 Oct 2006
Posts: 14

PostPosted: Fri Feb 08, 2013 12:20 pm
Reply with quote

But I have 2 different files.
File1 is header and FILE2 is Record file..

how to use DATASORT in this scenario.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 08, 2013 12:37 pm
Reply with quote

If you want to use JOINKEYS to avoid writing an IFTHEN=, you can. If you want to do the concatenation in the JCL somewhere "after" this, you can. These would be very poor use of resources (client paying for them, as well).

Or you can use IFTHEN=(WHEN=(logexp to avoid doing anything to the header.
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 Feb 08, 2013 1:34 pm
Reply with quote

Hi Sandy,

Bills solution is the best solution , DATASORT cant be used in this particular scenario
Back to top
View user's profile Send private message
sandybadam

New User


Joined: 09 Oct 2006
Posts: 14

PostPosted: Fri Feb 08, 2013 3:42 pm
Reply with quote

Actually I did concatenation after the sort step and it worked.

But I was looking for a better solution to do in single step(SORT step).

Thanks for your time and inputs on the same..

Have a nice weekend.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Feb 08, 2013 3:49 pm
Reply with quote

in the sort step concatenate in the SORTIN DD the two datasets
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Feb 09, 2013 2:46 am
Reply with quote

sandybadam wrote:
But I have 2 different files.
File1 is header and FILE2 is Record file..

how to use DATASORT in this scenario.


If both files have the SAME DCB properties you can simply concatenate them and just sort the detail records.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
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
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top