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

Validating file with multiple header/trailer


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 92

PostPosted: Thu Apr 13, 2017 1:53 am
Reply with quote

Hi All,

I have coded the below Sort step to validate file for header, trailer, and count. It is working fine for a single header and trailer.

But when there are more than 1 header and trailer in the input then it doesn't work. Meaning it doesn't throw error. Can you please advise me how to modify the below sort card to throw error for multiple header/trailer.

Specifically if I get to read the last record (which is the trailer of the concatenated files) then I can do the verification that I am currently doing on TRL. Any advise will be really appreciated. Thanks

Code:
//STEP0100 EXEC PGM=SORT,PARM='NORC16'                             
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=input.file,DISP=SHR       
//              DD DSN=input.file,DISP=SHR ** two same files as an input doesn't give error.   
//SORTOUT  DD SYSOUT=*                                             
//HDR      DD SYSOUT=*                                             
//TLR      DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(181:SEQNUM,9,ZD)),               
        IFTHEN=(WHEN=(19,6,CH,EQ,C'TRAILR'),                       
                OVERLAY=(181:181,9,ZD,SUB,+2,M11,LENGTH=9))         
  OUTFIL FNAMES=HDR,INCLUDE=(19,6,CH,EQ,C'HEADER'),NULLOFL=RC16     
  OUTFIL FNAMES=TLR,INCLUDE=(19,6,CH,EQ,C'TRAILR',                 
                            AND,25,9,CH,EQ,181,9,CH),               
                    NULLOFL=RC16                                   
//*   
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 13, 2017 2:23 am
Reply with quote

Quote:
Can you please advise me how to modify the below sort card to throw error for multiple header/trailer.
This cannot be done, period. Mainframe systems do NOT "throw error" -- they may ABEND, they may have a non-zero step return code, they may have a user error, but they are not "throwing errors". Since the code NEVER will throw an error, we cannot tell you how to do it.

This is supposedly a forum for mainframe expert users -- you should KNOW by now what the terminology is and use it. If you want to throw errors, go work on a Unix or Windows machine.
Back to top
View user's profile Send private message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 92

PostPosted: Thu Apr 13, 2017 2:41 am
Reply with quote

Apologies for using incorrect term. What I meant by error was JCL step returning a non-zero return code (RC). I will take care of it from next time. Thanks.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Apr 13, 2017 3:36 am
Reply with quote

It is always better to show sample data. What do you have here:
Code:
AND,25,9,CH,EQ,181,9,CH
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 13, 2017 4:32 am
Reply with quote

Quote:
But when there are more than 1 header and trailer in the input then it doesn't work
You have been on this forum for almost 11 years and have seen none of the posts stating that telling us something "doesn't work" is useless -- HOW did it not work?
Did it generate a SORT error?
Did it generate a non-zero return code for the SORT step (and if so, WHAT RETURN CODE)?
Did it generate an empty output data set?
Did it generate a data set with the correct data but no headers or trailers?
Did it generate a data set with the correct data and headers but no trailers?
Did it generate a data set with the correct data and headers and trailers but they are not correct (and if this is the case, HOW are they not correct)?
etc
etc
etc
There's LOTS of ways something "doesn't work" -- you need to give us at least a little information about what isn't working for us to help you! You should post at a minimum the SORT messages!
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Apr 14, 2017 3:20 am
Reply with quote

mohitsaini,

For a single input data set condition, it seems like you are trying to generate RC=16 when there is either no header record, or an incorrect trailer record count, from the control cards shown.

I think you need to define clearly when you want the concatenated input to be considered as invalid - no header records at all OR missing any one header record. Similarly any one trailer record count is incorrect OR none of them are correct, and so on. Well then, it leads to a question of if there is something within the data(detail records) that helps distinguish between the records from multiple data sets involved in the concatenation.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Fri Apr 14, 2017 4:29 am
Reply with quote

Quote:
But when there are more than 1 header and trailer in the input then it doesn't work.
Of course it won't work as there is not way your are restarting the sequence number and identifying the next header and trailer and so on....
RahulG31, TS is matching total record count to Trailer count.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top