Excellent solution! 
Just tried it using original data supplied.
I will save this example should I ever get such an unusual format of input 
data.
Almost unchanged after JCL snippet Cut&Paste...
//*====================================================================
//S010     EXEC PGM=IDCAMS 
//SYSPRINT DD SYSOUT=* 
//I        DD * 
RECORD01X11AAAAAAAA 
RECORD02Y2BBBBBBBB 
RECORD03ZCCCCCCC 
RECORD044A4444444DDDDDDDD 
RECORD0555B55555555EEEEEEEE 
//O        DD DISP=(,PASS),UNIT=VIO,LRECL=255,RECFM=VB 
//SYSIN    DD  * 
  REPRO IFILE(I) OFILE(O) 
//*====================================================================
//S020     EXEC PGM=SORT,COND=(4,LT) 
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD DISP=(OLD,PASS),DSN=*.S010.O 
//SORTOUT  DD SYSOUT=* 
//SYSIN    DD * 
  OPTION COPY,VLSHRT 
  INREC IFTHEN=(WHEN=INIT, 
        BUILD=(1,04,                      $ RDW 
               5,76,JFY=(SHIFT=RIGHT))),  $ SHIFT DATA TO RIGHT 
        IFTHEN=(WHEN=INIT, 
        BUILD=(01,04,                     $ RDW 
               73,08,                     $ LAST 8 BYTES 
               05,76,JFY=(SHIFT=LEFT)))   $ SHIFT DATA TO LEFT 
  OUTFIL VLTRIM=C' '                      $ REMOVE TRAIL SPACES 
// 

/Steve





From:   Sri h Kolusu <[email protected]>
To:     [email protected]
Date:   2015-06-08 07:44
Subject:        Re: DFSORT - How to select last 8 bytes in variable length 
records
Sent by:        IBM Mainframe Discussion List <[email protected]>



Minoru Massaki,

It is quite simple to get the last 8 bytes from a variable length file 
without an exit. You simply need to use JFY to push the contents to the 
right and then pick the last 8 bytes and then use another JFY to push the 
contents to the left and there by achieving the desired results.

I assumed that your Input VB file has an LRECL=80. You can adjust the 
length if your input file has a different length.

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD DISP=SHR,Your Input VB 80  byte file.
//SORTOUT  DD SYSOUT=*
//SYSIN    DD * 
  OPTION COPY 
  INREC IFTHEN=(WHEN=INIT, 
        BUILD=(1,04,                      $ RDW 
               5,76,JFY=(SHIFT=RIGHT))),  $ SHIFT DATA TO RIGHT 
        IFTHEN=(WHEN=INIT, 
        BUILD=(01,04,                     $ RDW 
               73,08,                     $ LAST 8 BYTES 
               05,76,JFY=(SHIFT=LEFT)))   $ SHIFT DATA TO LEFT 
 
  OUTFIL VLTRIM=C' '                      $ REMOVE TRAIL SPACES
//* 

Sri Hari Kolusu
DFSORT Development
IBM Corporation

IBM Mainframe Discussion List <[email protected]> wrote on 
06/07/2015 06:28:01 AM:

> From: Minoru Massaki <[email protected]>
> To: [email protected]
> Date: 06/07/2015 06:28 AM
> Subject: DFSORT - How to select last 8 bytes in variable length records
> Sent by: IBM Mainframe Discussion List <[email protected]>
> 
> Hello
> 
> There is a input file of variable length records.
> I want to insert the last 8 bytes of a record to front of the record as
> following sample.
> 
> Input file:
> RECORD01X11AAAAAAAA
> RECORD02Y2BBBBBBBB
> RECORD03ZCCCCCCC
> RECORD044A4444444DDDDDDDD
> RECORD0555B55555555EEEEEEEE
> 
> Output File I want to have:
> AAAAAAAA RECORD01X11AAAAAAAA
> BBBBBBBB RECORD02Y2BBBBBBBB
> ZCCCCCCC RECORD03ZCCCCCCC
> DDDDDDDD RECORD044A4444444DDDDDDDD
> EEEEEEEE RECORD0555B55555555EEEEEEEE
> 
> Record data before the last 8 bytes may contain x'00' thru x'FF',
> there is no specific delimiter character for parsing the last 8 bytes.
> The last 8 bytes is also binary.
> 
> I'd like to hear any ideas how this to be done by DFSORT WITHOUT using
> E15/E35.
> 
> Your help would be highly appreciated.
> 
> Minoru Massaki - M*M
> 
> 
> 
> 
> 
> 
> -- 
> 
> 全先 実  -  Minoru Massaki  (M*M)
> E-mail: [email protected]
> 
> ----------------------------------------------------------------------
> 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




S?vida annat inte anges ovan: / Unless stated otherwise above:
IBM Svenska AB
Organisationsnummer: 556026-6883
Adress: 164 92 Stockholm

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to