IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Copy records based on condition


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Aug 19, 2009 9:12 pm
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
Reply with quote

Hi Partha,
Messages you are getting in below thread are WER messages..
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: 2481
Location: @my desk

PostPosted: Wed Aug 19, 2009 10:08 pm
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
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
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
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Aug 20, 2009 9:23 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top