Norbert, As I mentioned earlier it can be done in single pass as shown earlier, I was just trying to optimize your Joinkeys job. With your new job there a couple of issues
1. I am not sure as to why you need to append C'40' (may be you meant X'40') 2. With the append of C'40' your output LRECL is increased by 1. ie. the output now has LRECL+8+1 3. I am not sure as to why you need to validate the RDW to remove the short records. JFY will pad up short records. So even if you records with lrecl less than 12 it will only pick the available characters. You can simply run the following job without any check of the RDW //STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SYMNOUT DD SYSOUT=* //SORTIN DD DISP=SHR,DSN=Your Input VB file //SORTOUT DD SYSOUT=* //SYSIN DD * OPTION COPY INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5,HEX)), IFTHEN=(WHEN=INIT,OVERLAY=(5:HEX_DATA,JFY=(SHIFT=RIGHT))), IFTHEN=(WHEN=INIT,BUILD=(1,4,KEY_START,HEX_DATA,JFY=(SHIFT=LEFT))), IFTHEN=(WHEN=INIT,FINDREP=(IN=(C' '),OUT=C'')), IFTHEN=(WHEN=INIT,BUILD=(1,4,5,TRAN=UNHEX)) //* //SYMNAMES DD * HEX_DATA,5,32736,CH * 2*MAX_LRECL KEY_START,32725,16,CH * HEX_DATA-16+5 //* Further if you have any questions please let me know Thanks. Sri Hari Kolusu DFSORT Development IBM Corporation IBM Mainframe Discussion List <[email protected]> wrote on 06/10/2015 11:08:56 AM: > From: Norbert Friemel <[email protected]> > To: [email protected] > Date: 06/10/2015 11:09 AM > Subject: Re: DFSORT - How to select last 8 bytes in variable length records > Sent by: IBM Mainframe Discussion List <[email protected]> > > On Wed, 10 Jun 2015 09:32:38 -0700, Sri h Kolusu wrote: > > >Minoru Massaki, > > > >Norbert had an excellent idea to overcome the issue of having spaces at > >the beginning or at the end. Converting to hex would overcome the issue of > >truncation with JFY. > > > >However you do NOT require 2 passes of data to insert the trailing > >character using VLTRAIL and then use Joinkeys. > > > >I have optimized the Job. The trick here is to use the same input file for > >Joinkeys. The subtask2 file is where we convert to hex and perform the > >JUSTIFY to RIGHT and pick of the last 16 bytes and then unhex that 16 > >bytes back to 8 bytes. > > > >we are appending a 4 byte sequence number to match the 2 files. And since > >they are already in order, we also have SORTED and NOSEQCK so that we use > >a copy operation for Joinkeys. > > > > Yet another version (the final): single pass, no join, all data > (x'00-x'ff') allowed: > > //* > //STEP1 EXEC PGM=SORT > //* > //SYSOUT DD SYSOUT=* > //SORTIN DD DISP=OLD, > // DSN=??? > //SORTOUT DD DISP=(,CATLG,DELETE), > // SPACE=(TRK,(5,5),RLSE), > // LRECL=16380,RECFM=VB, > // DSN=??? > //DISCARD DD DISP=(,CATLG,DELETE), > // SPACE=(TRK,(5,5),RLSE), > // DSN=??? > //SYSIN DD * > OUTFIL INCLUDE=(1,2,BI,GE,12,&,1,2,BI,LE,max_lrecl), > IFTHEN=(WHEN=INIT, > BUILD=(1,4,5,HEX)), > IFTHEN=(WHEN=INIT, > OVERLAY=(5:hex_data,JFY=(SHIFT=RIGHT))), > IFTHEN=(WHEN=INIT, > BUILD=(1,4,key_start,16,C'40',hex_data,JFY=(SHIFT=LEFT))), > IFTHEN=(WHEN=INIT, > FINDREP=(IN=(C' '),OUT=C'')), > IFTHEN=(WHEN=INIT, > BUILD=(1,4,5,TRAN=UNHEX)) > OUTFIL FNAMES=DISCARD,SAVE > OPTION COPY > /* > //SYMNAMES DD * > max_lrecl,16367 * INT((32756-4-18)/2) > hex_data,5,32734 * 2*max_lrecl > key_start,32723 * hex_data-16+5 > /* > > Norbert Friemel > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
