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

Replace the contents from one file into another file


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

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Mon Mar 12, 2007 9:37 am
Reply with quote

Hi,
I have 2 flat files.I need to replace the contents from one file into another file.
Eg:

File1:

LOG ON
REPLACE
RESUME
(
FIELD1 VARCHAR NULL
FIELD2 CHAR NULL
FIELD3 NUMERIC NULL
)

File2:

LOG OFF
DELETE
RESTART
(
BREAK CHAR NULL
CREATE VARCHAR NULL
)

Outfile:

LOG ON
REPLACE
RESUME
(
BREAK CHAR NULL
CREATE VARCHAR NULL
)


I just need the contents between (...) to be replaced.

Pls let me know if more explanation is reqd.Pls provide a solution thru DFSORT.

Thanks
Aneeta
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Mar 12, 2007 10:51 am
Reply with quote

aneeta wrote:
I just need the contents between (...) to be replaced.
Are the records between the parentheses always three being replaced by two?
Is the number of records before the opening parentheses always three?
Do any records ever follow the closing parentheses?
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Tue Mar 13, 2007 5:27 pm
Reply with quote

Hi,
Thanks for the response.The number of records between the parentheses in both the files is not fixed,it varies.There is no record following the closing parantheses.

Thanks
Aneeta
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Mar 13, 2007 5:40 pm
Reply with quote

Is the number of records before the opening parentheses always three?
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Tue Mar 13, 2007 8:10 pm
Reply with quote

Hi,
No..the number of records before the opening parentheses is not 3..it varies..

Thanks
Aneeta
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Sun Mar 18, 2007 7:36 pm
Reply with quote

Can I get a solution for my requirement thru DFSORT?

Thanks
Aneeta
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: Sun Mar 18, 2007 10:06 pm
Reply with quote

Aneeta,

Is the number of records before the '(' record in file1 always the same as the number of records before the '(' record in file2 (e.g. both have 3 records before the '(', or both have 4 records before the '(', etc)?

What is the RECFM and LRECL of the input files?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Sun Mar 18, 2007 10:14 pm
Reply with quote

aneeta wrote:
the number of records before the opening parentheses is not 3..it varies.

aneeta wrote:
The number of records between the parentheses in both the files is not fixed,it varies.
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: Sun Mar 18, 2007 10:27 pm
Reply with quote

William,

