To compare a dataset and generate output file.



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

To compare a dataset and generate output file.

Postby kimir » Sun Oct 23, 2011 8:07 pm

I have the below requirement.
Input file.
AAAA BBBB CCCC H 123456 DDDD
AAAA BBBB CCCC B 456789 DDDD
AAAA BBBB CCCC O 741258 DDDD
EEEE FFFF GGGG H 111222 HHHH
EEEE FFFF GGGG B 111777 HHHH
UUUU YYYY QQQQ O 789456 ZZZZ

Output file.
AAAA BBBB CCCC 123456 456789 741258 DDDD
EEEE FFFF GGGG 111222 111777 <space>HHHH
UUUU YYYYY QQQQ<space><space>789456 ZZZZ

Thank You.
kimir
 
Posts: 6
Joined: Sun Oct 23, 2011 7:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: To compare a dataset and generate output file.

Postby enrico-sorichetti » Sun Oct 23, 2011 11:10 pm

unless You come out with some additional criteria,
it will be impossible to decide in which column to store the <numeric> fields
the only possible pattern will be to put the <spaces> at the end of each triplet
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3002
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: To compare a dataset and generate output file.

Postby dick scherrer » Mon Oct 24, 2011 12:02 am

Hello and welcome to the forum,

When you post the required info, also repost the data using the "Code" tag which will maintain alignment and make the post more readable. There is a Preview function so you can see your post as it will appear to the forum. When you are satisfied with your post appears, Submit.

In sentence form, post the processing rules.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: To compare a dataset and generate output file.

Postby BillyBoyo » Mon Oct 24, 2011 3:25 am

Your output has records containing data from groups of one, two or three input records. We need to know the "key" that is used to know that the records are in the same group.

It looks like you are converting the H/B/O followed by a number to three columns, number(H), number(B), number (O), with the irrelevant columns blank, but we can't be certain.

We need a full description, we can't really help with what you have provided so far.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: To compare a dataset and generate output file.

Postby Frank Yaeger » Mon Oct 24, 2011 11:15 pm

Kimir,

You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD *
AAAA BBBB CCCC H 123456 DDDD
AAAA BBBB CCCC B 456789 DDDD
AAAA BBBB CCCC O 741258 DDDD
EEEE FFFF GGGG H 111222 HHHH
EEEE FFFF GGGG B 111777 HHHH
UUUU YYYY QQQQ O 789456 ZZZZ
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,14,CH) KEEPNODUPS WITHEACH -
  WITH(23,6) WITH(30,6) USING(CTL1)
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=(16,1,CH,EQ,C'H'),
    BUILD=(1,15,16:18,6,37:25,4,80:X)),
   IFTHEN=(WHEN=(16,1,CH,EQ,C'B'),
    BUILD=(1,15,23:18,6,37:25,4)),
   IFTHEN=(WHEN=(16,1,CH,EQ,C'O'),
    BUILD=(1,15,30:18,6,37:25,4))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: To compare a dataset and generate output file.

Postby kimir » Tue Oct 25, 2011 7:58 pm

Hi Frank,
Thanks for the quick response. Can you tell me what

WITHEACH WITH(23,6) WITH (30,6)

does. As the last position in the input file is at column 28 and also, the space after 123456 begins at 24 pos.
Understanding this will help me customize the solution provided by you.

Thank You.
kimir
 
Posts: 6
Joined: Sun Oct 23, 2011 7:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: To compare a dataset and generate output file.

Postby Frank Yaeger » Tue Oct 25, 2011 10:51 pm

For complete details on all of the options of DFSORT/ICETOOL's SPLICE operator, see:

http://publibz.boulder.ibm.com/cgi-bin/ ... 0608113434

If the last field starts in 28 instead of 24, then just change the control statements in CTL1CNTL to:

