Minoru Massaki,
I went ahead and assumed that you have both leading and trailing spaces. I
chose '$' and '@' as special characters to preserve the leading and
trailing spaces. The following DFSORT JCL will give you the desired
results. JFY will move the contents irrespective of what the data is. It
doesn't matter if the data is binary or character. Also I forced the
output lrecl to be (original LRECL + 8 ) using IFOUTLEN. So if you have a
different lrecl file then you may need to change that value.
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=Your Input VB 80 Byte file
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=88,
IFTHEN=(WHEN=INIT,
BUILD=(1,04, $ RDW
C'$', $ SPL CHAR
5)), $ REST OF THE DATA
IFTHEN=(WHEN=INIT,
FINDREP=(INOUT=(X'40',C'@'))), $ CHANGE ' ' TO '@'
IFTHEN=(WHEN=INIT,
OVERLAY=(05:05,77,JFY=(SHIFT=RIGHT))), $ SHIFT DATA TO RIGHT
IFTHEN=(WHEN=INIT,
BUILD=(01,04, $ RDW
74,08, $ LAST 8 BYTES
05,77,JFY=(SHIFT=LEFT))), $ SHIFT DATA TO LEFT
IFTHEN=(WHEN=INIT,
FINDREP=(IN=(C' ',C'$'),OUT=C'')), $ REMOVE SPACES AND SPL CHAR
IFTHEN=(WHEN=INIT,
FINDREP=(INOUT=(C'@',X'40'))) $ CHANGE '@' BACK TO SPACE
//*
Hope this helps...
Thanks,
Sri Hari Kolusu
DFSORT Development
IBM Corporation
IBM Mainframe Discussion List <[email protected]> wrote on
06/08/2015 01:14:33 AM:
> From: Minoru Massaki <[email protected]>
> To: [email protected]
> Date: 06/08/2015 01:14 AM
> Subject: Re: DFSORT - How to select last 8 bytes in variable length
records
> Sent by: IBM Mainframe Discussion List <[email protected]>
>
> Hello Kolusu-san,
>
> Thank you very much for giving the answer by using DFSORT.
> That is what the customer wants to.
>
> I have additional questions.
> If the 8 bytes key is binary data and some records include x'40' of the
> last byte of the key,
> (ex. if the key is binary number 64 --> x'0000000000000040')
> Does the shifting to right (JFY=(SHIFT=RIGHT)) work as I expected?
>
> In case of the last and the first byte of the records contain x'40',
> what should I modify the DFSORT control statements you gave me.
>
> I really appreciate your kind help.
>
> Minoru Massaki - (M*M)
>
>
>
>
> 2015-06-08 14:44 GMT+09:00 Sri h Kolusu <[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
> >
>
>
>
> --
>
> 全先 実 - 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