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
 

 

Copy records based on condition

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

New User


Joined: 24 Feb 2006
Posts: 18
Location: Chennai

PostPosted: Wed Aug 19, 2009 8:26 pm    Post subject: Copy records based on condition
Reply with quote

Hi,

I have 2 files. One is a control file with only one record and other is a master file with many records. Both have recl 80 and FB.

If the control file has Low values in first 10 bytes, i should not copy the master file to output. If it is not low values, then i should copy the master file to output file.

Is it possible to do using a sort/icetool step?
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 Aug 19, 2009 9:12 pm    Post subject:
Reply with quote

By low values, do you mean binary zeros (X'00...00') or something else?

Do you want to avoid doing the copy at all if the control file has low values, or do you want to create an empty output data set?

Is RC=4 ok when the file is not copied?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Aug 19, 2009 9:26 pm    Post subject:
Reply with quote

Hi Partha,
Messages you are getting in below thread are WER messages..
http://ibmmainframes.com/viewtopic.php?t=43100

Which tells you have SYNCSORT not DFSORT at your shop...

SYNCSORT related questions should be posted in JCL forum..
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Wed Aug 19, 2009 10:08 pm    Post subject:
Reply with quote

Sambhaji,

The link which you have posted above leads to a topic in which "Parthasarathy", the OP of this topic is nowhere in the picture.
I could see only 'sprasannapathy' icon_eek.gif.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 20, 2009 10:17 am    Post subject:
Reply with quote

Arun wrote:
The link which you have posted above leads to a topic in which "Parthasarathy", the OP of this topic is nowhere in the picture.
I could see only 'sprasannapathy' .


My fatty eyes.. icon_mad.gif
Back to top
View user's profile Send private message
Parthasarathy

New User


Joined: 24 Feb 2006
Posts: 18
Location: Chennai

PostPosted: Thu Aug 20, 2009 10:34 am    Post subject:
Reply with quote

Thanks for your reply Frank,

Frank Yaeger wrote:
By low values, do you mean binary zeros (X'00...00') or something else?

You are correct. It is binary zeros only.

Frank Yaeger wrote:

Do you want to avoid doing the copy at all if the control file has low values, or do you want to create an empty output data set?

I want to create an empty output dataset.

Frank Yaeger wrote:

Is RC=4 ok when the file is not copied?

I need RC=0

Sambhaji, My shop is using DFSORT only icon_biggrin.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 20, 2009 11:49 am    Post subject:
Reply with quote

Hi Partha,
Below step will give you desired result. I have assumed that second file doesn't have binary zeros(X'00') at first 10 bytes.
Code:

//S1    EXEC  PGM=SORT       
//SYSOUT    DD  SYSOUT=*     
//SORTMSG    DD  SYSOUT=*   
//SORTIN  DD ctrl file
//        DD data file
//SORTOUT DD output file
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(1,80,SEQNUM,8,ZD)),                 
        IFTHEN=(WHEN=GROUP,BEGIN=(1,10,CH,EQ,X'00000000000000000000'), 
                PUSH=(89:ID=1))                                         
  OUTFIL BUILD=(1,80),INCLUDE=(89,1,ZD,NE,1,AND,81,8,ZD,NE,1)       
/*                                                                     
Back to top
View user's profile Send private message
Parthasarathy

New User


Joined: 24 Feb 2006
Posts: 18
Location: Chennai

PostPosted: Thu Aug 20, 2009 6:47 pm    Post subject: Reply to: Copy records based on condition
Reply with quote

Thanks a lot Sambhaji.
Unfortunately, my requirement got changed that my control file will have either 1 one record with values as binary zeros or more than one record with character values. the key remains same as 10 bytes in the control file. There will be no binary zeros in the other input file as you have rightly assumed.
It will be really helpful if you can provide me a solution for this.
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: Thu Aug 20, 2009 9:23 pm    Post subject:
Reply with quote

Partha,

You can use a DFSORT/ICETOOL job like the following to do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  control file
//IN2 DD DSN=...  input file
//CTL2CNTL DD DSN=&&C2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
COPY FROM(IN1) TO(CTL2CNTL) USING(CTL1)
COPY FROM(IN2) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFOUTLEN=80,
    IFTHEN=(WHEN=(1,10,BI,EQ,X'00000000000000000000'),
      BUILD=(C'  OMIT COND=ALL'))
/*
Back to top
View user's profile Send private message
Parthasarathy

New User


Joined: 24 Feb 2006
Posts: 18
Location: Chennai

PostPosted: Fri Aug 21, 2009 11:07 am    Post subject: Reply to: Copy records based on condition
Reply with quote

Hi Frank,

I expected that the solution might be bit complex.
But your solution looks very simple. icon_biggrin.gif

Many thanks for the simple solution. Thanks to all
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
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
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 Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 5 Thu Apr 27, 2017 1:15 am
No new posts Copy load modules and alias vasanthz IBM Tools 5 Thu Apr 20, 2017 6:31 am


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