Select next record based on previous record



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Select next record based on previous record

Postby Ron Mascarenhas » Wed Dec 31, 2008 4:14 pm

I have a file with 10 records that looks like this (the second line in each set has all leading blanks) for example:

030100010000000012345678787877
                                    abcdef
030400020000000067676767678787
                      asdkjlkjlkajsdlkj
030100010000000012345678787877
                            asdkjlkjlkajsdlkjfgfgfgfgfg
030100010000000012345678787877
                 abcdef
030400020000000067676767678787
                                      dfdfdfdfdfdfdfdfdfdf


Can I used ICETOOL or DFSORT to split it out into 2 files so the two files look as follows:

File1 has all 0304 records and the record following it:
030400020000000067676767678787
                  asdkjlkjlkajsdlkj
030400020000000067676767678787
                  dfdfdfdfdfdfdfdfdfdf


file2 should have all 0301 records and the record following it:

030100010000000012345678787877
                                abcdef
030100010000000012345678787877
                        asdkjlkjlkajsdlkjfgfgfgfgfg
030100010000000012345678787877
         abcdef


Thanks for the help.
Ron Mascarenhas
 
Posts: 15
Joined: Mon Nov 03, 2008 2:04 am
Has thanked: 0 time
Been thanked: 0 time

Re: Select next record based on previous record

Postby Frank Yaeger » Wed Dec 31, 2008 9:56 pm

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. You'll need z/OS PTF UK90013 (July, 2008) to use DFSORT's new WHEN=GROUP function. If you don't have this PTF, ask your System Programmer to install it.

//S1    EXEC  PGM=ICEMAN                                           
//SYSOUT    DD  SYSOUT=*                                           
//SORTIN DD *                                                       
030100010000000012345678787877                                     
                                    abcdef                         
030400020000000067676767678787                                     
                      asdkjlkjlkajsdlkj                             
030100010000000012345678787877                                     
                            asdkjlkjlkajsdlkjfgfgfgfgfg             
030100010000000012345678787877                                     
                 abcdef                                             
030400020000000067676767678787                                     
                                      dfdfdfdfdfdfdfdfdfdf         
/*
//OUT1 DD SYSOUT=*                                                 
//OUT2 DD SYSOUT=*                                                 
//SYSIN    DD    *                                                 
   OPTION COPY                                                       
   INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:1,4))                 
   OUTFIL FNAMES=OUT1,INCLUDE=(81,4,CH,EQ,C'0304'),BUILD=(1,80)     
   OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,80)                             
/*


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

http://www.ibm.com/systems/support/stor ... /mvs/ugpf/
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post