Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Splice 2 files in 3rd file based on specific condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Splice 2 files in 3rd file based on specific condition
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 Moderator


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

PostPosted: Tue May 01, 2007 8:21 pm    Post subject:
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    Post subject: Re: Splice 2 files in 3rd file based on specific condition
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 Moderator


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

PostPosted: Wed May 02, 2007 1:16 am    Post subject:
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    Post subject: Re: Splice 2 files in 3rd file based on specific condition
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 Moderator


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

PostPosted: Wed May 02, 2007 2:33 am    Post subject:
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    Post subject:
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    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 Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us