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
 

 

How to merge 2files using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to merge 2files using sort
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7231

PostPosted: Thu Feb 07, 2013 8:14 pm    Post subject: Reply to: How to merge 2files using sort
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    Post subject: How to merge 2files using sort
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

Moderator


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

PostPosted: Fri Feb 08, 2013 9:49 am    Post subject:
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    Post subject: How to merge 2files using sort
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7231

PostPosted: Fri Feb 08, 2013 12:37 pm    Post subject: Reply to: How to merge 2files using sort
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

Moderator


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

PostPosted: Fri Feb 08, 2013 1:34 pm    Post subject:
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    Post subject: How to merge 2files using sort
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Feb 08, 2013 3:49 pm    Post subject: Reply to: How to merge 2files using sort
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    Post subject: Re: How to merge 2files using sort
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL 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