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
 

 

Insert records by using condition checking.

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

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Tue Sep 09, 2008 7:42 pm    Post subject: Insert records by using condition checking.
Reply with quote

Hi,

i am having the requirement like below

i have one input file which is having the records upto 10000. in these records for the perticular position is having repeteting value for some times.below i have mentiond the example records

Code:

(input file)
0---+----1----+----2----+----3----+----4----+----5
---->values<-------01<---------values------------>
---->values<-------02<---------values------------>
---->values<-------03<---------values------------>
---->values<-------04<---------values------------>
---->values<-------01<---------values------------>
---->values<-------02<---------values------------>
---->values<-------03<---------values------------>
---->values<-------04<---------values------------>
---->values<-------01<---------values------------>
---->values<-------02<---------values------------>
---->values<-------03<---------values------------>
---->values<-------04<---------values------------>


in the 20th position i am having the values like
01
02
03
04
repetedly like in above manner... 'Values' are some other values which are unique

My requirement is, first i want to check for the value '03' at 20th position in the above file(input), if it will find in any record once(means,no need to check for all times if it finds once) then i want to take all the records which is having the value '04' at position 20th to another file(output).


Code:

(output file)
0---+----1----+----2----+----3----+----4----+----5
---->values<-------04<---------values------------>
---->values<-------04<---------values------------>
---->values<-------04<---------values------------>


i request you, can anybody help me on this with using DFSORT or any other way by using JCL only.i dont want write a program for this.

Thanks in Advance.

Regards,
rguhanath.
Back to top
View user's profile Send private message

rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Tue Sep 09, 2008 8:11 pm    Post subject:
Reply with quote

Hi,

For some times i am having the input file like below. At this time i dont want create the output file. the o/p file should be in empty at this time.

Code:

(input file)
0---+----1----+----2----+----3----+----4----+----5
---->values<-------01<---------values------------>
---->values<-------02<---------values------------>
---->values<-------04<---------values------------>
---->values<-------01<---------values------------>
---->values<-------02<---------values------------>
---->values<-------04<---------values------------>
---->values<-------01<---------values------------>
---->values<-------02<---------values------------>
---->values<-------04<---------values------------>


Please help me on this.

Regards,
rguhanath
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Sep 09, 2008 9:13 pm    Post subject:
Reply with quote

rguhanath,

You can use DFSORT's new WHEN=GROUP function available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this

Code:

//STEP0100 EXEC PGM=ICEMAN                                         
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
---->VALUES<-------01<---------VALUES------------>                 
---->VALUES<-------02<---------VALUES------------>                 
---->VALUES<-------03<---------VALUES------------>                 
---->VALUES<-------04<---------VALUES------------>                 
---->VALUES<-------01<---------VALUES------------>                 
---->VALUES<-------02<---------VALUES------------>                 
---->VALUES<-------03<---------VALUES------------>                 
---->VALUES<-------04<---------VALUES------------>                 
---->VALUES<-------01<---------VALUES------------>                 
---->VALUES<-------02<---------VALUES------------>                 
---->VALUES<-------03<---------VALUES------------>                 
---->VALUES<-------04<---------VALUES------------>                 
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(20,2,CH,EQ,C'03'),
        PUSH(81:20,2))
  SORT FIELDS=COPY                                                 
  OUTFIL INCLUDE=(20,2,CH,EQ,C'04',AND,81,2,CH,EQ,C'03'),         
  BUILD=(01,80)                                                   
