MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Split and change data unconditionally

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
newuser
Beginner


Joined: 12 Jun 2003
Posts: 16
Topics: 8

PostPosted: Fri Jul 18, 2003 3:50 pm    Post subject: Split and change data unconditionally Reply with quote

Hello,
I am using the following sort to split the iinput file to 4 output files:

Code:


//STEP0100 EXEC PGM=SORT                               
//*                                                     
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD DSN=BJ67FT.WBQ.PVC.PSI01.D0328E.BKP,     
//            DISP=SHR                                 
//SORTOF01 DD DSN=BJ67FT.WBQ.PVC.SP1.D0328E,           
//            DISP=(NEW,CATLG,DELETE),                 
//            UNIT=SYSDA,RETPD=2,                       
//            SPACE=(CYL,(500,100),RLSE)               
//SORTOF02 DD DSN=BJ67FT.WBQ.PVC.SP2.D0328E,           
//            DISP=(NEW,CATLG,DELETE),                 
//            UNIT=SYSDA,RETPD=2,                       
//            SPACE=(CYL,(500,100),RLSE)               
//SORTOF03 DD DSN=BJ67FT.WBQ.PVC.SP3.D0328E,           
//            DISP=(NEW,CATLG,DELETE),                 
//            UNIT=SYSDA,RETPD=2,                   
//            SPACE=(CYL,(500,100),RLSE)           
//SORTOF04 DD DSN=BJ67FT.WBQ.PVC.SP4.D0328E,       
//            DISP=(NEW,CATLG,DELETE),             
//            UNIT=SYSDA,RETPD=2,                   
//            SPACE=(CYL,(500,100),RLSE)           
//SYSIN   DD *                                     
  SORT FIELDS=COPY                                 
  OUTFIL FILES=01,ENDREC=3000                       
  OUTFIL FILES=02,STARTREC=3001,ENDREC=6000         
  OUTFIL FILES=03,STARTREC=6001,ENDREC=9000         
  OUTFIL FILES=04,STARTREC=9001                     
