Many thanks once more Sri for your generous help. UFF was indeed the key factor.
For the archives, one small correction: INCLUDE=(16,4,CH,EQ,X'0999',AND, $ TRL RECORD Should be: INCLUDE=(16,4,CH,EQ,C'0999',AND, $ TRL RECORD (C'0999" for the trailer, not X'0999'). Peter -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Sri h Kolusu Sent: Tuesday, June 28, 2016 4:35 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Verify record cound against the file trailer [by SORT?] Peter, It is quite simple to verify the variable length. You just need to use UFF ( Unsigned free format ) instead of ZD which will automatically format the variable value by ignoring any thing other than a numeric and pad it with zeros. Example : //SYSIN DD * OPTION COPY INREC IFTHEN=(WHEN=INIT, BUILD=(1,4, $ RDW SEQNUM,11,ZD, $ RECORD NUMBER 005,15)), $ INDICATOR+COUNT IFTHEN=(WHEN=(16,4,CH,EQ,C'0999'), $ IF TRL RECORD OVERLAY=(5:5,11,ZD,SUB,+2,M11,LENGTH=11)) $ SUBTRACT 2 OUTFIL FNAMES=SORTOUT,NULLOFL=RC4, INCLUDE=(16,4,CH,EQ,X'0999',AND, $ TRL RECORD (05,11,UFF,EQ,20,11,UFF)) $ IS COUNT=TRL COUNT? //* Thanks, Kolusu DFSORT Development IBM Corporation From: "Farley, Peter x23353" <peter.far...@broadridge.com> To: IBM-MAIN@LISTSERV.UA.EDU Date: 06/28/2016 01:00 PM Subject: Re: Verify record cound against the file trailer [by SORT?] Sent by: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> Thanks again Sri, your new version also worked as long as I changed the OUTFIL DD name. Another colleague came to me with this one today. How could we handle variable-length count data in a trailer? For example (RECFM=VB file): 0000,This is a header 0100,data record 1 0100,data record 2 Etc. 0100,data record 21 0999,21 The last record is a trailer with variable-length data record count. Maximum count field length is 11. TIA for any suggestions you can offer. Peter -- This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN