Page 1 of 1

Sorting below problem using ICETOOL

PostPosted: Mon Apr 06, 2009 4:58 pm
by radhika_engimuri
Hi,

Could any one hlep me out in sorting below problem using ICETOOL as I dont have more knowledge on this.

My input file looks like

12345 SI1 '8765123456'
12345 SI2 ' '
12345 SI2 ' '
23456 SI1 '9812345599'
23456 SI2 ' '
87123 SI1 '5612345590'
87123 SI2 ' '
87123 SI2 ' '

Key value here is first 5 digits
My requirement is to copy the field value after SI1 in to all respective SI2 records of same field.

My output should like

12345 SI1 '8765123456'
12345 SI2 '8765123456'
12345 SI2 '8765123456'
23456 SI1 '9812345599'
23456 SI2 '9812345599'
87123 SI1 '5612345590'
87123 SI2 '5612345590'
87123 SI2 '5612345590'


Thanks in advance,
Radhika

Re: ICETOOL usage

PostPosted: Mon Apr 06, 2009 8:37 pm
by Frank Yaeger
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 *
12345 SI1 '8765123456'
12345 SI2 '          '
12345 SI2 '          '
23456 SI1 '9812345599'
23456 SI2 '          '
87123 SI1 '5612345590'
87123 SI2 '          '
87123 SI2 '          '
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFOUTLEN=80,
   IFTHEN=(WHEN=INIT,
     OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,5))),
   IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),
     PUSH=(12:12,10))
/*

Re: Sorting below problem using ICETOOL

PostPosted: Tue Apr 07, 2009 8:05 pm
by radhika_engimuri
Hi Frank,

Thanks for your update but I found that we dont have latest version of DFSORT Installed in our system due to which its not accepting the commands WHEN ,PUSH. We are using DFSORT Version - Z/OS DFSORT V1R5.
Could you please help me out in writing the same code without WHEN and PUSH Commands.



Thanks for your help
Radhika

Re: Sorting below problem using ICETOOL

PostPosted: Tue Apr 07, 2009 8:53 pm
by Frank Yaeger
We are using DFSORT Version - Z/OS DFSORT V1R5.


Ask your System Programmer to install z/OS DFSORT V1R5 PTF UK90013 - it's free and has been available since July, 2008.

Meanwhile, you can use this DFSORT/ICETOOL job that doesn't require the PTF:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD *
12345 SI1 '8765123456'
12345 SI2 '          '
12345 SI2 '          '
23456 SI1 '9812345599'
23456 SI2 '          '
87123 SI1 '5612345590'
87123 SI2 '          '
87123 SI2 '          '
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,5,CH) KEEPBASE KEEPNODUPS -
  WITHALL WITH(1,10) USING(CTL1)
/*
//CTL1CNTL DD *
  OPTION COPY
/*

Re: Sorting below problem using ICETOOL

PostPosted: Wed Apr 08, 2009 1:44 pm
by radhika_engimuri
Hi Frank,

I tried with your code but that will copy the base record as it is in the next record.

My requirement is to copy ONLY LAST 10 characters but this will replace all SI2 with SI1 which I dont want

When I tried below code the output came as
12345 SI1 '8765123456'
12345 SI1 '8765123456'
12345 SI1 '8765123456'
23456 SI1 '9812345599'
23456 SI1 '9812345599'
87123 SI1 '5612345590'
87123 SI1 '5612345590'
87123 SI1 '5612345590'

BUT my expected output should be

12345 SI1 '8765123456'
12345 SI2 '8765123456'
12345 SI2 '8765123456'
23456 SI1 '9812345599'
23456 SI2 '9812345599'
87123 SI1 '5612345590'
87123 SI2 '5612345590'
87123 SI2 '5612345590'

Please help me in resolving it

Thanks
Radhika

Re: Sorting below problem using ICETOOL

PostPosted: Wed Apr 08, 2009 7:54 pm
by Frank Yaeger
but this will replace all SI2 with SI1 which I dont want


No, it doesn't.

When I run my job with your input, I get the output you say you want. I don't understand how you would get the output you say you got if you used my job as shown and your input records are as shown. WITH(1,10) takes the first 10 bytes from the overlay record (e.g. first record) and the remaining bytes from the base record (e.g. second record). So the second record would have '12345 SI2' and not '12345 SI1'.

Is 'SI2' in positions 7-9 as shown in your example? If not, where is 'SI2'?

Please check that your job matches mine exactly and that the data is in the positions you indicated. If you think that's true and you are still getting the "wrong" output, then post the TOOLMSG and DFSMSG messages you receive for the job.

Re: Sorting below problem using ICETOOL

PostPosted: Mon Apr 13, 2009 4:52 pm
by radhika_engimuri
Hi Frank,

I am sorry, I misplaced character positions and tried running the JCL which resulted in Wrong output.

Thanks for alllllll your help

I have another requirement to add into the current scenario. Please help me
My input
FIELDS
--------
A B C
------------------------
12345 SI1 '8765123456'
12345 SI2 ' '
12345 SI2 ' '

34567 SI1 '3890567892'
34567 SI1 '4512789034'


23456 SI1 '9812345599'
23456 SI2 ' '
87123 SI1 '5612345590'
87123 SI2 ' '
87123 SI2 ' '

Previously, all the SPACES(field C) in SI2 record get overwritten with value in SI1 record of same key. This can be acheived using OPTION COPY With(1,10) which will
copy the base record value into SI2 records.

BUT now if you see the key - 34567 has two records with diff values in field 'C' . With the previous SPLICE command it go and overwrite the base record in second recrod . Instead of this, I would like to retain second record as it is. I hope "WE CAN'T TAKE Field 'C' also in SPLICE ON command or as Key Field".

My output should like

12345 SI1 '8765123456'
12345 SI2 '8765123456'
12345 SI2 '8765123456'

34567 SI1 '3890567892'
34567 SI1 '4512789034'


23456 SI1 '9812345599'
23456 SI2 '9812345599'
87123 SI1 '5612345590'
87123 SI2 '5612345590'
87123 SI2 '5612345590'

Thanks in advance,
Radhika

Re: Sorting below problem using ICETOOL

PostPosted: Mon Apr 13, 2009 9:24 pm
by Frank Yaeger
Well, now I don't know what possible variations you have and I don't want you to keep coming back each time you think of a new one.

So please take some time to come up with all of the possible variations and show examples of input and expected output.

For example, can you have mixed blanks and nonblanks for field C for the same key? For example:

34567 SI1 '3890567892'
34567 SI1 '4512789034'
34567 SI1 ' '
34567 SI1 '5512789034'
34567 SI1 ' '

Can the first record have blanks for field C?

Can the second and subsequent records have blanks followed by nonblanks, nonblanks followed by blanks, etc?