Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Comparing record counts in a file with trailer record count

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
raam_kumar

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Wed Jun 04, 2008 12:53 pm    Post subject: Comparing record counts in a file with trailer record count
Reply with quote

Hi

I have a file of FB80, which will contain 3 different type of records. sampe of file is given below

HEADER
DATA
DATA
DATA
DATA
TRAILER00401012008

the requirement is i have to count the No. of data records and match it with the count in the trailer record, if they are not equal, i have to force a different return code. for Eg. in above sample there are 4 data records and in trailer also there value is 4 (positoin 8 - 11).
Back to top
View user's profile Send private message

raam_kumar

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Wed Jun 04, 2008 6:01 pm    Post subject:
Reply with quote

hi

After this post, i have tried myself and found a way to do this. just thought of sharing this with you all. But i am sure that this is a round about way for this requirement. there should be some easy way for this requirement.

Code:

//ICETOOL  EXEC PGM=ICETOOL                         
//TOOLMSG  DD SYSOUT=*                             
//DFSMSG   DD SYSOUT=*                             
//TEMP     DD DSN=&&TEMPDSN,                       
//            DISP=(,PASS),                     
//            SPACE=(TRK,(5,5))                     
//TEMP1    DD DSN=&&TEMP1DSN,                       
//            DISP=(,PASS),                     
//            SPACE=(TRK,(5,5))                     
//OUT2     DD SYSOUT=*                             
//TEMP2    DD DSN=&&TEMP2DSN,                       
//            DISP=(MOD,PASS),                     
//            SPACE=(TRK,(5,5))                     
//OUT      DD DSN=&&OUTDSN,                         
//            DISP=(,PASS),                     
//            SPACE=(TRK,(5,5))                     
//OUT1     DD DSN=&&OUT1DSN,                       
//            DISP=(MOD,PASS),                     
//            SPACE=(TRK,(5,5))                     
//INPUT    DD DISP=SHR,DSN=<DATASET NAME>                     
//TOOLIN   DD *                                               
  COPY FROM(INPUT) TO(TEMP)  USING(CTL1)                     
  COPY FROM(INPUT) TO(TEMP1) USING(CTL2)                     
  COPY FROM(TEMP)  TO(TEMP2) USING(CTL3)                     
  COPY FROM(TEMP1) TO(TEMP2) USING(CTL4)                     
  SPLICE FROM(TEMP2) TO(OUT) ON(22,8,ZD) WITH(9,8) USING(CTL5)
  COPY FROM(OUT) TO(OUT1) USING(CTL6)                         
  COUNT FROM(OUT1) EMPTY RC4           
