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
 

 

ICETOOL Splice to match records

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

New User


Joined: 02 Jan 2008
Posts: 4
Location: PHX, AZ

PostPosted: Wed Feb 06, 2008 4:05 am    Post subject: ICETOOL Splice to match records
Reply with quote

Hi,

I want to match records across to data files using a key from a "master" file. This is something SPLICE can do??

Example:

IFILE1
20081012

IFILE2
005CLIENTACCESS0015020081012012333
006CLIENTACCESS0015020081012012333
007CLIENTACCESS0015020081012012333
....

So, reading IFILE1 matching all records on the date value with IFILE2 and writing them to my output file.

Thanks!!!
Erik
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 Feb 06, 2008 4:45 am    Post subject:
Reply with quote

Well, yes you could do it with SPLICE. But if you only have one record in file1, it would be easier to do it with DFSORT symbols like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
* Generate a DFSORT Symbol as follows:
* TARG,'yyyymmdd'
* where yyyymmdd is from input file1
  INREC BUILD=(C'TARG,''',1,8,C'''',80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file2
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
* Use TARG symbol in INCLUDE statement
  INCLUDE COND=(21,8,CH,EQ,TARG)
/*


If your situation is actually more complicated than that, then show a better example of the records in each input file and what you expect for output. Also, give the RECFM and LRECL of each input file.
Back to top
View user's profile Send private message
Steynek

New User


Joined: 02 Jan 2008
Posts: 4
Location: PHX, AZ

PostPosted: Wed Feb 06, 2008 5:45 am    Post subject:
Reply with quote

Thanks for the quick response Frank.

Actually our example is a little more convoluted than the example that was included in the original posting.

Input File 1 is FB 80 and contains several records that are prefixed with a date value:


20000101Adam Ant’
20000102Mary Sue
20010101John Allen

Input File 2 is also FB 80 and contains multiple records that have the same date values, but multiples, and in different position:

Manager120000101salarycap100,000
Manager220000101salarycap110,000
…..etc…

The date values in file 1 is distinct, whilst the records in file 2 can occur multiple times for each date. So our results should look something like this:

20000101Adam Ant’ Manager1salarycap100,000
20000101Adam Ant’ Manager2salarycap110,000

Etc.

Hope this makes sense!!

Regards
Erik
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 Feb 06, 2008 6:13 am    Post subject:
Reply with quote

It's not completely clear to me what you want. I'd like a better example so I don't waste time on something that doesn't give you what you want.

It appears the output records should contain the date, the field after the date from file1 and the fields before and after the date from file2. Is that right?

You said you wanted matching records, but you only show matching records for file2 in your example so I'm not sure that's what you actually want.

Please show a better example (all variations - relevant fields only) of the records in each input file and what you want for output. Show matching records and non-matching records. Show all of the output records you expect.

Also, please indicate the starting position, length and format of all relevant fields in the input records and output records.
Back to top
View user's profile Send private message
sundarmohan

New User


Joined: 12 Feb 2008
Posts: 1
Location: bangalore

PostPosted: Tue Feb 12, 2008 8:58 pm    Post subject:
Reply with quote

hi Frank Yaeger,
my input file datatype is comp 3. it is not working.
above jcl is not working
can please guide me?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Feb 12, 2008 10:36 pm    Post subject:
Reply with quote

Hello sanmoh and welcome to the forum,

You need to post the actual jcl and control statements you submitted as well as the diagnostic information provided by the execution.

Showing some sample input and the expected output will also help.
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 Feb 12, 2008 11:13 pm    Post subject:
Reply with quote

If your yyyymmdd value is comp-3 it's a 5-byte PD field. For that you need to use a +yyyymmdd constant rather than a 'yyyymmdd' constant. Here's a DFSORT job that will generate a +yyyymmdd constant. I assumed your PD field starts at position 21. Adjust as needed.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
* Generate a DFSORT Symbol as follows:
* TARG,+yyyymmdd
* where yyyymmdd is from input file1
  INREC BUILD=(C'TARG,+',1,8,80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file2
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
* Use TARG symbol in INCLUDE statement
  INCLUDE COND=(21,5,PD,EQ,TARG)
/*
Back to top
View user's profile Send private message
pravinj

New User


Joined: 10 Jun 2008
Posts: 24
Location: india

PostPosted: Tue Oct 19, 2010 8:49 pm    Post subject: Reply to: ICETOOL Splice to match records
Reply with quote

I have a slightly different requirement here.
Control file will be having a single record with 6 values at defined positions. I need to split the input file into 6 files based on the control file record values. Share some thoughts on this?

Example:

Code:

Control file:
0----5----0----5----0
F   A     B    C   DE
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Oct 19, 2010 11:00 pm    Post subject:
Reply with quote

Hello,

What should the output be when that control file is input?

Mention the lrecl and dsorg of the files.

Explain the "rules" for processing.
Back to top
View user's profile Send private message
pravinj

New User


Joined: 10 Jun 2008
Posts: 24
Location: india

PostPosted: Wed Oct 20, 2010 1:27 pm    Post subject:
Reply with quote

My requirement is to split an input file into 3 files where the value for the split will be coming from an input file.

DSORG: FB
LRECL : 080

Say INPUT FILE
1
2
2
3
3
4
//multiple records//

Say control file
124
//the above values will be in a single record //

So the output file #1 should have:
1

#2:
2
2

#3:
4
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 Oct 20, 2010 10:34 pm    Post subject:
Reply with quote

You can use a DFSORT/ICETOOL job like the following to do what I think you're asking for.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD *
1
2
2
3
3
4
//CT DD *
124
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//OUT3 DD SYSOUT=*
//TOOLIN DD *
COPY FROM(CT) USING(CTL1)
COPY JKFROM USING(CTL2)
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,
    BUILD=(1,1,C'1',/,2,1,C'2',/,3,1,C'3')
//CTL2CNTL DD *
  JOINKEYS F1=IN,FIELDS=(1,1,A)
  JOINKEYS F2=T1,FIELDS=(1,1,A)
  REFORMAT FIELDS=(F1:1,80,F2:2,1)
  OPTION COPY
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
  OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)
  OUTFIL FNAMES=OUT3,INCLUDE=(81,1,CH,EQ,C'3'),BUILD=(1,80)
/*
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 Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Group elements using ICETOOL Learncoholic DFSORT/ICETOOL 2 Fri Apr 14, 2017 11:01 am
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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