//CTL1CNTL DD *                               
  INREC IFTHEN=(WHEN=(16,1,CH,EQ,C'H'),       
    BUILD=(1,15,16:18,6,37:28,4,80:X)),       
   IFTHEN=(WHEN=(16,1,CH,EQ,C'B'),           
    BUILD=(1,15,23:18,6,37:28,4)),           
   IFTHEN=(WHEN=(16,1,CH,EQ,C'O'),           
    BUILD=(1,15,30:18,6,37:28,4))             
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: To compare a dataset and generate output file.

Postby kimir » Thu Nov 03, 2011 11:25 pm

Hi Frank,
I am facing an odd situation. As per your suggestions, I customized the solution to my requirement.By using KEEPNODUPS and WITHEACH I am getting single row for each row present for the key.However,there are two issues that I am facing.
1.Data is getting concatenated even though I have rechecked the column positions.
AAAA BBBB CCCC <Space><Space> 7412BB DDDD --> 58 is truncated and replace by blanks.
Is there a way to over come this? I have rechecked the column positions to make sure there is no mistake here.

2. The last condition in IFTHEN is over writing all the other values. To illustrate using my above record layout,even though the first 3 rows have different values for H,B and O, the output is
AAAA BBBB CCCC <Space><Space> 741258 DDDD (Even though H and B have numbers associated with them, they are being overwritten)
instead of
AAAA BBBB CCCC 123456 456789 741258 DDDD
Is there a way we can retain the values for a record originally BUILT when comparison happens between the base record and the overlay records(for any combination between H,B and O)?

Waiting for your guidance on the same...

Thank you,
Kimir.
kimir
 
Posts: 6
Joined: Sun Oct 23, 2011 7:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: To compare a dataset and generate output file.

Postby Frank Yaeger » Fri Nov 04, 2011 1:16 am

When I run this DFSORT job:

//S1    EXEC  PGM=ICETOOL                                   
//TOOLMSG DD SYSOUT=*                                       
//DFSMSG  DD SYSOUT=*                                       
//IN DD *                                                   
AAAA BBBB CCCC H 123456    DDDD                             
AAAA BBBB CCCC B 456789    DDDD                             
AAAA BBBB CCCC O 741258    DDDD                             
EEEE FFFF GGGG H 111222    HHHH                             
EEEE FFFF GGGG B 111777    HHHH                             
UUUU YYYY QQQQ O 789456    ZZZZ                             
//OUT DD SYSOUT=*                                           
//TOOLIN DD *                                               
SPLICE FROM(IN) TO(OUT) ON(1,14,CH) KEEPNODUPS WITHEACH -   
  WITH(23,6) WITH(30,6) USING(CTL1)                         
//CTL1CNTL DD *                                             
  INREC IFTHEN=(WHEN=(16,1,CH,EQ,C'H'),   
    BUILD=(1,15,16:18,6,37:28,4,80:X)),   
   IFTHEN=(WHEN=(16,1,CH,EQ,C'B'),         
    BUILD=(1,15,23:18,6,37:28,4)),         
   IFTHEN=(WHEN=(16,1,CH,EQ,C'O'),         
    BUILD=(1,15,30:18,6,37:28,4))         


I get the following output:
AAAA BBBB CCCC 123456 456789 741258 DDDD
EEEE FFFF GGGG 111222 111777        HHHH
UUUU YYYY QQQQ               789456 ZZZZ


This corresponds to the output you said you wanted:

AAAA BBBB CCCC 123456 456789 741258 DDDD
EEEE FFFF GGGG 111222 111777 <space>HHHH
UUUU YYYYY QQQQ<space><space>789456 ZZZZ


If you are getting a different output, then there's something different between your job and my job that you're not telling me about. Perhaps the positions and lengths of your fields are NOT what I think they are? If you look at my example, you'll see how I assumed the data looked in //IN. If it doesn't look that way, then you have to tell me exactly how it does look. If you have additional data that isn't getting the output you want, then you need to show me that additional data.

Also, it would help if you posted the complete JES log for your run so I can see what you're doing exactly.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post