/*     



For complete details on the new WHEN=GROUP function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/

Hope this helps...

Cheers
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Wed Sep 10, 2008 10:00 am    Post subject:
Reply with quote

Many Thanks Kolusu.

-rguhanath
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Wed Sep 10, 2008 5:20 pm    Post subject:
Reply with quote

Hi

i have got the below error when i was run the job.

Code:

********************************* TOP OF DATA ***************************
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                             
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE       
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 07:08 ON WED SEP 10, 2008 - 
            INREC IFTHEN=(WHEN=GROUP,BEGIN=(20,2,CH,EQ,'03'),PUSH(81:20,2))                 
                               $                                                             
ICE007A 0 SYNTAX ERROR                                                                       
            SORT FIELDS=COPY                                                                 
            OUTFIL INCLUDE=(20,2,CH,EQ,'04',AND,81,2,CH,EQ,'03'),                               
            BUILD=(01,80)                                                             
ICE751I 0 C5-K90007 C6-K90007 C7-K90000 C8-K90007 E7-K11698                                 
ICE052I 3 END OF DFSORT                                                                     
******************************** BOTTOM OF DATA *************************


Regards,
Rguhanath
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: Wed Sep 10, 2008 8:06 pm    Post subject:
Reply with quote

Hello,

Did you ensure the latest ptf has been applied?

If you run any sort that works and post the ICE201I message line, it will show which ptf level is on your system.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Sep 10, 2008 10:18 pm    Post subject: Reply to: Insert records by using condition checking.
Reply with quote

rguhanath,

Looks like you don't have the latest ptf. Ask your System Programmer to install z/OS DFSORT V1R5 PTF UK90013 (it's free)

Here is an alternative DFSORT/ICETOOL solution using SPLICE

Code:

//STEP0200 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD *                                               
---->VALUES<-------01<---------VALUES------------>           
---->VALUES<-------02<---------VALUES------------>           
---->VALUES<-------03<---------VALUES------------>           
---->VALUES<-------04<---------VALUES------------>           
---->VALUES<-------01<---------VALUES------------>           
---->VALUES<-------02<---------VALUES------------>           
---->VALUES<-------03<---------VALUES------------>           
---->VALUES<-------04<---------VALUES------------>           
---->VALUES<-------01<---------VALUES------------>           
---->VALUES<-------02<---------VALUES------------>           
---->VALUES<-------03<---------VALUES------------>           
---->VALUES<-------04<---------VALUES------------>           
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                               
    SPLICE FROM(IN) TO(OUT) ON(81,1,CH) KEEPBASE KEEPNODUPS -
    WITHALL WITH(01,80) USING(CTL1)                           
//CTL1CNTL DD *                                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:3X)),                   
        IFTHEN=(WHEN=(20,2,CH,EQ,C'03'),OVERLAY=(82:20,2))   
  SORT FIELDS=(81,1,CH,A,82,2,CH,D)                           
  OUTFIL FNAMES=OUT,                                         
  INCLUDE=(20,2,CH,EQ,C'04',AND,82,2,CH,EQ,C'03'),           
  BUILD=(01,80)                                               
/*                                                           
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Thu Sep 11, 2008 10:34 am    Post subject:
Reply with quote

Hi Skolusu,

Many thanks to you. its working fine now. actually what i think, this is for my other requirement. so that i posted this as new topic. but still i have doubt on my post 'Filtering records' which is why its not working with 'AND' condition. please tell me the reason and my fault in coding.

Thanks a lot

Regards,
rguhanath.
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Thu Sep 11, 2008 10:39 am    Post subject:
Reply with quote

Hi XungoPejcao and guptae,

Thanks for your responce.!!

Regards,
rguhanath
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Sep 11, 2008 9:54 pm    Post subject:
Reply with quote

rguhanath wrote:
but still i have doubt on my post 'Filtering records' which is why its not working with 'AND' condition. please tell me the reason and my fault in coding.

rguhanath,

INCLUDE/OMIT conditions work on a individual records. It checks your if your conditions are satisfied on one record at a time. Your case is different as you want to check a previous record value to the next record value which is NOT possible with traditional INCLUDE/OMIT conditions.
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Thu Sep 11, 2008 10:50 pm    Post subject:
Reply with quote

Hi Kolusu,

But how 'OR' condition is work in INCLUDE statement if INCLUDE condition will work only with individual records?

Thanks and Regards,
rguhanath.
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: Thu Sep 11, 2008 11:15 pm    Post subject:
Reply with quote

Hello,

Quote:
But how 'OR' condition is work in INCLUDE statement if INCLUDE condition will work only with individual records?
It is not clear what you are asking. . . icon_confused.gif

Which OR do you refer to?
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Fri Sep 12, 2008 9:04 am    Post subject:
Reply with quote

Hi Scherrer,

i already post a topic regarding this. but it was locked by 'Skolusu'.

Please refer the below link for my query in detail.

http://www.ibmmainframes.com/viewtopic.php?p=152699#152699

Thanks and
Regards,
rguhanath
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Sep 12, 2008 8:59 pm    Post subject:
Reply with quote

rguhanath wrote:
i already post a topic regarding this. but it was locked by 'Skolusu'.


rguhanath,

Please don't ASSUME. I have got nothing to do with the locking of the topic.

rguhanath wrote:
After submitting the job, i got empty output file. if i gave 'OR' instead of 'AND' then i got both records. if we dont have '08' record in input file then also we get '13' record by using 'OR' condition. but i want both records by using 'AND' condition. if we dont have '08' record and have '13' record then i want empty file other wise i want both records in output file.


As I said earlier SORT checks all the include conditions on a single record. When you used OR condition sort checked to see if you had '08' at pos 20 and if it is found it will write out to the output record. Now sort also checks the other include conditions to see if it is valid. If a match is found it is written to the output

When you use an AND condition it is telling sort to check for values of '08' and '20' at pos 20 which is not possible on a single record. Sort cannot apply the include conditions to more than 1 record at a time.

With group functions we treat the first record as a header and push that value to each record that follows and now we can use an include to compare the values as the header value is propagated on to the records that follow.

For complete details on the new WHEN=GROUP function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/

see the examples and how push works

Hope this helps...

Cheers
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Mon Sep 15, 2008 9:10 am    Post subject:
Reply with quote

Hi Kolusu,

i am sorry. i didn't mind that.

Many thanks to you for clarifying my doubt on this.


Regards,
rguhanath.
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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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