|
View previous topic :: View next topic
|
| Author |
Message |
raam_kumar
New User
Joined: 25 Apr 2007 Posts: 44 Location: chennai, India
|
|
|
|
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 |
|
 |
raam_kumar
New User
Joined: 25 Apr 2007 Posts: 44 Location: chennai, India
|
|
|
|
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 |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10899 Location: italy
|
|
|
|
Just curious... after having determined that the count is wrong,
is somebody going to fix the program/application which generates the erroneous input dataset  |
|
| Back to top |
|
 |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
| 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 |
|
 |
Manuneedhi K
Active User

Joined: 07 May 2008 Posts: 115 Location: Chennai
|
|
|
|
| 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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
raam_kumar
New User
Joined: 25 Apr 2007 Posts: 44 Location: chennai, India
|
|
|
|
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 |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Raam,
WER messages are not part of DFSORT, they are part of SYNCSORT the opposition.
Gerry |
|
| Back to top |
|
 |
raam_kumar
New User
Joined: 25 Apr 2007 Posts: 44 Location: chennai, India
|
|
|
|
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 |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10899 Location: italy
|
|
|
|
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 |
|
 |
raam_kumar
New User
Joined: 25 Apr 2007 Posts: 44 Location: chennai, India
|
|
|
|
Hi
Is there any other way to achieve it? |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10899 Location: italy
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|