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

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On 
Behalf Of Sri h Kolusu
Sent: Monday, June 27, 2016 8:16 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Verify record cound against the file trailer [by SORT?]

Peter,

Your control cards looks good. I cannot comment on syncsort's NULLOFL 
behavior. I think Alan had already pointed the obvious.  So you control 
cards should work as expected with that minor tweak.

I believe you just need to set the return code if the counts do NOT match 
and there is no point in making another copy of the dataset. So why not 
copy only the relevant portions that we need. Some thing like this 

//SYSIN    DD * 
  OPTION COPY 
  INREC IFTHEN=(WHEN=INIT, 
               BUILD=(1,4,                       $ RDW 
                      005,01,                    $ INDICATOR 
                      SEQNUM,11,ZD,              $ RECORD NUMBER 
                      145,11)),                  $ RECORD COUNT 
  IFTHEN=(WHEN=(5,1,CH,EQ,X'FF'),                $ IF TRL  RECORD 
       OVERLAY=(6:6,11,ZD,SUB,+2,M11,LENGTH=11)) $ SUBTRACT 2 
 
  OUTFIL FNAMES=SORTOUT,NULLOFL=RC4, 
  INCLUDE=(5,1,CH,EQ,X'FF',AND,                  $ TRL RECORD 
           (06,11,ZD,EQ,17,11,ZD))               $ IS COUNT=TRL COUNT? 
//*


Further if you have any questions please let me know

Thanks,
Kolusu
DFSORT Development
IBM Corporation



From:   "Farley, Peter x23353" <peter.far...@broadridge.com>
To:     IBM-MAIN@LISTSERV.UA.EDU
Date:   06/27/2016 04:03 PM
Subject:        Re: Verify record cound against the file trailer [by 
SORT?]
Sent by:        IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU>



Hi Sri,

I am a colleague of Victor's, and the initial problem was not stated quite 

correctly.  The input file is RECFM=VB, and the trailer record is 
identified by X'FF' in the first data position.  The record count to be 
checked in the trailer record is at positions 145-155 (11 digits, ZD). The 

count in the trailer record does not include either the header record 
(X'00' in the first position) nor the trailer record, so the count in the 
trailer record should be the actual record count minus 2.  The desired 
result is to check the trailer count versus the actual data record count 
and set RC=4  if they do not agree.

Unfortunately we do not actually have access to DFSORT any more, only 
Syncsort.  May I ask you to please verify for me that if we were using 
DFSORT that the control cards below would do what we wish?  If so then I 
can go to our Systems Programmers to open a ticket with Syncsort for 
assistance in verifying the operation of NULLOFL=RC4 in their product.

When I use these control cards with Syncsort, the output file is null (has 

no records) but Syncsort is not setting RC=4, so I will go to them for 
support if the control cards I am using should give RC=4.

  OPTION COPY 
* ADD SEQNUM BETWEEN RDW AND DATA. 
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:SEQNUM,11,ZD,16:5)),
* USE SEQNUM-2 TO PUT COUNT OF DATA RECORDS IN  POS 20 OF 
* LAST RECORD (IDENTIFIED BY X'FF'). 
      IFTHEN=(WHEN=(16,1,BI,EQ,X'FF'), 
         OVERLAY=(020:5,11,ZD,SUB,+2,M11,LENGTH=11)) 
  OUTFIL NULLOFL=RC4, 
  INCLUDE=(016,1,BI,EQ,X'FF',AND, 
           (160,11,ZD,EQ,20,11,ZD)), 
         BUILD=(1,4,5:5) 

Thank you for your generous and expert assistance on this forum.

Peter

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On 
Behalf Of Sri h Kolusu
Sent: Monday, June 27, 2016 3:18 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Verify record cound against the file trailer [by SORT?]

Victor Gil,

It is quite simple to verify the number of records and validate it against 


the trailer record and if the record count match the return code is 0 and 
if the count is off then the return code is set to 4.

I assumed that the trailer record is not counted as part of the record 
count. If it is indeed counted then simply remove the ",START=0" on the 
INREC statement.

Use the following JCL

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD * 
A 
B 
C 
D 
RECS=00005 
//SORTOUT  DD SYSOUT=* 
//SYSIN    DD * 
  OPTION COPY 
  INREC OVERLAY=(81:SEQNUM,5,ZD,START=0) 

  OUTFIL NULLOFL=RC4, 
  INCLUDE=(1,5,CH,EQ,C'RECS=',AND, 
           (06,5,ZD,EQ,81,5,ZD)) 
//* 

The above job will end with RC=4 as there are only 4 records but the 
trailer says 5 records.

Further if you have any questions please let me know

--

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






----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to