MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

compare record count with the count given in trailer record

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Thu Sep 07, 2006 8:22 pm    Post subject: compare record count with the count given in trailer record Reply with quote

I have a requirement as below:

a file will have records and trailer record will have the number records. I need to check whether the record count given in the trailer record is equal to the exact count of records. This is to check whether we have received all the records.

Can ll this be done in a single sort step?
I can use DF-sort in my shop.
_________________
Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Sep 08, 2006 8:31 am    Post subject: Reply with quote

Quote:

a file will have records and trailer record will have the number records. I need to check whether the record count given in the trailer record is equal to the exact count of records. This is to check whether we have received all the records.


Sarangadhar,

You need to provide more details. you have been a member on this site for almost 2 years and yet you don't follow the rules. Post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.

Provide answers for the following questions

1. What do you want to do if the record counts don't match?
2. How do you identify the trailer record?
3. what is the position and format of the count field?
4. Does the trialer count consider the header & trailer as part of the record count or is it considering only the detail records?
5. What is the LRECL and RECFM of the input dataset?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Thu Sep 21, 2006 6:59 pm    Post subject: Reply with quote

Sorry Kolusu, i was not having complete requirements then. find the details here.

HEADERXXXXXXXXxXXXXX...........
11111111111111111111...........
22222222222222222222...........
33333333333333333333...........
44444444444444444444...........
55555555555555555555...........
990000005XXXXXXXXXXX...........


trailer record is identified by word 'TRAILER', and 7 positions after the word TRAILER

contains the given count with ZD format. need to compare the record count in the file except header and

trailer and return the code 0 if match and non-zero if no match.

Since there is nothing to do with the whole record. I guess using INREC we can only read the portion of the record.

LRECL 1000000
RECFM FB
_________________
Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Sep 21, 2006 8:39 pm    Post subject: Reply with quote

Sarangdhar,

Try this job. This job will return a return-code of 4 since the trailer record has 7 where as the total no: of records excluding the header and trailer are 6. The job will return a zero return-code if the count on trailer record is 6.

Code:

//STEP0100 EXEC PGM=SORT,PARM='NULLOUT=RC4'       
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD *                                   
HEADERXXXXXXXXXXXXXX...........                   
11111111111111111111...........                   
22222222222222222222...........                   
33333333333333333333...........                   
44444444444444444444...........                   
55555555555555555555...........                   
990000005XXXXXXXXXXX...........                   
TRAILER0000007XXXXXX...........                   
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                   
  SORT FIELDS=COPY                 
  INREC FIELDS=(01,14,X,SEQNUM,8,ZD)             
  OUTREC FIELDS=(01,15,16,8,ZD,SUB,+2,ZD,LENGTH=8)
  OUTFIL INCLUDE=(01,07,CH,EQ,C'TRAILER',AND,     
                  08,07,ZD,EQ,16,8,ZD)           
