IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Validating record count of a file is correct or not


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 148
Location: India

PostPosted: Fri Oct 27, 2023 8:15 am
Reply with quote

Hi Team,

I have a file lets say file1 which contains n numbers of records, and the bottom record of file contains the record count of file, but sometime the record count i get is wrong with actual record count.

File1: Record length 2003

Code:
101868 995256957531372   2182326852         
101869 995257085341872   2186966060         
101870 995260945361472   2185220065         
101871 TRAILER2024-07-24000101869


here in above file last TRAILER record contains the record count which start from 19th position here it is 00101869 but sometime this record count is not true I want to do validation of this scenario here and check the whether the actual record count is matching with the trailer record count mentioned in file1.

What i have done tried:

i extracted the actual record count of the file in a ps data set by removing header and trailer record. ps data set looks like below.

Below Ps file contains actual record count having LRCL 2003

Code:
 Command ===>     
 ****** **********
 000001 00101869 
 ****** **********


Now I want to see whether the count in above file is matching with record count in TRAILER record in file1 which start from position 19th and length we dnt know .

is it achievable through sorting here It looks simple but join keys required fixed length field to join two fields but here we don't know the length of record count in File1 we only know its starting position which is 19th in TRAILER record of the file1. Any hint or any way to do so..? depending upon the record count is correct or not i need to take decisions further in my job(JCL)
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1337
Location: Bamberg, Germany

PostPosted: Fri Oct 27, 2023 9:18 am
Reply with quote

Use INREC OVERLAY SEQNUM, and OUTFIL INCLUDE for the modified Trailer record.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Fri Oct 27, 2023 10:37 am
Reply with quote

All you needed to do is use search button..
ibmmainframes.com/about57751.html
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1337
Location: Bamberg, Germany

PostPosted: Fri Oct 27, 2023 11:33 am
Reply with quote

See also IFTRAIL for updating the count in a Trailer.
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 148
Location: India

PostPosted: Fri Oct 27, 2023 3:49 pm
Reply with quote

Hi I am using below sort card

file having lrcl 2003.
Code:

101868 995256957531372   2182326852         
101869 995257085341872   2186966060         
101870 995260945361472   2185220065         
101871 TRAILER2024-07-24000101869


record count stat from 19th position in trailer record.

my sort card

Code:
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(2004:SEQNUM,8,ZD)),     
        IFTHEN=(WHEN=(1,1,CH,EQ,C'T')                       
           OVERLAY=(2004:2004,8,ZD,SUB,+2,EDIT=(TTTTTTTT)))
   OUTFIL INCLUDE=(1,1,CH,EQ,C'T',AND,19,8,ZD,EQ,2004,8,ZD)
