Page 1 of 1

Select next record based on previous record

PostPosted: Wed Dec 31, 2008 4:14 pm
by Ron Mascarenhas
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.

Re: Select next record based on previous record

PostPosted: Wed Dec 31, 2008 9:56 pm
by Frank Yaeger
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/