View previous topic :: View next topic
|
Author |
Message |
sudhamani
New User
Joined: 08 Nov 2007 Posts: 19 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 |
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 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: 19 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: 1512 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: 183 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 |
|
 |
sudhamani
New User
Joined: 08 Nov 2007 Posts: 19 Location: india
|
|
|
|
hi Krishy ,
could you please explain the above code.as my header format is H200804071058.
thanks |
|
Back to top |
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
Please proivde the sample input of the records and the expected output.
Thanks
Krishy |
|
Back to top |
|
 |
sudhamani
New User
Joined: 08 Nov 2007 Posts: 19 Location: india
|
|
|
|
hi
below are the sample example for the input file
H200711051317
T20080107105000000000000000
H200805051115
MCD200804210011939 00000000010
D00000000000000000000000006490
........
.......
.......
we can see 2 headers H200711051317 and H200805051115 here
I want to check if record type with 'H' are 2 then set some return code.
thanks |
|
Back to top |
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
sudhamani,
Please check the below code.
Code: |
//S1 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN0 DD *
H200711051317
T20080107105000000000000000
MCD200804210011939 00000000010
H200711051317
D00000000000000000000000006490
//IN1 DD DSN=xxxx.T3,UNIT=SPK,SPACE=(CYL,(6,6)),
// DISP=(NEW,CATLG,DELETE),DCB=(RECFM=FBA,LRECL=80)
//OUT DD DSN=xxxxx.T4,UNIT=SPK,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,1,CH) ON(VALCNT,U04)
SORT FROM(OUT) TO(IN1) USING(CTL1)
/*
//CTL0CNTL DD *
OPTION COPY
INCLUDE COND=(1,1,CH,EQ,C'H')
//CTL1CNTL DD *
OPTION NULLOUT=RC16
SORT FIELDS=COPY
INCLUDE COND=(10,1,CH,NE,C'2')
|
Thanks
Krishy |
|
Back to top |
|
 |
krisprems
Active Member

Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
the below solution is using SYNCSORT,
Code: |
//*******************************************************
//S1 EXEC PGM=ICEMAN
//SORTIN DD *
H200804071058
DETAIL RECORDS...................
TRILER RECORDS....................
H200804071058
DETAIL.......
TRILER RECORDS....................
/*
//HEAD DD DUMMY
//TAIL DD DUMMY
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(1,1,SS,EQ,C'H,T')
INREC OVERLAY=(2:C'1')
SORT FIELDS=(1,1,CH,A)
SUM FIELDS=(2,1,ZD)
OUTFIL FNAMES=HEAD,NULLOFL=RC4,
INCLUDE=(1,1,CH,EQ,C'H',&,2,1,ZD,EQ,1)
OUTFIL FNAMES=TAIL,NULLOFL=RC4,
INCLUDE=(1,1,CH,EQ,C'T',&,2,1,ZD,EQ,1) |
|
|
Back to top |
|
 |
sudhamani
New User
Joined: 08 Nov 2007 Posts: 19 Location: india
|
|
|
|
hi
thank you
this functionality is working but small confusion with code.
colud you please explain the below 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'))
thanks |
|
Back to top |
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
sudhamani,
1)The fisrt SORT card with CTL0CNTL will check and place all the HEADER and TRAILER records.
2)The OCCURS will place the count of HEADER And Trailer records.
3)The 3 rd SORT card will check for the count of header and trailer and gives return code depending on the count.
But,krisprems soultion is better and efficient as it is having less passes of data than what I have shown.
Thanks
Krishy |
|
Back to top |
|
 |
sudhamani
New User
Joined: 08 Nov 2007 Posts: 19 Location: india
|
|
|
|
hi,
could you please breifly go through CTL1CNTL SORT and condition of checking with notequal to.
because i am facing difficulty with checking for 3 or more than 3 headers from the input file .
Thanks for your help. |
|
Back to top |
|
 |
|
|