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
 
Modifying a records of a file using input from another file

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

New User


Joined: 02 Jun 2006
Posts: 5

PostPosted: Wed Sep 20, 2006 3:23 pm    Post subject: Modifying a records of a file using input from another file
Reply with quote

I have two files (file 1 & file 2) a below. I want to modify only last two bytes of file 2 to 95 in the places of 00. But changes in file 2 only to record keys found in file 1.
Files are FB.

Many Thanks.


File 1:
AAAAA
CCCC
FFFFFFF


File 2:
10AAAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
10BBBBBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
10CCCCCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
10EEEEEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
10FFFFFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
10DDDDDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
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: Wed Sep 20, 2006 8:17 pm    Post subject:
Reply with quote

In file1, you have five A's, four C's and seven F's. In file2, you have 5 A's, five C's and five F's. It's not clear which of these you consider a match and which you don't. Please clarify.

What is the starting position and length of the "key" in file1? What is the starting position and length of the "key" in file2?

What is the RECFM and LRECL of file1 and file2?

Show the output you expect for the example input records you showed.
Back to top
View user's profile Send private message
balaa

New User


Joined: 02 Jun 2006
Posts: 5

PostPosted: Thu Sep 21, 2006 3:07 pm    Post subject: Modifying a records of a file using input from another file
Reply with quote

I am very sorry for not giving the out all information in first instance.
Please disregard my previous post.

I have two files (file 1 & file 2) a below. I want to modify only last two bytes of file 2 to 95 in the places of 00. But changes in file 2 only to record keys found in file 1.


File 1:
AAAAA
CCCCC
FFFFF

File1, sequential file of Lrecl = 50 and recfm = FB, key position = 1 key length = 5.

File 2:
10AAAAA- 66 bytes of other info- 00
10BBBBB- 66 bytes of other info- 00
10CCCCC- 66 bytes of other info- 00
10EEEEE- 66 bytes of other info- 00
10FFFFF- 66 bytes of other info- 00
10DDDDD- 66 bytes of other info- 00

File2, sequential file of lrecl = 100 and recfm = FB, key position = 3 key length = 5.


Output should be
10AAAAA- 66 bytes of other info- 95
10BBBBB- 66 bytes of other info- 00
10CCCCC- 66 bytes of other info- 95
10EEEEE- 66 bytes of other info- 00
10FFFFF- 66 bytes of other info- 95
10DDDDD- 66 bytes of other info- 00

Keys should match

Many Thanks
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: Thu Sep 21, 2006 9:33 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed that 00/95 is in positions 99-100 (the last two bytes of the file2 records). Since you want your records in their original order rather than sorted by the key, we need an extra SORT operator.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/50)
//IN2 DD DSN=...  input file2 (FB/100)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/100)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(3,5,CH) -
  KEEPNODUPS WITH(1,98) WITH(101,8)
SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(3:1,5,99:C'95',101:8X)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(101:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
  SORT FIELDS=(101,8,ZD,A)
  OUTREC BUILD=(1,100)
/*
Back to top
View user's profile Send private message
balaa

New User


Joined: 02 Jun 2006
Posts: 5

PostPosted: Fri Sep 22, 2006 2:05 pm    Post subject: Re: Modifying a records of a file using input from another f
Reply with quote

Many Thanks for the solution. It is very much appreciated.

Thanks Again
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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