Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Merge two files with some replace/overlay function.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
dheeraj.ramchandani

New User


Joined: 03 Sep 2015
Posts: 10
Location: Peru

PostPosted: Thu Sep 03, 2015 7:59 pm    Post subject: Merge two files with some replace/overlay function.
Reply with quote

I have a requirement where in I have two files as given below: -
File 1 (80 bytes): -
AB111111 COBOLPG
AB222222 COBOLPG
AB333333 COBOLPG
AB444444 COBOLPG
AB555555 COBOLPG
AB666666 COBOLPG
.
.
.
.
n number of member names with their types.

File 2 (80 bytes): -
ADD ELEMENT 'MEMBNAME'
FROM DSNAME 'XXXX.YYYY.ZZZZ'
TO ENVIRONMENT 'DEVELP' SYSTEM 'ABCDEFG' SUBSYSTEM 'XYZXYZ'
TYPE 'MEMTYPE'
OPTIONS CCID '99999' COMMENTS "AB123456789" PROC GROUP 'ABC'
.
ADD ELEMENT 'MEMBNAME'
FROM DSNAME 'XXXX.YYYY.ZZZZ'
TO ENVIRONMENT 'DEVELP' SYSTEM 'ABCDEFG' SUBSYSTEM 'XYZXYZ'
TYPE 'MEMTYPE'
OPTIONS CCID '99999' COMMENTS "AB123456789" PROC GROUP 'ABC'
.
ADD ELEMENT 'MEMBNAME'
FROM DSNAME 'XXXX.YYYY.ZZZZ'
TO ENVIRONMENT 'DEVELP' SYSTEM 'ABCDEFG' SUBSYSTEM 'XYZXYZ'
TYPE 'MEMTYPE'
OPTIONS CCID '99999' COMMENTS "AB123456789" PROC GROUP 'ABC'
.
.
.
.
.
.
repeated to n number of times (equal to the number of member names in first file).

My requirement is to replace the MEMBNAME and MEMTYPE with actual member names and types from the first fle.

I played with some FINDREP, IFTHEN-OVERLAY options but could not get even close to what is desired. Is this even possible with SORT?
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 397
Location: USA

PostPosted: Thu Sep 03, 2015 8:14 pm    Post subject: Reply to: Merge two files with some replace/overlay function.
Reply with quote

Use IFTHEN=(WHEN=GROUP in second file to form a group with Seq number and also add seq number in first file. (Group can start with 'ADD ELEMENT')

Now match seq numbers, use JOINKEYS and replace/overlay the data.

.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1788
Location: NY,USA

PostPosted: Thu Sep 03, 2015 8:26 pm    Post subject:
Reply with quote

Dheeraj, Welcome to the forum.
Please use the code tags next time , there are variety of examples on the similar requirements on this forum.

This should help you to construct the solution.
Page-17
ftp://ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
http://ibmmainframes.com/about63209.html
http://ibmmainframes.com/about53689.html
http://ibmmainframes.com/about60421.html
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Thu Sep 03, 2015 8:27 pm    Post subject:
Reply with quote

dheeraj.ramchandani,
Do you intend to change static content of second file often? If not, why not build final output file from first file itself using OUTFIL?

Thanks,
Back to top
View user's profile Send private message
dheeraj.ramchandani

New User


Joined: 03 Sep 2015
Posts: 10
Location: Peru

PostPosted: Thu Sep 03, 2015 9:16 pm    Post subject:
Reply with quote

Thanks a lot RahulG31, Rohil Umarjikar and sqlcode1.

Rohit,
How to use code tags on the forum?

sqlcode1,
Yes I need to change the contents of the second file very often based on the contents of the first file. Thanks.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1788
Location: NY,USA

PostPosted: Thu Sep 03, 2015 9:34 pm    Post subject:
Reply with quote

Quote:
How to use code tags on the forum?


http://ibmmainframes.com/faq.php?mode=bbcode
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1868
Location: UK

PostPosted: Thu Sep 03, 2015 9:57 pm    Post subject:
Reply with quote

You are creating Endevor 'ADD' cards. Why not let Endevor do that for you?
Back to top
View user's profile Send private message
dheeraj.ramchandani

New User


Joined: 03 Sep 2015
Posts: 10
Location: Peru

PostPosted: Thu Sep 03, 2015 10:05 pm    Post subject:
Reply with quote

Because its good to automate a process when there are some 1000 components.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Thu Sep 03, 2015 11:16 pm    Post subject:
Reply with quote

Quote:
sqlcode1,
Yes I need to change the contents of the second file very often based on the contents of the first file. Thanks.


Code:
ADD ELEMENT 'MEMBNAME'
FROM DSNAME 'XXXX.YYYY.ZZZZ'
TO ENVIRONMENT 'DEVELP' SYSTEM 'ABCDEFG' SUBSYSTEM 'XYZXYZ'
TYPE 'MEMTYPE'
OPTIONS CCID '99999' COMMENTS "AB123456789" PROC GROUP 'ABC'

I was asking about static content like "ADD ELEMENT", "FROM DSNAME", "TO ENVIRONMENT". Do you also need to change this frequently? I didn't see anything in the original question about changing this dynamically based on module name. Do you need something like below (i changed your quotes to make this easier to read)? The idea is to keep static content in the card itself and use your MEMBNAME and MEMTYPE from file1 to drive everything.

Code:
//STEP0001 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
AB111111 COBOLPG                                                       
AB222222 COBOLPG                                                       
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN DD *                                                           
 SORT FIELDS=COPY                                                     
 OUTFIL BUILD=(1:C'ADD ELEMENT ',1,8,/,                               
               1:C'FROM DSNAME "XXXX.YYYY.ZZZZ"',/,                   
    1:C'TO ENVIRONMENT "DEVELP" SYSTEM "ABCDEFG" SUBSYSTEM',/,         
    1:C'TYPE',10,07,/,                                                 
    1:C'OPTIONS CCID "99999" COMMENTS "AB123456789" PROC GROUP "ABC"')
/*                                                                     


Output
Code:
ADD ELEMENT AB111111                                       
FROM DSNAME "XXXX.YYYY.ZZZZ"                               
TO ENVIRONMENT "DEVELP" SYSTEM "ABCDEFG" SUBSYSTEM         
TYPECOBOLPG                                                 
OPTIONS CCID "99999" COMMENTS "AB123456789" PROC GROUP "ABC"
ADD ELEMENT AB222222                                       
FROM DSNAME "XXXX.YYYY.ZZZZ"                               
TO ENVIRONMENT "DEVELP" SYSTEM "ABCDEFG" SUBSYSTEM         
TYPECOBOLPG                                                 
OPTIONS CCID "99999" COMMENTS "AB123456789" PROC GROUP "ABC"
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Sep 04, 2015 12:54 am    Post subject: Reply to: Merge two files with some replace/overlay function.
Reply with quote

If the groups on the second file are always identical (within a file for a run, not necessarily across runs) then sqlcode1's solution is best.

If the groups are not identical, then read what RahulG31 wrote and look at Rohit Umarjikar's examples.
Back to top
View user's profile Send private message
dheeraj.ramchandani

New User


Joined: 03 Sep 2015
Posts: 10
Location: Peru

PostPosted: Fri Sep 04, 2015 2:39 am    Post subject:
Reply with quote

Thanks a lot sqlcode1, I don't know why I was going for the difficult option icon_sad.gif
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 Comparing 2 Files using Current time arunsoods DFSORT/ICETOOL 3 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us