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

Perhaps a simple question, but here goes


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 98
Location: Spain

PostPosted: Fri Sep 04, 2009 12:50 pm
Reply with quote

Hello There...

I was asked by a co-worker if there is a way to copy a file through Icetool to any of two posible DD DSNAMES based on the value of a field of a third file. The example goes as follows:

We have a File A, which could have one of two possible values, 'YYY' or 'ZZZ', as an example.

We also have, another input file, file B, which has a lot of records. This file has a LRECL of 100.

Now, the problem is, that we need to copy File B to DDNAME Output1 if the valules of file A are YYY. Otherwise, we need to copy the whole File B to DDNAME Ouput2 if the values in file A are ZZZ.

In short:

Code:

IF FILE A = YYY THEN
   COPY FILE B TO OUTPUT 1
ELSE
   IF FILE B = ZZZ THEN
       COPY FILE B TO OUPUT 2
   END IF
END-IF


Is there a way to acomplish this through Icetool or another sort Options?

Thanks a lot

Oliver
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: Sat Sep 05, 2009 5:46 am
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for assuming FILEA has RECFM=FB. (If FILEA has RECFM=VB, the job would need to be modified slightly.)

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//FILEA DD DSN=...  input fileA (FB)
//FILEB DD DSN=...  input fileB
//CTL2CNTL DD DSN=&&C2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//OUTPUT1 DD DSN=...  output file1
//OUTPUT2 DD DSN=...  output file2
//TOOLIN DD *
COPY FROM(FILEA) TO(CTL2CNTL) USING(CTL1)
COPY FROM(FILEB) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFOUTLEN=80,
   IFTHEN=(WHEN=(1,3,CH,EQ,C'YYY'),
    BUILD=(C'  OUTFIL FNAMES=OUTPUT1',80:X)),
   IFTHEN=(WHEN=NONE,
    BUILD=(C'  OUTFIL FNAMES=OUTPUT2'))
/*
Back to top
View user's profile Send private message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 98
Location: Spain

PostPosted: Mon Sep 07, 2009 3:12 pm
Reply with quote

Indeed, both files has RECFM=FB

Thanks a lot Frank. It never crossed my mind to create the CTL2 control card in execution time and use it for the copy operation.

With this the request is solved.

Thanks a lot again

Best Regards

Oliver
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 Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts Run a simple JOB as Started Task All Other Mainframe Topics 4
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
No new posts panel creation question TSO/ISPF 12
Search our Forums:

Back to Top