IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Set a return code if input dataset has 2 hdrs and 2 Trls


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sudhamani

New User


Joined: 08 Nov 2007
Posts: 19
Location: india

PostPosted: Fri May 09, 2008 8:50 pm
Reply with quote

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
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Fri May 09, 2008 8:55 pm
Reply with quote

sudhamani,
You can.Please post your sample input and file stats.

Thanks
Krishy
Back to top
View user's profile Send private message
sudhamani

New User


Joined: 08 Nov 2007
Posts: 19
Location: india

PostPosted: Fri May 09, 2008 10:13 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Fri May 09, 2008 10:23 pm
Reply with quote

How are the trailers identified? What are the record lengths and format (fixed or variable)?
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Sat May 10, 2008 12:34 am
Reply with quote

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
View user's profile Send private message
sudhamani

New User


Joined: 08 Nov 2007
Posts: 19
Location: india

PostPosted: Mon May 12, 2008 1:54 pm
Reply with quote

hi Krishy ,



could you please explain the above code.as my header format is H200804071058.


thanks
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Mon May 12, 2008 4:15 pm
Reply with quote

Please proivde the sample input of the records and the expected output.

Thanks
Krishy
Back to top
View user's profile Send private message
sudhamani

New User


Joined: 08 Nov 2007
Posts: 19
Location: india

PostPosted: Mon May 12, 2008 4:44 pm
Reply with quote

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
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Mon May 12, 2008 5:33 pm
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon May 12, 2008 6:57 pm
Reply with quote

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
View user's profile Send private message
sudhamani

New User


Joined: 08 Nov 2007
Posts: 19
Location: india

PostPosted: Thu May 15, 2008 4:42 pm
Reply with quote

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
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Thu May 15, 2008 4:53 pm
Reply with quote

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
View user's profile Send private message
sudhamani

New User


Joined: 08 Nov 2007
Posts: 19
Location: india

PostPosted: Thu May 15, 2008 5:21 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts purge jobs with return code 0 and ret... JCL & VSAM 4
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts batch SFTP job using AOPBATCH unable ... All Other Mainframe Topics 7
No new posts Concatenate 2 input datasets and give... JCL & VSAM 2
No new posts Reading Empty Dataset DFSORT/ICETOOL 5
Search our Forums:

Back to Top