What is the relevance of the lines you quoted? They don't tell me if the number of lines in file1 before the '(' is always the same as the number of lines in file2 before the '(' or not which is what I want to know.
Back to top
View user's profile Send private message
ibmmainframesyntel

Active User


Joined: 26 Feb 2007
Posts: 126
Location: Chennai

PostPosted: Fri Mar 23, 2007 5:08 pm
Reply with quote

frank sorry to reply for this query....
consider
both the files contains only three records before '('
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: Fri Mar 23, 2007 9:07 pm
Reply with quote

mp,

I don't understand your post. Aneeta was the original poster, not you, so how can you know what Aneeta's answer to my question would be. All we know from what Aneeta said is that the number of records before the ( can vary. But we don't know if it's always the same number in both files, e.g. both have 3 records before ( or both have 4 records before (, etc. Anyway, Aneeta seems to have lost interest so we may never know.
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Sun Mar 25, 2007 3:49 pm
Reply with quote

Hi,
Sorry for the late response.

The number of records before the '(' of file1 will not be equal to the number of records before the '(' of file2.

Sometimes no. of records in file1 before '(' will be greater than '(' in file2.Sometime no. of records in file2 before '(' will be lesser than '(' in file2.Also there will not be any similarity in the records before '(' in the 2 files.

For Eg:
File1:

LOG ON
REPLACE
RESUME
(
FIELD1 VARCHAR NULL
FIELD2 CHAR NULL
FIELD3 NUMERIC NULL
)
File2:

LOG OFF
DELETE
(
BREAK CHAR NULL
CREATE VARCHAR NULL
)
Outfile:

LOG ON
REPLACE
RESUME
(
BREAK CHAR NULL
CREATE VARCHAR NULL
)

Deeply regret for the inconvenience caused in clarifying the requirement.

Thanks for the response.Pls let me know if more explanation is required..Pls help me

Regards
Aneeta
Back to top
View user's profile Send private message
Alain Benveniste

New User


Joined: 14 Feb 2005
Posts: 88

PostPosted: Sun Mar 25, 2007 7:21 pm
Reply with quote

aneeta,
Here is the solution you are looking for:
Code:

//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//TOOLIN   DD *
  COPY FROM(IN) TO(OUTX) USING(ICE0)
/*
//IN       DD *
LOG ON
REPLACE
RESUME
(
FIELD1 VARCHAR NULL
FIELD2 CHAR NULL
FIELD3 NUMERIC NULL
)
/*
//         DD *
LOG OFF
DELETE
RESTART
(
BREAK CHAR NULL
CREATE VARCHAR NULL
)
/*
//OUTX     DD SYSOUT=*
//ICE0CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
                OVERLAY=(81:SEQNUM,5,ZD)),
        IFTHEN=(WHEN=(1,1,CH,NE,C'('),
                OVERLAY=(86:SEQNUM,5,ZD,
                         81:81,5,ZD,SUB,86,5,ZD,M11,LENGTH=5)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(81:SEQNUM,5,ZD))
  OUTFIL FNAMES=OUTX,
         OMIT=(81,5,CH;EQ,C'00001'),
         OUTREC=(1,80)

Alain
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Tue Mar 27, 2007 7:03 pm
Reply with quote

Hi Alain,
Can u pls explain the below statements for my understanding..

INREC IFTHEN=(WHEN=INIT,
OVERLAY=(81:SEQNUM,5,ZD)),
IFTHEN=(WHEN=(1,1,CH,NE,C'('),
OVERLAY=(86:SEQNUM,5,ZD,
81:81,5,ZD,SUB,86,5,ZD,M11,LENGTH=5)),
IFTHEN=(WHEN=NONE,
OVERLAY=(81:SEQNUM,5,ZD))
OUTFIL FNAMES=OUTX,
OMIT=(81,5,CH;EQ,C'00001'),
OUTREC=(1,80)

Thanks
Aneeta
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Tue Mar 27, 2007 8:17 pm
Reply with quote

Hi Alain,
The JCL is working pefectly fine.But I am facing an issue.The contents mentioned are in a file.If the JCL is coded as
//IN DD DSN=A.B.C,DISP=SHR
// DD DSN=D.E.F(A1),DISP=SHR

The contents of the 1st file is just copied into the output file. I have not changed anything in ur given JCL.

Pls correct me if I am wrong.

Thanks
Aneeta
Back to top
View user's profile Send private message
Alain Benveniste

New User


Joined: 14 Feb 2005
Posts: 88

PostPosted: Wed Mar 28, 2007 12:29 am
Reply with quote

aneeta,

The idea is to give a key value per group. The value is the same until a open parenthesis is met.
So:

LOG ON
REPLACE
RESUME

have key set to 0

(
FIELD1 VARCHAR NULL
FIELD2 CHAR NULL
FIELD3 NUMERIC NULL
)
LOG OFF
DELETE
RESTART

have key set to 1

(
BREAK CHAR NULL
CREATE VARCHAR NULL
)

have a key set to 2

Omiting recs with key value 1 give you the desired result.

The global logic is also explained here :
ibmmainframes.com/posting.php?mode=reply&t=18814&sid=1711736c024ce0f2819eaffbcbcdc746

and select Include or omit groups of records


you say
Quote:
The JCL is working pefectly fine.But I am facing an issue.The contents mentioned are in a file.If the JCL is coded as
//IN DD DSN=A.B.C,DISP=SHR
// DD DSN=D.E.F(A1),DISP=SHR

The contents of the 1st file is just copied into the output file. I have not changed anything in ur given JCL.


if you post the sysout i could see why you don't have the result expected...

Alain
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top