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

Merging two GDG versions in jcl


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

New User


Joined: 10 Sep 2007
Posts: 4
Location: Chennai

PostPosted: Thu Mar 26, 2009 9:47 am
Reply with quote

Hi,

I need to merge 2 datasets in a jcl.

Both input files are in the same length and format and have header and trailer. Header data is same for both whereas the record count in trailer varies.

How can I merge these 2 files into a single file with a single common header and trailer with total count of records in the merged file.

Thanks,
SS
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Mar 26, 2009 9:58 am
Reply with quote

sumitha,

I hv no idea about solving this using Natural & MQSeries. How does your problem relate to this forum? If you're trying to achieve this using your SORT product(DFSORT/SyncSort), you need to provide more details:

Product info - DFSORT/SyncSort?
Input/output file attributes
Position and format of key fields
A few sample input/output records showing the relevant fields using "Code" tag.
Back to top
View user's profile Send private message
sumitha

New User


Joined: 10 Sep 2007
Posts: 4
Location: Chennai

PostPosted: Thu Mar 26, 2009 10:15 am
Reply with quote

Hi,

I posted this query here as the input files were generated from Natural code. Do you want me to re-post this in JCL section?

Sample data in both the files would be as below. Please see if this helps.

File 1:

UHDR 2008061
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCC
UTRL 000005

File 2:

UHDR 2008061
DDDDDDDDDDDDDDDDDDDDDDDDDD
EEEEEEEEEEEEEEEEEEEEEEEEEEEEE
UTRL 000004


I want the final output to be

UHDR 2008061
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDDDDDDDDDDDD
EEEEEEEEEEEEEEEEEEEEEEEEEEEEE
UTRL 000007

Thanks,
SS
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: Thu Mar 26, 2009 10:25 am
Reply with quote

Hello,

Which sort product is used on your system?
Back to top
View user's profile Send private message
sumitha

New User


Joined: 10 Sep 2007
Posts: 4
Location: Chennai

PostPosted: Thu Mar 26, 2009 11:10 am
Reply with quote

DFSORT
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Mar 26, 2009 2:53 pm
Reply with quote

Hi,

try this, I've assumed the file is FB and LRECL=80

Code:
//STEP0010 EXEC PGM=ICEMAN                                     
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
UHDR 2008061                                                   
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA                                   
BBBBBBBBBBBBBBBBBBBBBBBBBBBBB                                   
CCCCCCCCCCCCCCCCCCCCCCCCCC                                                                             
UTRL 000005       
/*
//         DD *                                             
UHDR 2008061                                                   
DDDDDDDDDDDDDDDDDDDDDDDDDD                                     
EEEEEEEEEEEEEEEEEEEEEEEEEEEEE                                   
UTRL 000004                                                     
/*                                                             
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                       
  SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,6,ZD)),                 
  IFTHEN=(WHEN=(1,4,CH,EQ,C'UHDR',OR,1,4,CH,EQ,C'UTRL'),             
  OVERLAY=(87:SEQNUM,1,ZD))                                           
  OUTFIL OMIT=(87,1,ZD,EQ,2,OR,87,1,ZD,EQ,3),                         
  IFOUTLEN=80,IFTHEN=(WHEN=(1,4,CH,EQ,C'UTRL'),                       
  OVERLAY=(06:81,6,ZD,SUB,+2,M11,LENGTH=6))                           
/*                                                                   



Gerry
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Mar 26, 2009 5:24 pm
Reply with quote

Gerry,

I guess the SORT statement needs to be modified as the OP was asking for a MERGE and not a COPY.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 26, 2009 9:39 pm
Reply with quote

Assuming "merge" really just means concatenate the records from the two files together, and the two files have the same attributes, you can use a DFSORT job like the following to do what you asked for. I assumed the two input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=...  input file1 (FB/80)
//         DD DSN=...  input file2 (FB/80)
//SORTOUT  DD DSN=...  output file (FB/80)
//SYSIN    DD *
  OMIT COND=(1,4,CH,EQ,C'UTRL')
  INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'UHDR'),OVERLAY=(81:SEQNUM,1,ZD))
  OPTION COPY
  OUTFIL REMOVECC,OMIT=(81,1,ZD,EQ,2),BUILD=(1,80),
    TRAILER1=('UTRL ',COUNT+1=(M11,LENGTH=6))
/*


If that's not what you want, then explain more clearly what you do want with a better example of input and expected output.
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 Merging 2 datasets into one DFSORT/ICETOOL 1
No new posts Merging 2 files but ignore duplicate... DFSORT/ICETOOL 1
No new posts Syncsort- Merging two records into on... SYNCSORT 5
No new posts Merging more than two records DFSORT/ICETOOL 15
No new posts Merge GDG versions JCL & VSAM 5
Search our Forums:

Back to Top