View previous topic :: View next topic
|
Author |
Message |
dheeraj.ramchandani
New User
Joined: 03 Sep 2015 Posts: 10 Location: Peru
|
|
|
|
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 |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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 |
|
|
dheeraj.ramchandani
New User
Joined: 03 Sep 2015 Posts: 10 Location: Peru
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
You are creating Endevor 'ADD' cards. Why not let Endevor do that for you? |
|
Back to top |
|
|
dheeraj.ramchandani
New User
Joined: 03 Sep 2015 Posts: 10 Location: Peru
|
|
|
|
Because its good to automate a process when there are some 1000 components. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dheeraj.ramchandani
New User
Joined: 03 Sep 2015 Posts: 10 Location: Peru
|
|
|
|
Thanks a lot sqlcode1, I don't know why I was going for the difficult option |
|
Back to top |
|
|
|