/*                       
//CTL1CNTL DD *
  OMIT COND=(1,3,CH,EQ,C'XXX')                               
  OUTFIL REMOVECC,NODETAIL,                                   
    TRAILER1=(COUNT=(M11,LENGTH=8))                             
/*                                                           
//CTL2CNTL DD *                                               
  OUTFIL FNAMES=TEMP1
  INCLUDE COND=(1,3,CH,EQ,C'XXX')                           
  OUTREC BUILD=(1:4,2,ZD,EDIT=(TTTTTTTT),392X)   
/*                                               
//CTL3CNTL DD *                                 
  OUTREC FIELDS=(1:1,8,22:SEQNUM,8,ZD)           
/*                                               
//CTL4CNTL DD *                                 
  OUTREC FIELDS=(9:1,8,22:SEQNUM,8,ZD)           
/*                                               
//CTL5CNTL DD *                                 
  OUTFIL FNAMES=OUT,OUTREC=(1,16)               
/*                                               
//CTL6CNTL DD *                                 
  INCLUDE COND=(1,8,ZD,EQ,9,8,ZD)               
/*
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10374
Location: italy

PostPosted: Wed Jun 04, 2008 6:13 pm    Post subject: Reply to: Comparing record counts in a file with trailer rec
Reply with quote

Just curious... after having determined that the count is wrong,
is somebody going to fix the program/application which generates the erroneous input dataset icon_cool.gif icon_question.gif
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jun 04, 2008 6:18 pm    Post subject:
Reply with quote

Either everything will stop until the PROCESS AUDIT COMMITTEE meets and decides what to do or someone will edit the file and change the count then rerun the job.
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 04, 2008 6:19 pm    Post subject:
Reply with quote

Can you give a sample of the actual file you used to test your code? This will help us to understand your code better and try other options.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 04, 2008 9:47 pm    Post subject: Reply to: Comparing record counts in a file with trailer rec
Reply with quote

raam_kuamr,

The following DFSORT JCL will give you the desired results.

If the counts on the trailer match to the detail records then the return code is zero. or else the return code is 4



Code:

//STEP0100 EXEC PGM=ICEMAN                             
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
HEADER                                                 
DATA                                                   
DATA                                                   
DATA                                                   
DATA                                                   
DATA                                                   
TRAILER000401012008                                     
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,4,ZD)),   
         IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),           
        OVERLAY=(81:+2,SUB,81,4,ZD,M11,LENGTH=4))       
                                                       
  OUTFIL NULLOFL=RC4,                                   
  INCLUDE=(1,7,CH,EQ,C'TRAILER',AND,08,4,ZD,EQ,81,4,ZD)
/*                                                     


Hope this helps...
Back to top
View user's profile Send private message
raam_kumar

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Thu Jun 05, 2008 11:10 am    Post subject:
Reply with quote

Hi Skolusu

i have tried this jcl, but it has given me RC=0. i have used the same jcl and the data which you have used. as per the input i have to get RC=4. i have posted the sysout messages below.

SYSIN :
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,4,ZD)),
IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),
OVERLAY=(81:+2,SUB,81,4,ZD,M11,LENGTH=4))

OUTFIL NULLOFL=RC4,
INCLUDE=(1,7,CH,EQ,C'TRAILER',AND,08,4,ZD,EQ,81,4,ZD)
WER276B SYSDIAG= 4059, 3891646, 3891646, 4608258
WER164B 8,944K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 3,125,192 BYTES USED
WER146B 20K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER237I OUTREC RECORD LENGTH = 84
WER110I SORTOUT : RECFM=FB ; LRECL= 84; BLKSIZE= 84
WER405I SORTOUT : DATA RECORDS OUT 0; TOTAL RECORDS OUT 0
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER416B BSAM WAS USED FOR SORTIN
WER416B OUTFIL WAS USED FOR SORTOUT
WER054I RCD IN 7, OUT 7

can you please help me.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Jun 05, 2008 11:16 am    Post subject:
Reply with quote

Hi Raam,

WER messages are not part of DFSORT, they are part of SYNCSORT the opposition.


Gerry
Back to top
View user's profile Send private message
raam_kumar

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Thu Jun 05, 2008 11:19 am    Post subject:
Reply with quote

Hi enrico sorichetti

Here is the real situation. There is a job which runs for nearly an hour daily. the input file will contain more than 45 lakh records. if in case the job abends, (let us assume it has abended in record 123456) people will take a backup of input file, delete the contents from record 2 to 123456 and then rerun the job. few are forgetting one important thing, that accordingly they have to change the record count in trailer record.

The program is coded in such a way that, after all processing gets complete and when it reaches the trailer record, it checks for record count and if there is a mismatch, it forces an abend again.

we are trying to introduce this sort step, prior of the execution of program, so that this can be prevented, and if in case they miss to update the trailer record, it can be found immediately.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10374
Location: italy

PostPosted: Thu Jun 05, 2008 11:26 am    Post subject: Reply to: Comparing record counts in a file with trailer rec
Reply with quote

The process is flawed, anyway that' s Your shop, not mine

for what reason when recreating the input file they just don' t write
the copy with the proper parameters to provide a good trailing count...

You are using syncsort to check, why not use it to build the proper input to start with???

the procedure is prone to errors anyway, it relies on people skipping the right number of records

and furthermore for what reason the procedure keep abending,
wouldn' t it be more productive to setup the proper validation procedures to fix things before they happen ??

it' s always a bad practice to have operations fiddle around with application data
looks like there is a zero security approach there
Back to top
View user's profile Send private message
raam_kumar

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Thu Jun 05, 2008 11:39 am    Post subject:
Reply with quote

Hi

Is there any other way to achieve it?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10374
Location: italy

PostPosted: Thu Jun 05, 2008 11:51 am    Post subject: Reply to: Comparing record counts in a file with trailer rec
Reply with quote

I stand by my previous suggestion
generate the file with the proper data
search the forum with
Quote:
syncsort trailer record count

or
Quote:
sort trailer record count

and You will find a few samples on how to do it
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts ISMF Difference between volume count ... upendrasri IBM Tools 2 Tue Dec 05, 2017 12:40 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us