/*                                                 


Now I have this added requirement to unconditionally change a DATE field in all the records.The Date field is in position 25 for a length of 10 characters.

For the first file, I need to change this date to DATE1 value, second file to DATE2 value, third file to DATE3 value and last file to DATE4 value. I want this 4 dates to be updated on the files as I split them itself. I also would like these dates to be a PARM driven, if possible so that we donot hardcode the date on the sysin.

How can I add this additional condition in the above SORT step so that I have the whole thing in one STEP.

Regards
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Jul 18, 2003 4:37 pm    Post subject: Reply with quote

You didn't say what DATE1-DATE4 are or where you get them from, so I'm assuming you just want to hardcode them to what you need. If not, please give more details about these dates.

You could do it using a DFSORT job with DFSORT Symbols like the following. You can easily change your dates in the SYMNAMES statements and they will be used in the OUTREC parameters of the OUTFIL statements. I've assumed your input data set is RECFM=FB and LRECL=80, but the job can be adjusted for other attributes.

Code:

//STEP0100 EXEC PGM=SORT                               
//*     
//SYMNAMES DD *       
MYDATE1,C'2003/07/10' 
MYDATE2,C'2003/07/11' 
MYDATE3,C'2003/07/12' 
MYDATE4,C'2003/07/13' 
/*                                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD DSN=BJ67FT.WBQ.PVC.PSI01.D0328E.BKP,     
//            DISP=SHR                                 
//SORTOF01 DD DSN=BJ67FT.WBQ.PVC.SP1.D0328E,           
//            DISP=(NEW,CATLG,DELETE),                 
//            UNIT=SYSDA,RETPD=2,                       
//            SPACE=(CYL,(500,100),RLSE)               
//SORTOF02 DD DSN=BJ67FT.WBQ.PVC.SP2.D0328E,           
//            DISP=(NEW,CATLG,DELETE),                 
//            UNIT=SYSDA,RETPD=2,                       
//            SPACE=(CYL,(500,100),RLSE)               
//SORTOF03 DD DSN=BJ67FT.WBQ.PVC.SP3.D0328E,           
//            DISP=(NEW,CATLG,DELETE),                 
//            UNIT=SYSDA,RETPD=2,                   
//            SPACE=(CYL,(500,100),RLSE)           
//SORTOF04 DD DSN=BJ67FT.WBQ.PVC.SP4.D0328E,       
//            DISP=(NEW,CATLG,DELETE),             
//            UNIT=SYSDA,RETPD=2,                   
//            SPACE=(CYL,(500,100),RLSE)           
//SYSIN   DD *                                     
  SORT FIELDS=COPY                                 
  OUTFIL FILES=01,ENDREC=3000,               
    OUTREC=(1,24,MYDATE1,35,46)             
  OUTFIL FILES=02,STARTREC=3001,ENDREC=6000,
    OUTREC=(1,24,MYDATE2,35,46)             
  OUTFIL FILES=03,STARTREC=6001,ENDREC=9000,
    OUTREC=(1,24,MYDATE3,35,46)             
  OUTFIL FILES=04,STARTREC=9001,             
    OUTREC=(1,24,MYDATE4,35,46)             
/*                                                 

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
newuser
Beginner


Joined: 12 Jun 2003
Posts: 16
Topics: 8

PostPosted: Mon Jul 21, 2003 12:23 pm    Post subject: Reply with quote

Thanks Frank for the outrec solution.

The problem just got bigger! The input file has Header and Trailer record. Header record is the first record, Trailer record is the last record of the input file.
I need to carry the same header and trailer record from the input file to each of the 4 output files. Can it still be achieved in a single STEP?? I am not sure of an optimized solution for this.

Regards!
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Jul 21, 2003 1:28 pm    Post subject: Reply with quote

Newuser,

You can do what you want in one step (though not in one pass) with DFSORT's ICETOOL.

I've assumed that you can identify the TRAILER record via 'TRAILER' in positions 1-7. You can change the INCLUDE statement to identify the trailer record in other ways. If the Trailer record is just the last record and you can't identify it any other way, then let me know and I'll show
you how to modify the DFSORT/ICETOOL job accordingly.

I've assumed you don't want to count the Header record (1) as a data record (for example, 2-3001 are the data records for OUT1), but you can modify the STARTREC and ENDREC values to get the data records you want where you want them.

You'll need to use MOD for your four output data sets as shown.

Here's the DFSORT/ICETOOL job:

Code:

//STEP0100 EXEC PGM=ICETOOL
//*
//SYMNAMES DD *
MYDATE1,C'2003/07/10'
MYDATE2,C'2003/07/11'
MYDATE3,C'2003/07/12'
MYDATE4,C'2003/07/13'
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN       DD DSN=BJ67FT.WBQ.PVC.PSI01.D0328E.BKP,
//            DISP=SHR
//TRL DD DSN=&&T,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//***>
//***>  USE MOD FOR OUT1-OUT4
//***>
//OUT1     DD DSN=BJ67FT.WBQ.PVC.SP1.D0328E,
//            DISP=(MOD,CATLG,DELETE),
//            UNIT=SYSDA,RETPD=2,
//            SPACE=(CYL,(500,100),RLSE)
//OUT2     DD DSN=BJ67FT.WBQ.PVC.SP2.D0328E,
//            DISP=(MOD,CATLG,DELETE),
//            UNIT=SYSDA,RETPD=2,
//            SPACE=(CYL,(500,100),RLSE)
//OUT3     DD DSN=BJ67FT.WBQ.PVC.SP3.D0328E,
//            DISP=(MOD,CATLG,DELETE),
//            UNIT=SYSDA,RETPD=2,
//            SPACE=(CYL,(500,100),RLSE)
//OUT4     DD DSN=BJ67FT.WBQ.PVC.SP4.D0328E,
//            DISP=(MOD,CATLG,DELETE),
//            UNIT=SYSDA,RETPD=2,
//            SPACE=(CYL,(500,100),RLSE)
//TOOLIN  DD *
* Copy Header to OUT2, OUT3 and OUT4
* Copy Trailer to TRL (temp. data set)
  COPY FROM(IN) USING(CTL1)
* Copy data records to OUT1, OUT2, OUT3 and OUT4
* with appropriate MYDATEx
  COPY FROM(IN) USING(CTL2)
* Copy Trailer record to OUT1, OUT2 and OUT3
  COPY FROM(TRL) TO(OUT1,OUT2,OUT3)
//CTL1CNTL DD *
  OUTFIL FNAMES=(OUT2,OUT3,OUT4),ENDREC=1
  OUTFIL FNAMES=TRL,INCLUDE=(1,7,CH,EQ,C'TRAILER')
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT1,ENDREC=3001,
    OUTREC=(1,24,MYDATE1,35,46)
  OUTFIL FNAMES=OUT2,STARTREC=3002,ENDREC=6001,
    OUTREC=(1,24,MYDATE2,35,46)
  OUTFIL FNAMES=OUT3,STARTREC=6002,ENDREC=9001,
    OUTREC=(1,24,MYDATE3,35,46)
  OUTFIL FNAMES=OUT4,STARTREC=9002,
    OUTREC=(1,24,MYDATE4,35,46)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group