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

Splice 2 files in 3rd file based on specific condition


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

New User


Joined: 15 Nov 2006
Posts: 7

PostPosted: Tue May 01, 2007 9:11 am
Reply with quote

I have requirement where i have the following 2 files as shown in the
example below:

File 1:
SSN Field 1 Field 2 field 3 field 4 field 5 field 6

Record Length = 500

File 2 :
SSN Variable 1 Variable 2 Variable 3 Variable 4 Variable 5

Record Length = 500


Now the first file is having record length of 500 but out of which only first 200 would be filled & next 300 would be filler.

For the 2nd file the record length if also 500 but out of which the first 300 is filled and last 200 is filler.

Now i want 3rd file where first 200 positions filled in file 1 exists but after that i would get only 1 specific field from 2nd file (eg position starting position 260-ending position 270) to be written in the 3rd file from position 201-210 where the primary key is SSN for 1st file as well as 2nd file...

Thanks..
Harry
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: Tue May 01, 2007 8:21 pm
Reply with quote

A few questions:

Do input file1 and input file2 have RECFM=FB?

What is the length of the SSN field?

You say you want positions 260-270 from input file2 in output positions 201-210. But 260-270 is 11 bytes whereas 201-210 is 10 bytes. So do you actually want input positions 260-269 or what?

Can input file1 have duplicate SSNs within it? Can input file2 have duplicate SSNs within it? If either file can have duplicate SSNs within it, show an example of the input records and expected output records for that situation.
Back to top
View user's profile Send private message
harry07
Warnings : 1

New User


Joined: 15 Nov 2006
Posts: 7

PostPosted: Tue May 01, 2007 11:12 pm
Reply with quote

Hi Frank,
Please find my response below:
1) The input file 1 & input file 2 will have RECFM=FB
2) The length of the SSN would be 9 bytes in both files.
3) Also i want the positions 261-270(Length 10) from input file 2
in output positions 201-210 of the output file.

No both the input files won't have any SSN's.

Also please find example for this scenario:
Input File1
SSN(1st 9 position) followed by 191 positions having data related to this ssn & last 300 positions would be filler.
Input File 2
SSN(1st 9 position) followed by 291 position having data related to this ssn & last 200 positions would be filler.

Expected Output file:
SSN(1st 9 position) followed by 191 position(Input file 1) + only 10 position(Position 261-270 of input file 2 for the same ssn) & rest 290 would be filler.

Any help would be greatly appreciated.
Also sorry for the inconvenience of mentioning incorrect value in my first post.

Thanks
Harry
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: Wed May 02, 2007 1:16 am
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I didn't know what you wanted for the filler character, so I used C'*'. Just replace C'*' with whatever C'c' or X'hh' character you want.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/500)
//IN2 DD DSN=...  input file2 (FB/500)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/500)
//TOOLIN   DD    *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,9,CH) -
  WITH(201,10) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,200,201:10X)
/*
//CTL2CNTL DD *
  INREC BUILD=(1,9,201:261,10)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,BUILD=(1,210,290C'*')
/*
Back to top
View user's profile Send private message
harry07
Warnings : 1

New User


Joined: 15 Nov 2006
Posts: 7

PostPosted: Wed May 02, 2007 1:46 am
Reply with quote

Hi Frank
Thanks for your valuable response,but can the same thing be done with only sort instead of using ICETOOL utility.
It would be great if you can provide example with Sort utility instead of ICETOOL.


Thanks
Ramnath Shanbhag
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: Wed May 02, 2007 2:33 am
Reply with quote

Quote:
but can the same thing be done with only sort instead of using ICETOOL utility


No.

Quote:
It would be great if you can provide example with Sort utility instead of ICETOOL.


ICETOOL has been part of the DFSORT utility since 1991. What is your concern with using ICETOOL?
Back to top
View user's profile Send private message
harry07
Warnings : 1

New User


Joined: 15 Nov 2006
Posts: 7

PostPosted: Thu May 03, 2007 8:42 am
Reply with quote

Hi Frank,

Thanks for the information,we would use this ICETOOL utility for our requirement..
Thanks for the valuable help..
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top