/*                                                         
*******************
********* Bottom of Data ****************


i am getting below error:

Code:
SYNCSORT FOR Z/OS  3.1.4.0R    U.S. PATENTS: 4210961, 5117495   (C
                                                       z/OS   2.4.0
 SYNCSORT LICENSED FOR CPU SERIAL NUMBER 03CD7, MODEL 8561 605     
 SYSIN :                                                           
   SORT FIELDS=COPY                                               
   INREC IFTHEN=(WHEN=INIT,OVERLAY=(2004:SEQNUM,8,ZD)),           
         IFTHEN=(WHEN=(1,1,CH,EQ,C'T')                             
                                      *                           
            OVERLAY=(2004:2004,8,ZD,SUB,+2,EDIT=(TTTTTTTT)))       
            *                                                     
    OUTFIL INCLUDE=(1,1,CH,EQ,C'T',AND,19,8,ZD,EQ,2004,8,ZD)       
 WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED   
 WER268A  INREC STATEMENT   : SYNTAX ERROR                         
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                   
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                     
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                     
 *********************
*********** END OF DATA *********************

I know it is something related to my include statement i have trailer record which start from T that is what i am looking for not sure where i am missing the things here. any hepl here i tried many times and then i posted here.

i have another way of solving this but this is one step solution thats why curios for this way.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1337
Location: Bamberg, Germany

PostPosted: Fri Oct 27, 2023 4:33 pm
Reply with quote

* - marks the missing comma
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Fri Oct 27, 2023 4:48 pm
Reply with quote

That’s right and if you see carefully my links it’s the same solution and has a comma in it ..
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 148
Location: India

PostPosted: Mon Nov 06, 2023 5:43 pm
Reply with quote

Thanks everyone, I missed the, now it is working fine. I have one small question here. If we have multiple files to validate for the record count, is it possible to achieve it on one single step...?

Using multiple steps, we can do that but looking for a single step to validate any hint appreciated here.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1337
Location: Bamberg, Germany

PostPosted: Mon Nov 06, 2023 5:59 pm
Reply with quote

You can only use a procedure in this case. Forget the single step myth for now.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Mon Nov 06, 2023 11:27 pm
Reply with quote

How many datasets are we talking about ? Is it the same record layout ? If you would want to do one size fits all then follow Joerg’s suggestion to use proc and repeat as needed by overriding the datasets each time .
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2143
Location: USA

PostPosted: Tue Nov 07, 2023 2:47 am
Reply with quote

Digvijay Singh wrote:
Thanks everyone, I missed the, now it is working fine. I have one small question here. If we have multiple files to validate for the record count, is it possible to achieve it on one single step...?

Using multiple steps, we can do that but looking for a single step to validate any hint appreciated here.

Try to concatenate all datasets under one //SORTIN DD, and then process them as GROUPS of a single dataset.
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 148
Location: India

PostPosted: Tue Nov 07, 2023 6:52 pm
Reply with quote

sergeyken wrote:
Digvijay Singh wrote:
Thanks everyone, I missed the, now it is working fine. I have one small question here. If we have multiple files to validate for the record count, is it possible to achieve it on one single step...?

Using multiple steps, we can do that but looking for a single step to validate any hint appreciated here.

Try to concatenate all datasets under one //SORTIN DD, and then process them as GROUPS of a single dataset.



I have prepared a sort card and I am just using that sort of card in all the steps.
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 148
Location: India

PostPosted: Tue Nov 07, 2023 6:59 pm
Reply with quote

while working on requirement i came across we receive data set sometimes where we don't have any TRAILER string at the end of the file, still we need to validate the record count.

input file looks like below:
record lenght is 150.

Code:
 007083 5405247141681072       M96672024-04-01DSLN+0000
 007084 5153552558204006       M96692024-04-01DSLN+0000
 007085 90008547482024-04-01000007083                 
 ****** **************************** Bottom of Data ***


7083 is the record count and now i need to validate the record count here.

It just now i am trying to identify the last record but not able to because there is no specific string in last record to identify it. Could you give any hint here. do i need to add a string here at last record to achive this..?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2143
Location: USA

PostPosted: Tue Nov 07, 2023 8:57 pm
Reply with quote

Code:
//*===================================================================
//SORTGRPN EXEC PGM=SORT                                             
//*                                                                   
//SYSOUT   DD  SYSOUT=*                                               
//*                                                                   
//SORTIN   DD  *                                                     
 995256957531372   2182326852                                         
 995257085341872   2186966060                                         
 995260945361472   2185220065                                         
 TRAILER2024-07-24000000003                                           
//*-+----1----+----2----+----3----+----4----+----5----+----6----+----7
//         DD  *                                                     
 885256957531372   2182326852                                         
 885257085341872   2186966060                                         
 885260945361472   2185220065                                         
 885260955361472   2185220066                                         
 TRAILER2024-08-24000000003                                           
//*-+----1----+----2----+----3----+----4----+----5----+----6----+----7
//         DD  *                                                     
 885256957531372   2182326852                                         
 885257085341872   2186966060                                         
 885260945361472   2185220065                                         
 885260955361472   2185220066                                         
 TRAILER2024-09-24000000004                                           
//*-+----1----+----2----+----3----+----4----+----5----+----6----+----7
//         DD  *                                                     
 885256957531372   2182326852                                         
 885257085341872   2186966060                                         
 885260945361472   2185220065                                         
 885260955361472   2185220066                                         
 TRAILER2024-09-240000XXX04                                           
//*-+----1----+----2----+----3----+----4----+----5----+----6----+----7
//         DD  *                                                     
 5405247141681072       M96672024-04-01DSLN+0000                     
 5153552558204006       M96692024-04-01DSLN+0000                     
90008547482024-04-01000000002                                         
//*-+----1----+----2----+----3----+----4----+----5----+----6----+----7
//*                                                                   
//SORTOUT  DD  SYSOUT=*                                               
//*...................................................................
//SYSIN    DD  *                                                     
 INREC IFTHEN=(WHEN=GROUP,                                           
               END=(1,20,SS,EQ,C'-'),                                 
               PUSH=(51:ID=8,SEQ=8)),                                 
       IFTHEN=(WHEN=(1,20,SS,EQ,C'-'),                               
               PARSE=(%=(ENDAT=C'-'),                                 
                      %=(ENDAT=C'-'),                                 
                      %1=(ADDPOS=2,                                   
                          ENDBEFR=BLANKS,                             
                          FIXLEN=9)),                                 
               OVERLAY=(59:59,8,ZD,SUB,+1,EDIT=(TTTTTTTT),             
                        67:%1,JFY=(SHIFT=RIGHT)))                     
 SORT FIELDS=COPY                                                     
 OUTFIL INCLUDE=(1,20,SS,EQ,C'-',                                     
            AND,(67,9,ZD,NE,NUM,                                       
              OR,67,9,ZD,NE,59,8,ZD)),                                 
        REMOVECC,                                                     
        HEADER1=(C'*** LIST OF DATASETS IN ERROR ***',/),             
        IFTHEN=(WHEN=(67,9,ZD,NE,NUM),                                 
                BUILD=(C'DATASET NO.: ',51,8,                         
                       3X,C'TRAILER COUNT INVALID - ',                 
                       3X,C'NO. OF RECORDS: ',59,8,                   
                       3X,C'TRAILER COUNTER: ',67,9)),                 
        IFTHEN=(WHEN=NONE,                                             
                BUILD=(C'DATASET NO.: ',51,8,                         
                       3X,C'COUNTERS MISMATCH -     ',                 
                       3X,C'NO. OF RECORDS: ',59,8,                   
                       3X,C'TRAILER COUNTER: ',67,9)),                 
        TRAILER1=(/,C'*** TOTAL REJECTED DATASETS: ',COUNT=(M0))       
 END                                                                   
//*....................................................................


Code:
********************************* TOP OF DATA **************************************************************
*** LIST OF DATASETS IN ERROR ***                                                                           
                                                                                                           
DATASET NO.: 00000002   COUNTERS MISMATCH -        NO. OF RECORDS: 00000004   TRAILER COUNTER: 000000003   
DATASET NO.: 00000004   TRAILER COUNT INVALID -    NO. OF RECORDS: 00000004   TRAILER COUNTER: 0000XXX04   
                                                                                                           
*** TOTAL REJECTED DATASETS:               2                                                               
******************************** BOTTOM OF DATA ************************************************************

Fields positions are used for demo purposes only.
For the real production datasets all of them need to be adjusted accordingly.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Unable to interpret a hex value to De... COBOL Programming 7
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts how to complete the end of a record w... DFSORT/ICETOOL 2
Search our Forums:

Back to Top