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
 
Replace the contents from one file into another file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Replace the contents from one file into another file
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: 3158
Location: Tucson AZ

PostPosted: Mon Mar 12, 2007 10:51 am    Post subject: Re: Replace the contents from one file into another file
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    Post subject: Re: Replace the contents from one file into another file
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: 3158
Location: Tucson AZ

PostPosted: Tue Mar 13, 2007 5:40 pm    Post subject:
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    Post subject: Re: Replace the contents from one file into another file
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    Post subject: Re: Replace the contents from one file into another file
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 Moderator


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

PostPosted: Sun Mar 18, 2007 10:06 pm    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Sun Mar 18, 2007 10:14 pm    Post subject: Re: Replace the contents from one file into another file
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 Moderator


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

PostPosted: Sun Mar 18, 2007 10:27 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Mar 23, 2007 9:07 pm    Post subject:
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    Post subject: Re: Replace the contents from one file into another file
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    Post subject: Re: Replace the contents from one file into another file
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    Post subject: Re: Replace the contents from one file into another file
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    Post subject: Re: Replace the contents from one file into another file
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    Post subject: Re: Replace the contents from one file into another file
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 :
http://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    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 ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts Prblem with mail having MIME contents harsh.saxena579 JCL & VSAM 2 Tue Dec 12, 2017 3:48 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm

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