/*                                           


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Sep 22, 2006 10:43 am    Post subject: Reply with quote

Kolusu's job will NOT work with DFSORT.

Syncsort treats a SORTOUT DD connected to an OUTFIL statement as a SORTOUT data set, so NULLOUT applies to it. FNAMES=SORTOUT is treated differently than FNAMES=OUT1.

DFSORT treats a SORTOUT DD connected to an OUTFIL statement as an OUTFIL data set, so NULLOFL applies to it rather than NULLOUT. FNAMES=SORTOUT is treated the same as FNAMES=OUT1 which we feel is the more consistent approach.

For z/OS DFSORT V1R5, the equivalent to Kolusu's job would be:

Code:

//STEP0100 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD *                                   
HEADERXXXXXXXXXXXXXX...........                   
11111111111111111111...........                   
22222222222222222222...........                   
33333333333333333333...........                   
44444444444444444444...........                   
55555555555555555555...........                   
990000005XXXXXXXXXXX...........                   
TRAILER0000007XXXXXX...........                   
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                   
  SORT FIELDS=COPY                 
  INREC FIELDS=(01,14,X,SEQNUM,8,ZD)             
  OUTREC FIELDS=(01,15,16,8,ZD,SUB,+2,ZD,LENGTH=8)
  OUTFIL NULLOFL=RC4,
      INCLUDE=(01,07,CH,EQ,C'TRAILER',AND,     
                  08,07,ZD,EQ,16,8,ZD)           
/*   


I don't know whether or not that works with Syncsort.

NULLOUT and NULLOFL are available with z/OS DFSORT V1R5, but not with DFSORT R14. The following DFSORT/ICETOOL job will work with both releases. If you want RC=12 instead of RC=4, just remove the RC4 parameter.

Code:

//STEP0200 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN   DD *
HEADERXXXXXXXXXXXXXX...........
11111111111111111111...........
22222222222222222222...........
33333333333333333333...........
44444444444444444444...........
55555555555555555555...........
XXXXXXXXXXXXXXXXXXXX...........
XXXXXXXXXXXXXXXXXXXX...........
990000005XXXXXXXXXXX...........
TRAILER0000007XXXXXX...........
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TOOLIN   DD *
COPY FROM(IN) USING(CTL1)
COUNT FROM(T1) USING(CTL2) EMPTY RC4
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
    TRAILER1=(1:8,7,8:COUNT-2=(M11,LENGTH=7))
/*
//CTL2CNTL DD *
  INCLUDE COND=(1,7,ZD,EQ,8,7,ZD)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Fri Sep 22, 2006 3:53 pm    Post subject: Reply with quote

Thanks Kolusu n Frank.

Frank:
Both of your sorts are working..

my observation from 2nd type:
i think this is not identifying the trailer record by word "TRAILER"; instead looking for the count at the last record (with the given column position). Of course since the trailer record is always last record, it works.

Which is the less time consuming mechanism? Since the first sort type needs to add sequence number for every record, this may take more time comparatively. Also 2nd one is not looking for filtering, just traversing till the end and comparing the record count with the count given at last record. Are my assumptions correct?
_________________
Thanks
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Sep 22, 2006 5:09 pm    Post subject: Reply with quote

Quote:
think this is not identifying the trailer record by word "TRAILER"; instead looking for the count at the last record (with the given column position). Of course since the trailer record is always last record, it works.


Yes, you're right that my job expects the trailer record to be the last record rather than looking for 'TRAILER'. If you want a DFSORT job that looks for 'TRAILER', you can use this version:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT  DD SYSOUT=*
//SORTIN   DD *
HEADERXXXXXXXXXXXXXX...........
11111111111111111111...........
22222222222222222222...........
33333333333333333333...........
44444444444444444444...........
55555555555555555555...........
XXXXXXXXXXXXXXXXXXXX...........
XXXXXXXXXXXXXXXXXXXX...........
990000005XXXXXXXXXXX...........
TRAILER0000007XXXXXX...........
/*
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TR DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD *
  OPTION COPY
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    OUTREC=(80X),
    TRAILER1=('MYCT,+',COUNT-2=(M11,LENGTH=7))
  OUTFIL FNAMES=TR,
    INCLUDE=(1,7,CH,EQ,C'TRAILER'),
    OUTREC=(1:8,7)
/*
//S2    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//IN DD DSN=&&T1,DISP=(OLD,PASS)
//TOOLIN DD *
COUNT FROM(IN) USING(CTL1) EMPTY RC4
/*
//CTL1CNTL DD *
  INCLUDE COND=(1,7,ZD,EQ,MYCT)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Sep 22, 2006 5:12 pm    Post subject: Reply with quote

Quote:
Which is the less time consuming mechanism?


Well, when anyone asks about "time", I always try it out to see. So I ran Kolusu's job and my two jobs with a million 80 byte records as input and the last record as the trailer record. Kolusu's job took 0.63 CPU sec, my first job took 0.17 CPU sec and my second job took 0.19 CPU sec. YMMV.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
spalanis
Beginner


Joined: 19 Jul 2006
Posts: 32
Topics: 15

PostPosted: Thu Dec 14, 2006 11:45 am    Post subject: Reply with quote

Hi Frank,

I am going through the above solution given by you. I am not understanding the following parameters. Could you please explain what the following parameters means?.

REMOVECC
NODETAIL
M11

Thanks.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Dec 14, 2006 11:57 am    Post subject: Reply with quote

REMOVECC - tells DFSORT to remove the ANSI carriage control character from each output record and set the RECFM to FB or VB. Without REMOVECC, each record starts with a carriage control character (e.g. '1' for page eject) and the RECFM is set to FBA or VBA.

NODETAIL - tells DFSORT to suppress the detail records (so only the trailer1 record will appear in the output data set). Without NODETAIL, each detail record will appear in the output data set.

M11 - this is an edit mask that converts the input value to a numeric output value with leading zeros (digits '0'-'9'). For example '0000325'.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
spalanis
Beginner


Joined: 19 Jul 2006
Posts: 32
Topics: 15

PostPosted: Fri Dec 15, 2006 2:05 pm    Post subject: Reply with quote

Frank,

Thanks a lot...Happy to have mentors like you and Kolusu not only when we face issues but also for learning new stuffs. Thanks again.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group