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
 

 

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: 331
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: 1610
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: 1610
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: 1715
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: 7236

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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


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