| Author |
Message |
sudhamani
New User
Joined: 08 Nov 2007 Posts: 5 Location: india
|
|
|
|
hi ,
Is there any utility that can be implemented for the below requirment.
I need to set a return code if the input dataset contains 2 headers or 2 trailers.
thanks |
|
| Back to top |
|
 |
References
|
Posted: Fri May 09, 2008 8:50 pm Post subject: Re: Set a return code if input dataset has 2 hdrs and 2 Trls |
 |
|
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 135 Location: hyderabad
|
|
|
|
sudhamani,
You can.Please post your sample input and file stats.
Thanks
Krishy |
|
| Back to top |
|
 |
sudhamani
New User
Joined: 08 Nov 2007 Posts: 5 Location: india
|
|
|
|
the input file will have two headers like
H200804071058
detail records...................
triler records....................
H200804071058
detail.......
trailerr...
if it is having two headers or two trailers we need to set return code to abend the job.
thanks |
|
| Back to top |
|
 |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 688 Location: Virginia, USA
|
|
|
|
| How are the trailers identified? What are the record lengths and format (fixed or variable)? |
|
| Back to top |
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 135 Location: hyderabad
|
|
|
|
Sudhamani,
Check the below code.
| Code: |
//S1 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN0 DD *
HEADER
ABCDEFGGGGG
DEF
TRAILER
HEADER
ABCDEFGGGGG
DEF
TRAILER
//IN1 DD DSN=XXXXXXX.T3,UNIT=SYSDK,SPACE=(CYL,(6,6)),
// DISP=(NEW,CATLG,DELETE),DCB=(RECFM=FBA,LRECL=80)
//OUT DD DSN=XXXXXXX.T4,UNIT=SYSDK,SPACE=(CYL,(6,6)),
// DISP=(NEW,CATLG,DELETE),DCB=(RECFM=FB,LRECL=80)
//TOOLIN DD *
SORT FROM(IN0) TO(IN1) USING(CTL0)
OCCUR FROM(IN1) LIST(OUT) NOHEADER BLANK -
ON(1,5,CH) ON(VALCNT,U04)
SORT FROM(OUT) TO(IN1) USING(CTL1)
/*
//CTL0CNTL DD *
OPTION COPY
INCLUDE COND=(1,6,CH,EQ,C'HEADER',OR,1,7,CH,EQ,C'TRAILER')
//CTL1CNTL DD *
OPTION NULLOUT=RC16
SORT FIELDS=COPY
INCLUDE COND=((2,5,CH,NE,C'HEADE',AND,14,1,CH,NE,C'2'),OR,
(2,5,CH,NE,C'TRAIL',AND,14,1,CH,NE,C'2'))
|
This will give you ABENDU0016 because you have 2 header and 2 trailers.
Once you remove one header and one trailer then you can see ZERO return code.
Thanks
Krishy |
|
| Back to top |
|
 |
|
|
|