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
 

 

Merging two GDG versions in jcl

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Merging two GDG versions in jcl
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: 2276
Location: @my desk

PostPosted: Thu Mar 26, 2009 9:58 am    Post subject:
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    Post subject:
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

Site Director


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

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

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

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Mar 26, 2009 2:53 pm    Post subject:
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: 2276
Location: @my desk

PostPosted: Thu Mar 26, 2009 5:24 pm    Post subject:
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 Moderator


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

PostPosted: Thu Mar 26, 2009 9:39 pm    Post subject:
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    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 Merging of two files siva102 DFSORT/ICETOOL 3 Fri Feb 19, 2016 12:36 pm
No new posts Merging records skgupta81 DFSORT/ICETOOL 11 Thu Sep 10, 2015 3:19 am
No new posts Merging file data using ICETOOL kishpra JCL & VSAM 3 Tue Aug 04, 2015 2:15 pm
No new posts How to check if any of the GDG versio... ovreddy JCL & VSAM 3 Fri Jun 12, 2015 1:28 am
No new posts Related to GDG versions creations David Robinson JCL & VSAM 5 Tue Jan 20, 2015 11:14 am


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